summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-04-24 23:46:31 (GMT)
committerGitHub <noreply@github.com>2019-04-24 23:46:31 (GMT)
commit235e7b2b0d937ba8b4a9172aa72206187e3e1f54 (patch)
treea0b6c4c0698c4ec2d911a6b798fc945eb430e8ad
parentf4e4703e746067d6630410408d414b11003334d6 (diff)
downloadcpython-235e7b2b0d937ba8b4a9172aa72206187e3e1f54.zip
cpython-235e7b2b0d937ba8b4a9172aa72206187e3e1f54.tar.gz
cpython-235e7b2b0d937ba8b4a9172aa72206187e3e1f54.tar.bz2
bpo-36465: Fix test_regrtest on Windows (GH-12945)
Fix Py_DEBUG constant: check for sys.gettotalrefcount attribute rather than sys.getobjects. Update also SpecialBuilds.txt documentation.
-rw-r--r--Lib/test/test_regrtest.py2
-rw-r--r--Misc/SpecialBuilds.txt13
2 files changed, 10 insertions, 5 deletions
diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
index 6193776..a9febd0 100644
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -21,7 +21,7 @@ from test import support
from test.libregrtest import utils
-Py_DEBUG = hasattr(sys, 'getobjects')
+Py_DEBUG = hasattr(sys, 'gettotalrefcount')
ROOT_DIR = os.path.join(os.path.dirname(__file__), '..', '..')
ROOT_DIR = os.path.abspath(os.path.normpath(ROOT_DIR))
diff --git a/Misc/SpecialBuilds.txt b/Misc/SpecialBuilds.txt
index c188dd7..193de57 100644
--- a/Misc/SpecialBuilds.txt
+++ b/Misc/SpecialBuilds.txt
@@ -30,6 +30,8 @@ name "_" holds a reference to the last result displayed!
Py_REF_DEBUG also checks after every decref to verify that the refcount hasn't
gone negative, and causes an immediate fatal error if it has.
+Py_DEBUG implies Py_REF_DEBUG.
+
Special gimmicks:
sys.gettotalrefcount()
@@ -39,6 +41,8 @@ sys.gettotalrefcount()
Py_TRACE_REFS
-------------
+Build option: ``./configure --with-trace-refs``.
+
Turn on heavy reference debugging. This is major surgery. Every PyObject grows
two more pointers, to maintain a doubly-linked list of all live heap-allocated
objects. Most built-in type objects are not in this list, as they're statically
@@ -49,8 +53,6 @@ has been created.
Note that because the fundamental PyObject layout changes, Python modules
compiled with Py_TRACE_REFS are incompatible with modules compiled without it.
-Py_TRACE_REFS implies Py_REF_DEBUG.
-
Special gimmicks:
sys.getobjects(max[, type])
@@ -138,7 +140,8 @@ look at the object, you're likely to see that it's entirely filled with 0xDB
(meaning freed memory is getting used) or 0xCB (meaning uninitialized memory is
getting used).
-Note that PYMALLOC_DEBUG requires WITH_PYMALLOC.
+Note that PYMALLOC_DEBUG requires WITH_PYMALLOC. Py_DEBUG implies
+PYMALLOC_DEBUG (if WITH_PYMALLOC is enabled).
Special gimmicks:
@@ -156,7 +159,7 @@ Py_DEBUG
This is what is generally meant by "a debug build" of Python.
-Py_DEBUG implies LLTRACE, Py_REF_DEBUG, Py_TRACE_REFS, and PYMALLOC_DEBUG (if
+Py_DEBUG implies LLTRACE, Py_REF_DEBUG, and PYMALLOC_DEBUG (if
WITH_PYMALLOC is enabled). In addition, C assert()s are enabled (via the C way:
by not defining NDEBUG), and some routines do additional sanity checks inside
"#ifdef Py_DEBUG" blocks.
@@ -223,3 +226,5 @@ the interpreter is doing are sprayed to stdout, such as every opcode and opcode
argument and values pushed onto and popped off the value stack.
Not useful very often, but very useful when needed.
+
+Py_DEBUG implies LLTRACE.