mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
bpo-36389: _PyObject_CheckConsistency() available in release mode (GH-16612)
bpo-36389, bpo-38376: The _PyObject_CheckConsistency() function is now also available in release mode. For example, it can be used to debug a crash in the visit_decref() function of the GC. Modify the following functions to also work in release mode: * _PyDict_CheckConsistency() * _PyObject_CheckConsistency() * _PyType_CheckConsistency() * _PyUnicode_CheckConsistency() Other changes: * _PyMem_IsPtrFreed(ptr) now also returns 1 if ptr is NULL (equals to 0). * _PyBytesWriter_CheckConsistency() now returns 1 and is only used with assert(). * Reorder _PyObject_Dump() to write safe fields first, and only attempt to render repr() at the end.
This commit is contained in:
parent
321def805a
commit
6876257eaa
14 changed files with 155 additions and 140 deletions
|
@ -1032,16 +1032,6 @@ PyAPI_FUNC(int) PyUnicode_IsIdentifier(PyObject *s);
|
|||
|
||||
/* === Characters Type APIs =============================================== */
|
||||
|
||||
#if defined(Py_DEBUG) && !defined(Py_LIMITED_API)
|
||||
PyAPI_FUNC(int) _PyUnicode_CheckConsistency(
|
||||
PyObject *op,
|
||||
int check_content);
|
||||
#elif !defined(NDEBUG)
|
||||
/* For asserts that call _PyUnicode_CheckConsistency(), which would
|
||||
* otherwise be a problem when building with asserts but without Py_DEBUG. */
|
||||
#define _PyUnicode_CheckConsistency(op, check_content) PyUnicode_Check(op)
|
||||
#endif
|
||||
|
||||
#ifndef Py_LIMITED_API
|
||||
# define Py_CPYTHON_UNICODEOBJECT_H
|
||||
# include "cpython/unicodeobject.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue