mirror of
https://github.com/python/cpython.git
synced 2025-12-04 16:43:27 +00:00
bpo-38400 Don't check for NULL linked list pointers in _PyObject_IsFreed (GH-16630)
Some objects like Py_None are not initialized with conventional means that prepare the circular linked list pointers, leaving them unlinked from the rest of the objects. For those objects, NULL pointers does not mean that they are freed, so we need to skip the check in those cases.
This commit is contained in:
parent
1b18455695
commit
36e33c360e
1 changed files with 4 additions and 1 deletions
|
|
@ -454,7 +454,10 @@ _PyObject_IsFreed(PyObject *op)
|
||||||
/* ignore op->ob_ref: its value can have be modified
|
/* ignore op->ob_ref: its value can have be modified
|
||||||
by Py_INCREF() and Py_DECREF(). */
|
by Py_INCREF() and Py_DECREF(). */
|
||||||
#ifdef Py_TRACE_REFS
|
#ifdef Py_TRACE_REFS
|
||||||
if (_PyMem_IsPtrFreed(op->_ob_next) || _PyMem_IsPtrFreed(op->_ob_prev)) {
|
if (op->_ob_next != NULL && _PyMem_IsPtrFreed(op->_ob_next)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (op->_ob_prev != NULL && _PyMem_IsPtrFreed(op->_ob_prev)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue