[issue17162] Py_LIMITED_API needs a PyType_GenericDealloc

2014-02-04 Thread Roundup Robot
Roundup Robot added the comment: New changeset 655d7a55c165 by Martin v. Löwis in branch 'default': Issue #17162: Add PyType_GetSlot. http://hg.python.org/cpython/rev/655d7a55c165 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org

[issue17162] Py_LIMITED_API needs a PyType_GenericDealloc

2014-02-04 Thread Martin v . Löwis
Martin v. Löwis added the comment: Thanks for the reviews; this is now committed. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17162 ___

[issue17162] Py_LIMITED_API needs a PyType_GenericDealloc

2014-02-04 Thread Roundup Robot
Roundup Robot added the comment: New changeset eaae4008327d by Victor Stinner in branch 'default': Issue #17162: Fix compilation, replace non-breaking space with an ASCII space http://hg.python.org/cpython/rev/eaae4008327d -- ___ Python tracker

[issue17162] Py_LIMITED_API needs a PyType_GenericDealloc

2014-01-31 Thread Martin v . Löwis
Martin v. Löwis added the comment: It's certainly possible to write a proper dealloc - just call PyObject_Del directly. This is correct if the type isn't subclassable, and works if it actually isn't subclassed, or if the subclass object can also be released through PyObject_Del. That this

[issue17162] Py_LIMITED_API needs a PyType_GenericDealloc

2014-01-31 Thread Larry Hastings
Larry Hastings added the comment: I was thinking of a subclass of an existing class, both implemented in C. collections.Counter does that, but it uses _PyType_LookupId() which is in the limited API. Would it be possible to achieve equivalent functionality by using _PyType_LookupId()? If

[issue17162] Py_LIMITED_API needs a PyType_GenericDealloc

2014-01-31 Thread Larry Hastings
Larry Hastings added the comment: (And, I freely admit I don't understand all this that well and that could be a very dumb question.) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17162

[issue17162] Py_LIMITED_API needs a PyType_GenericDealloc

2014-01-31 Thread Martin v . Löwis
Martin v. Löwis added the comment: I'm not sure we are looking at the same code base, I look at http://hg.python.org/cpython/file/b56ce3410ca6/Lib/collections/__init__.py#l401 and ISTM that collections.Counter is *not* implemented in C. Also, according to

[issue17162] Py_LIMITED_API needs a PyType_GenericDealloc

2014-01-30 Thread Martin v . Löwis
Martin v. Löwis added the comment: If the set of slots gets extended, extensions would have to opt-in to use the newer slots, i.e. the availability of slot numbers should be conditional at compile-time. Returning 0 for slots not supported in a version seems fine to me as well (after

[issue17162] Py_LIMITED_API needs a PyType_GenericDealloc

2014-01-30 Thread Larry Hastings
Larry Hastings added the comment: I thought I replied to this... weird. Do I understand correctly that it's basically impossible to write a proper custom deallocator in the limited API right now, because you can't get access to your base class's tp_free? (If so, why didn't anybody notice?)

[issue17162] Py_LIMITED_API needs a PyType_GenericDealloc

2014-01-30 Thread Larry Hastings
Larry Hastings added the comment: Also, isn't it reasonable to pass in non-heap type objects? I realize supporting this would complicate the implementation a great deal. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17162

[issue17162] Py_LIMITED_API needs a PyType_GenericDealloc

2014-01-28 Thread Martin v . Löwis
Martin v. Löwis added the comment: I propose a more general solution: add a function PyType_GetSlot. -- keywords: +patch Added file: http://bugs.python.org/file33762/getslot.diff ___ Python tracker rep...@bugs.python.org

[issue17162] Py_LIMITED_API needs a PyType_GenericDealloc

2014-01-28 Thread STINNER Victor
STINNER Victor added the comment: +return *(void**)(((char*)type) + slotoffsets[slot]); New Python versions may add new slots. What do you think of returning NULL if the slot number is higher than the maximum slot? It looks like #define Py_tp_free 74 is the highest slot number since

[issue17162] Py_LIMITED_API needs a PyType_GenericDealloc

2014-01-28 Thread Larry Hastings
Changes by Larry Hastings la...@hastings.org: -- nosy: +larry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17162 ___ ___ Python-bugs-list mailing

[issue17162] Py_LIMITED_API needs a PyType_GenericDealloc

2013-02-08 Thread Bradley Froehle
New submission from Bradley Froehle: I tried to implement a custom extension type using PyType_FromSpec and Py_LIMITED_API but couldn't implement tp_dealloc: static void mytype_dealloc(mytypeobject *self) { // free some fields in mytypeobject Py_TYPE(self)-tp_free((PyObject *) self);

[issue17162] Py_LIMITED_API needs a PyType_GenericDealloc

2013-02-08 Thread Bradley Froehle
Bradley Froehle added the comment: I should mention that essentially what I'm advocating is renaming and exposing `object_dealloc` in Objects/typeobject.c. The proper name is not obvious to me... should it be PyObject_GenericDealloc since it acts on objects? Or PyType_GenericDealloc since it

[issue17162] Py_LIMITED_API needs a PyType_GenericDealloc

2013-02-08 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17162 ___ ___ Python-bugs-list mailing