[issue44881] Consider integration of GC_UNTRACK with TRASHCAN

2021-08-11 Thread STINNER Victor
STINNER Victor added the comment: Moreover, before making any change, I would suggest by starting with documenting the existing trashcan C API. Right now, there is no documentation in Doc/c-api/. Documentation can be copied from Include/cpython/object.h. Last year, I modified the trashcan AP

[issue44881] Consider integration of GC_UNTRACK with TRASHCAN

2021-08-11 Thread STINNER Victor
STINNER Victor added the comment: Please don't add new macros. The TRASHCAN C API is already complex enough. -- nosy: +vstinner ___ Python tracker ___

[issue44881] Consider integration of GC_UNTRACK with TRASHCAN

2021-08-10 Thread Neil Schemenauer
Neil Schemenauer added the comment: Since C99 is now allowed, perhaps we should suggest that declarations go after Py_TRASHCAN_BEGIN, e.g. mytype_dealloc(mytype *p) { Py_TRASHCAN_BEGIN(p, mytype_dealloc) ... declarations go here ... ... The

[issue44881] Consider integration of GC_UNTRACK with TRASHCAN

2021-08-10 Thread Neil Schemenauer
Neil Schemenauer added the comment: For examples of bugs caused by forgetting the untrack calls, see bpo-31095. -- ___ Python tracker ___ _

[issue44881] Consider integration of GC_UNTRACK with TRASHCAN

2021-08-10 Thread Neil Schemenauer
Neil Schemenauer added the comment: Extensions that call PyObject_GC_UnTrack before calling Py_TRASHCAN_BEGIN will still work, they will just take a very minor performance hit. I don't think it is worth the trouble to introduce new macros for that reason. Extensions that really care about

[issue44881] Consider integration of GC_UNTRACK with TRASHCAN

2021-08-10 Thread Neil Schemenauer
Change by Neil Schemenauer : -- keywords: +patch pull_requests: +26201 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/27718 ___ Python tracker

[issue44881] Consider integration of GC_UNTRACK with TRASHCAN

2021-08-10 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: We probably will need a new set of macros because these macros are public IIRC correctly. Although as PyObject_GC_UnTrack has a check, we probably can just absorb it and let backwards compat work by being idempotent if called twice -- nosy: +p

[issue44881] Consider integration of GC_UNTRACK with TRASHCAN

2021-08-10 Thread Neil Schemenauer
New submission from Neil Schemenauer : The fix for bpo-33930 includes a somewhat mysterious comment: // The Py_TRASHCAN mechanism requires that we be able to // call PyObject_GC_UnTrack twice on an object. I wonder if we can just integrate the untrack into the body of the trashcan cod