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 mstefanro
Date 2012-07-19.17:28:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1342718946.15.0.133705372041.issue15397@psf.upfronthosting.co.za>
In-reply-to
Content
In order to implement pickling of instance methods, a means of separating
the object and the unbound method is necessary.

This is easily done for Python methods (f.__self__ and f.__func__),
but not all of builtins support __func__. Moreover, there currently
appears to be no good way to distinguish functions from bound methods.

As a first step in solving this issue, I have attached a patch which:
1) adds __func__ for all function types
2) adds a few new definitions in the types module (AllFunctionTypes etc.)
3) adds isanyfunction(), isanyboundfunction(), isanyunboundfunction() in
  inspect (admittedly these are bad names)
4) functools.unbind

In case applying this patch is being considered, serious review is necessary,
as I'm not knowledgeable of cpython internals.
History
Date User Action Args
2012-07-19 17:29:07mstefanrosetrecipients: + mstefanro
2012-07-19 17:29:06mstefanrosetmessageid: <1342718946.15.0.133705372041.issue15397@psf.upfronthosting.co.za>
2012-07-19 17:29:05mstefanrolinkissue15397 messages
2012-07-19 17:29:04mstefanrocreate