Opened 5 years ago

Closed 5 years ago

#478 closed defect (fixed)

Cython closures not bound as methods

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

Description

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 (3)

comment:1 Changed 5 years ago by robertwb

See also #494

comment:2 Changed 5 years ago by robertwb

  • Milestone changed from wishlist to 0.13
  • Owner set to robertwb

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

comment:3 Changed 5 years ago by robertwb

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