[issue45061] [C API] Detect refcount bugs on True/False in C extensions

2021-09-22 Thread STINNER Victor
STINNER Victor added the comment: New changeset 8620be99da930230b18ec05f4d7446ee403531af by Victor Stinner in branch 'main': bpo-45061: Revert unicode_is_singleton() change (GH-28516) https://github.com/python/cpython/commit/8620be99da930230b18ec05f4d7446ee403531af -- _

[issue45061] [C API] Detect refcount bugs on True/False in C extensions

2021-09-22 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +26908 pull_request: https://github.com/python/cpython/pull/28516 ___ Python tracker ___ __

[issue45061] [C API] Detect refcount bugs on True/False in C extensions

2021-09-21 Thread STINNER Victor
STINNER Victor added the comment: I don't want to add a deallocator to bytes and int types to detect when their singleton is destroyed, since it would slow down C extensions which have no refcount bug. Maybe it could be added only if Py_DEBUG macro is defined. But I don't think that Py_DECRE

[issue45061] [C API] Detect refcount bugs on True/False in C extensions

2021-09-21 Thread STINNER Victor
STINNER Victor added the comment: New changeset 86f28372b17c8c56539e9543bea9f125ab11b8aa by Victor Stinner in branch 'main': bpo-45061: Detect refcount bug on empty string singleton (GH-28504) https://github.com/python/cpython/commit/86f28372b17c8c56539e9543bea9f125ab11b8aa --

[issue45061] [C API] Detect refcount bugs on True/False in C extensions

2021-09-21 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +26899 pull_request: https://github.com/python/cpython/pull/28504 ___ Python tracker ___ __

[issue45061] [C API] Detect refcount bugs on True/False in C extensions

2021-09-21 Thread STINNER Victor
STINNER Victor added the comment: New changeset 79a31480992c3fa5890fc7a6c5d9af6d337d5844 by Victor Stinner in branch 'main': bpo-45061: Detect refcount bug on empty tuple singleton (GH-28503) https://github.com/python/cpython/commit/79a31480992c3fa5890fc7a6c5d9af6d337d5844 -- _

[issue45061] [C API] Detect refcount bugs on True/False in C extensions

2021-09-21 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +26898 pull_request: https://github.com/python/cpython/pull/28503 ___ Python tracker ___ __

[issue45061] [C API] Detect refcount bugs on True/False in C extensions

2021-09-02 Thread Christian Tismer
Christian Tismer added the comment: > Apart None, True and False, do you know other objects which must not be > deleted? Yes, what I can think of is the immutable empty tuple singleton which is such a candidate to be forgotten. -- ___ Python track

[issue45061] [C API] Detect refcount bugs on True/False in C extensions

2021-09-01 Thread STINNER Victor
STINNER Victor added the comment: Christian Tismer: "What about an even more flexible solution? A debug option could memorize always the last object deallocated and give full info (the object's repr) before the crash would happen." Bugs in object_dealloc() are rare. Apart None, True and Fals

[issue45061] [C API] Detect refcount bugs on True/False in C extensions

2021-09-01 Thread Christian Tismer
Christian Tismer added the comment: Ah, that would be really much to store: every object with a refcount going to zero would have to be memorized :/ -- ___ Python tracker ___

[issue45061] [C API] Detect refcount bugs on True/False in C extensions

2021-09-01 Thread Christian Tismer
Christian Tismer added the comment: What about an even more flexible solution? A debug option could memorize always the last object deallocated and give full info (the object's repr) before the crash would happen. -- nosy: +Christian.Tismer ___ Pyth

[issue45061] [C API] Detect refcount bugs on True/False in C extensions

2021-08-31 Thread STINNER Victor
Change by STINNER Victor : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ __

[issue45061] [C API] Detect refcount bugs on True/False in C extensions

2021-08-31 Thread STINNER Victor
STINNER Victor added the comment: New changeset 4300352000beed22fb525ec45fd331918d206528 by Victor Stinner in branch 'main': bpo-45061: Detect Py_DECREF(Py_True) bug (GH-28089) https://github.com/python/cpython/commit/4300352000beed22fb525ec45fd331918d206528 --

[issue45061] [C API] Detect refcount bugs on True/False in C extensions

2021-08-31 Thread miss-islington
miss-islington added the comment: New changeset c4c57e5c0eb79795d4fd1d9d8292455567c60070 by Miss Islington (bot) in branch '3.10': bpo-45061: Enhance faulthandler traceback wit no Python frame (GH-28090) https://github.com/python/cpython/commit/c4c57e5c0eb79795d4fd1d9d8292455567c60070 -

[issue45061] [C API] Detect refcount bugs on True/False in C extensions

2021-08-31 Thread STINNER Victor
STINNER Victor added the comment: New changeset 888d4cc06b887e77f281ba4d640e281cb4c61b7b by Victor Stinner in branch 'main': bpo-45061: Enhance faulthandler traceback wit no Python frame (GH-28090) https://github.com/python/cpython/commit/888d4cc06b887e77f281ba4d640e281cb4c61b7b --

[issue45061] [C API] Detect refcount bugs on True/False in C extensions

2021-08-31 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 1.0 -> 2.0 pull_requests: +26539 pull_request: https://github.com/python/cpython/pull/28096 ___ Python tracker _

[issue45061] [C API] Detect refcount bugs on True/False in C extensions

2021-08-31 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +26533 pull_request: https://github.com/python/cpython/pull/28090 ___ Python tracker ___ __

[issue45061] [C API] Detect refcount bugs on True/False in C extensions

2021-08-31 Thread STINNER Victor
STINNER Victor added the comment: There was such bug in CPython stdlib, in the _testcapi module, see commit 310e2d25170a88ef03f6fd31efcc899fe062da2c of bpo-36854: commit 310e2d25170a88ef03f6fd31efcc899fe062da2c Author: Victor Stinner Date: Fri Nov 22 10:58:00 2019 +0100 bpo-36854: Fix

[issue45061] [C API] Detect refcount bugs on True/False in C extensions

2021-08-31 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +26532 stage: -> patch review pull_request: https://github.com/python/cpython/pull/28089 ___ Python tracker ___ __

[issue45061] [C API] Detect refcount bugs on True/False in C extensions

2021-08-31 Thread STINNER Victor
STINNER Victor added the comment: To reproduce the bug, apply attached os_uname_refcount_bug.patch and call os.uname(): --- $ ./python -c 'import os; os.uname()' (...) Fatal Python error: _PyMem_DebugRawFree: bad ID: Allocated using API '', verified using API 'o' (...) --- -- keyword

[issue45061] [C API] Detect refcount bugs on True/False in C extensions

2021-08-31 Thread STINNER Victor
New submission from STINNER Victor : Writing C extensions using directly the C API is error prone. It's easy to add or forget a Py_INCREF or Py_DECREF. Adding Py_DECREF(Py_True) or Py_DECREF(Py_False) by mistake causes a surprising crash at Python exit: --- Debug memory block at address p=0x8a