Ticket #742 (closed defect: fixed)
using 'self' in the closure of extension type methods is broken
|Reported by:||scoder||Owned by:||scoder|
The following fails at runtime:
@cython.cclass class ExtType(object): def const1(self): return 1 def ext_method(self, a=2): """ >>> x = ExtType() >>> x.ext_method()() (1, 2) >>> x.ext_method(3)() (1, 3) """ def func(): return self.const1(), a return func
The error message is:
NameError: free variable 'self' referenced before assignment in enclosing scope
The problem is that the 'self' field is not being set in the closure instance. The same issue leads to crashes for generator methods.