Skip to content

[3.7] bpo-36389: _PyObject_IsFreed() now also detects uninitialized memory (GH-12770)#12780

Closed
vstinner wants to merge 1 commit intopython:3.7from
vstinner:freed37
Closed

[3.7] bpo-36389: _PyObject_IsFreed() now also detects uninitialized memory (GH-12770)#12780
vstinner wants to merge 1 commit intopython:3.7from
vstinner:freed37

Conversation

@vstinner
Copy link
Copy Markdown
Member

@vstinner vstinner commented Apr 11, 2019

Rename _PyMem_IsFreed() function to _PyMem_IsPtrFreed(). 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)

https://bugs.python.org/issue36389

…H-12770)

Rename _PyMem_IsFreed() function to _PyMem_IsPtrFreed(). 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)
@vstinner
Copy link
Copy Markdown
Member Author

In master, I used a "static inline" function. To avoid any compilation issue in 3.7, I kept a regular function.

@vstinner
Copy link
Copy Markdown
Member Author

Oh, it seems like some buildbots are unhappy with my change in the master branch :-/

https://buildbot.python.org/all/#/builders/40/builds/1956

@vstinner
Copy link
Copy Markdown
Member Author

I close this PR. I will redo it once my following fix will be merged in master.

@vstinner vstinner closed this Apr 11, 2019
@vstinner vstinner deleted the freed37 branch April 11, 2019 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants