Ticket #478 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

Cython closures not bound as methods

Reported by: robertwb Owned by: robertwb
Priority: major Milestone: 0.13
Component: Python Semantics Keywords:


This is especially relevant to using closures to decorate methods.

sage: class A:
....:     foo = lambda *x: x
sage: A.foo
<unbound method A.<lambda>>
sage: A().foo
<bound method A.<lambda> of <__main__.A instance at 0xacafee0>>
sage: A().foo()
(<__main__.A instance at 0xacd8080>,)

Rather than using the method binding trick ourselves, we need to make closures into a class with __call__, __get__, and __set__ methods.

Change History

Changed 5 years ago by robertwb

See also #494

Changed 5 years ago by robertwb

  • owner set to robertwb
  • milestone changed from wishlist to 0.13

Tests at  http://hg.cython.org/cython-closures/rev/ea90bf6a4c3a now that the #494 framework is in place.

Changed 5 years ago by robertwb

  • status changed from new to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.