Hi,
I’m working on removing outdated example scripts in Tools/scripts/ and I found a combinerefs.py script in Tools/scripts/. I used PYTHONDUMPREFS a few days, but I wasn’t aware of this script (!) and I was never able to extract anything useful from this very verbose output. Usually, I found my issues with bisection, reading source code and tools others than “trace refs”.
Since Python 3.8, Python built in debug mode no longer defines the Py_TRACE_REFS macro which adds the double linked list to PyObject. It’s now a configure option (./configure --with-trace-refs).
I’m now curious if someone still uses the PYTHONDUMPREFS env var and can get anything useful from this output? In this case, please tell me, it may help me ![]()
At least, sys.getobjects() (also enabled by Py_TRACE_REFS macro) still looks interesting to debug, since it contains Python objects not tracked by the GC (not listed by gc.get_objects()).
For me, the main question is: would you be ok with removing Tools/scripts/combinerefs.py?
Should we even deprecate and/or remove PYTHONDUMPREFS env var? I’m fine with keeping it if someone finds it useful.
The “Trace refs” debug feature is currently documented at: 3. Configure Python — Python 3.12.0a0 documentation (yep, the doc is very short…). There is a “Trace Refs” buildbot making sure that it’s still possible to build Python with this debug option ![]()
Victor