This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lanfon72
Recipients lanfon72
Date 2016-12-30.05:53:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1483077218.4.0.672977492114.issue29114@psf.upfronthosting.co.za>
In-reply-to
Content
test code below:

```python

>>> from types import MethodType
>>> class A:
...   def f(self):
...     print(__class__)
...
>>> a = A()
>>> a.fn = MethodType(lambda s: print(__class__), a)
>>>
>>> a.f()
<class '__main__.A'>
>>> a.fn()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 1, in <lambda>
NameError: name '__class__' is not defined
```

this behavior affect `super()` not work in patched function scope, 
of course we can use old super as super(self.__class__, self) to make it work as expected, but I think it should work as original method if we already bounded the function to instance(class).
History
Date User Action Args
2016-12-30 05:53:38lanfon72setrecipients: + lanfon72
2016-12-30 05:53:38lanfon72setmessageid: <1483077218.4.0.672977492114.issue29114@psf.upfronthosting.co.za>
2016-12-30 05:53:38lanfon72linkissue29114 messages
2016-12-30 05:53:37lanfon72create