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 mstefanro
Recipients alexandre.vassalotti, asvetlov, daniel.urban, loewis, meador.inge, mstefanro, ncoghlan, rhettinger, sbt, yselivanov
Date 2012-07-22.15:42:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1342971776.47.0.310431776305.issue15397@psf.upfronthosting.co.za>
In-reply-to
Content
Andrew, thanks for creating a separate issue (the refleak was very rare and I thought I'd put it in the same place, but now I realize it was a bad idea).

Richard, actually, the isinstance(self, type) check I mentioned earlier would have to be before the hastattr(f, '__func__') check, because Python classmethods provide a __func__ too:

    def unbind(f):
        self = getattr(f, '__self__', None)
        if self is not None and not isinstance(self, types.ModuleType) \
                            and not isinstance(self, type):
            if hasattr(f, '__func__'):
                return f.__func__
            return getattr(type(f.__self__), f.__name__)
        raise TypeError('not a bound method')

Anyway, I'm not convinced this is worth adding anymore. As Antoine Pitrou suggested on the ml, it would probably be a better idea if I implemented __reduce__ for builtin methods as well as Python methods rather than having a separate opcode for pickling methods.
History
Date User Action Args
2012-07-22 15:42:56mstefanrosetrecipients: + mstefanro, loewis, rhettinger, ncoghlan, alexandre.vassalotti, asvetlov, meador.inge, daniel.urban, sbt, yselivanov
2012-07-22 15:42:56mstefanrosetmessageid: <1342971776.47.0.310431776305.issue15397@psf.upfronthosting.co.za>
2012-07-22 15:42:55mstefanrolinkissue15397 messages
2012-07-22 15:42:55mstefanrocreate