Skip to content

Detect Py_TRACE_REFS at runtime and calculate object offsets accordingly #1426

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 27, 2021

Conversation

lostmsu
Copy link
Member

@lostmsu lostmsu commented Mar 26, 2021

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.

@lostmsu lostmsu force-pushed the bugs/Py_DEBUG branch 2 times, most recently from de42b75 to 689f0d8 Compare March 31, 2021 06:36
Copy link
Contributor

@BadSingleton BadSingleton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lostmsu lostmsu merged commit db746aa into pythonnet:master Apr 27, 2021
@lostmsu lostmsu deleted the bugs/Py_DEBUG branch April 27, 2021 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to run with Python debug library
2 participants