[issue15397] Unbinding of methods

2013-11-23 Thread Alexandre Vassalotti
Changes by Alexandre Vassalotti alexan...@peadrop.com: -- resolution: - duplicate status: open - closed superseder: - Implement PEP 3154 (pickle protocol 4) ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15397

[issue15397] Unbinding of methods

2012-07-22 Thread Andrew Svetlov
Andrew Svetlov andrew.svet...@gmail.com added the comment: Stefan, I've fixed refleak found by you in #15404. Thanks. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15397 ___

[issue15397] Unbinding of methods

2012-07-22 Thread Stefan Mihaila
Stefan Mihaila mstefa...@gmail.com added the comment: Richard, yes, I think that would work, I didn't think of using f.__self__'s type. You might want to replace if self is not None and not isinstance(self, types.ModuleType): with if self is not None and not isinstance(self,

[issue15397] Unbinding of methods

2012-07-22 Thread Stefan Mihaila
Stefan Mihaila mstefa...@gmail.com added the comment: 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

[issue15397] Unbinding of methods

2012-07-20 Thread Andrew Svetlov
Andrew Svetlov andrew.svet...@gmail.com added the comment: Stefan, you right. A bit hairy idiom from my perspective, but it works. Looks like this way used only for PyCFunction_New, all other code follows standard schema with trampoline. -- ___

[issue15397] Unbinding of methods

2012-07-20 Thread Richard Oudkerk
Richard Oudkerk shibt...@gmail.com added the comment: Can't you unbind without any changes to the C code by doing def unbind(f): if hasattr(f, '__func__'): return f.__func__ self = getattr(f, '__self__', None) if self is not None and not isinstance(self,

[issue15397] Unbinding of methods

2012-07-19 Thread Stefan Mihaila
Changes by Stefan Mihaila mstefa...@gmail.com: -- nosy: +alexandre.vassalotti, ncoghlan, rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15397 ___

[issue15397] Unbinding of methods

2012-07-19 Thread Stefan Mihaila
New submission from Stefan Mihaila mstefa...@gmail.com: 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__.

[issue15397] Unbinding of methods

2012-07-19 Thread Meador Inge
Changes by Meador Inge mead...@gmail.com: -- nosy: +meador.inge stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15397 ___ ___

[issue15397] Unbinding of methods

2012-07-19 Thread Andrew Svetlov
Changes by Andrew Svetlov andrew.svet...@gmail.com: -- nosy: +asvetlov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15397 ___ ___

[issue15397] Unbinding of methods

2012-07-19 Thread Andrew Svetlov
Andrew Svetlov andrew.svet...@gmail.com added the comment: Can you push patch in form available for review via Rietveld? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15397 ___

[issue15397] Unbinding of methods

2012-07-19 Thread Yury Selivanov
Changes by Yury Selivanov yselivanov...@gmail.com: -- nosy: +yselivanov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15397 ___ ___

[issue15397] Unbinding of methods

2012-07-19 Thread Stefan Mihaila
Stefan Mihaila mstefa...@gmail.com added the comment: Yes, the patch is at http://codereview.appspot.com/6425052/ The code there also contains some tests I've written for functools.unbind. -- Added file: http://bugs.python.org/file26439/unbind_test.patch

[issue15397] Unbinding of methods

2012-07-19 Thread Daniel Urban
Changes by Daniel Urban urban.dani...@gmail.com: -- nosy: +daniel.urban ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15397 ___ ___

[issue15397] Unbinding of methods

2012-07-19 Thread Andrew Svetlov
Andrew Svetlov andrew.svet...@gmail.com added the comment: Looks like PyCFunction_NewEx is part of Stable API. If I'm right you have to make stub for this one as simple trampoline to new PyCFunction_NewExEx implementation. Martin, please confirm. -- nosy: +loewis

[issue15397] Unbinding of methods

2012-07-19 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: Andrew is right: PyCFunction_NewEx must stay, and must continue to get the same parameters as it currently does. This not only applies to extensions already built, but also to extensions that are built against the new header files: they

[issue15397] Unbinding of methods

2012-07-19 Thread Stefan Mihaila
Stefan Mihaila mstefa...@gmail.com added the comment: Doesn't the definition I've added at the end of methodobject.c suffice? (http://codereview.appspot.com/6425052/patch/1/10) Or should the macro be removed altogether? -- ___ Python tracker