[3.7] bpo-36389: _PyObject_IsFreed() now also detects uninitialized memory (GH-12770)#12788
Conversation
…H-12770) Replace _PyMem_IsFreed() function with _PyMem_IsPtrFreed() inline function. The function is now way more efficient, it became a simple comparison on integers, rather than a short loop. It detects also uninitialized bytes and "forbidden bytes" filled by debug hooks on memory allocators. Add unit tests on _PyObject_IsFreed(). (cherry picked from commit 2b00db6)
| unsigned int domain, | ||
| uintptr_t ptr); | ||
|
|
||
| PyAPI_FUNC(int) _PyMem_IsFreed(void *ptr, size_t size); |
There was a problem hiding this comment.
(it's too late now) but should this have been backported? removing this symbol is ~technically an abi break (despite it being a "private" function)
packaging of 3.7.4 is complaining about disappearing symbols :(
There was a problem hiding this comment.
We don't provide any warranty on private symbols (prefixed by _Py or _PY): they can disappear anytime. The main issue was that we exposed it in the first place :-)
How do you check for symbols? My notes on the Python "stable" ABI: https://pythoncapi.readthedocs.io/stable_abi.html
Doesn't surprise :)
debian lists the exported symbols of the (it's actually quite annoying and probably the most time-consuming part of packaging python for me) Here's (for example) an "update symbols" commit: deadsnakes/python3.7@c5aec48 (or one with a more involved set of changes): deadsnakes/python3.7@55bead2 |
|
Maybe I should modify internal headers to not export symbols like _Py_ResetForceASCII() which should not be used outside Python. It is only declared in internal headers: Include/internal/pycore_fileutils.h. It is declared with PyAPI_FUNC(). Maybe I should replace PyAPI_FUNC() with extern. Do you have to list private symbols starting with _Py? |
I'm not sure debian has a concept of "private by convention" (it might! I just don't know) -- to be honest I don't actually know too much about the makeshlibs utility but I'll do some research 👍 |
https://bugs.python.org/issue36389