[issue14631] Instance methods and WeakRefs don't mix.

2012-11-26 Thread Jesús Cea Avión
Changes by Jesús Cea Avión : -- superseder: Instance methods and WeakRefs don't mix. -> ___ Python tracker ___ ___ Python-bugs-list m

[issue14631] Instance methods and WeakRefs don't mix.

2012-11-26 Thread Jesús Cea Avión
Changes by Jesús Cea Avión : -- superseder: -> Instance methods and WeakRefs don't mix. ___ Python tracker ___ ___ Python-bugs-list m

[issue14631] Instance methods and WeakRefs don't mix.

2012-11-26 Thread Jesús Cea Avión
Changes by Jesús Cea Avión : -- nosy: +jcea ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue14631] Instance methods and WeakRefs don't mix.

2012-11-17 Thread Antoine Pitrou
Antoine Pitrou added the comment: Committed, thank you! -- resolution: -> fixed stage: patch review -> committed/rejected status: open -> closed ___ Python tracker ___ _

[issue14631] Instance methods and WeakRefs don't mix.

2012-11-17 Thread Roundup Robot
Roundup Robot added the comment: New changeset 27c20650aeab by Antoine Pitrou in branch 'default': Issue #14631: Add a new :class:`weakref.WeakMethod` to simulate weak references to bound methods. http://hg.python.org/cpython/rev/27c20650aeab -- nosy: +python-dev __

[issue14631] Instance methods and WeakRefs don't mix.

2012-11-12 Thread Antoine Pitrou
Antoine Pitrou added the comment: > What does inheriting from 'ref' buy you? Hmm, I'm not sure. I thought I'd mimick KeyedRef's inheritance design, plus isinstance(..., weakref.ref) works, and composition would make the object slightly bigger. Other than that, probably nothing. -- __

[issue14631] Instance methods and WeakRefs don't mix.

2012-11-12 Thread Mark Dickinson
Mark Dickinson added the comment: The patch looks okay to me. What does inheriting from 'ref' buy you? This feels a bit strange to me: the way I think of it, the WeakMethod *has* a weakref to the underlying object, rather than *being* a weakref to the underlying object. The __repr__ also se

[issue14631] Instance methods and WeakRefs don't mix.

2012-11-11 Thread Simon Feltman
Simon Feltman added the comment: Some more complex examples from various libraries: https://github.com/django/django/blob/master/django/dispatch/saferef.py https://github.com/11craft/louie/blob/master/louie/saferef.py I think both of these originated in pydispatcher. -- __

[issue14631] Instance methods and WeakRefs don't mix.

2012-11-11 Thread Simon Feltman
Simon Feltman added the comment: The WeakCallableRef that was attached seemed to support regular functions (or anything callable) which is nice. The naming also leaves room for a WeakCallableProxy. -- ___ Python tracker

[issue14631] Instance methods and WeakRefs don't mix.

2012-11-11 Thread Daniel Urban
Changes by Daniel Urban : -- nosy: +daniel.urban ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.py

[issue14631] Instance methods and WeakRefs don't mix.

2012-11-11 Thread Antoine Pitrou
Antoine Pitrou added the comment: Here is a patch adding a WeakMethod class. It still lacks docs, I'll add some if people agree on the principle. -- keywords: +patch Added file: http://bugs.python.org/file27960/weakmethod.patch ___ Python tracker

[issue14631] Instance methods and WeakRefs don't mix.

2012-11-11 Thread Antoine Pitrou
Antoine Pitrou added the comment: WeakMethod sounds like a good name to me. However, instead of acting as a proxy, I think it should act as a regular weakref (i.e. you have to call it to get the actual method object). -- nosy: +pitrou ___ Python tra

[issue14631] Instance methods and WeakRefs don't mix.

2012-11-11 Thread Mark Dickinson
Changes by Mark Dickinson : -- versions: +Python 3.4 -Python 3.3 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue14631] Instance methods and WeakRefs don't mix.

2012-11-11 Thread Simon Feltman
Simon Feltman added the comment: Just a note this is also referred to as a "WeakMethod" by some folks (so this ticket shows up in those searches). See also: http://bugs.python.org/issue813299 http://bugs.python.org/issue7464 http://bugs.python.org/issue16452 --

[issue14631] Instance methods and WeakRefs don't mix.

2012-11-11 Thread Mark Dickinson
Mark Dickinson added the comment: Adding some useful links from Simon Feltman in issue 16452. See also: http://bugs.python.org/issue813299 http://bugs.python.org/issue7464 This is the recipes: http://code.activestate.com/recipes/81253/ http://mindtrove.info/python-weak-references/ -- n

[issue14631] Instance methods and WeakRefs don't mix.

2012-04-20 Thread Mark Dickinson
Mark Dickinson added the comment: I quite like the WeakCallableRef idea, having had to work around this problem myself in the past (using a similar mechanism). This looks like a feature request rather than a bug report, though; changing Type and Versions accordingly. -- nosy: +mark.

[issue14631] Instance methods and WeakRefs don't mix.

2012-04-20 Thread Sundance
New submission from Sundance : SUMMARY === The behavior of instance methods makes it impossible to keep a weakref on them. The reference dies instantly even if the instance and the method still exist. EXAMPLE === >>> import weakref >>> callbacks = weakref.WeakSet() >>> def callback