Detect Py_TRACE_REFS at runtime and calculate object offsets accordingly by lostmsu · Pull Request #1426 · pythonnet/pythonnet
What does this implement/fix? Explain your changes.
This gets rid of #if PYTHON_WITH_PYDEBUG by detecting if objects have reference tracing (e.g. Py_TRACE_REFS) enabled at runtime based on the offset of refcount field in a new object.
Does this close any currently open issues?
It should fix #1412
Any other comments?
Slight refactoring had to be done to ensure initialization code does not depend on knowing field offsets until they actually become available.