Skip to content

bpo-38070: visit_decref() calls _PyObject_IsFreed() #15782

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
Sep 9, 2019
Merged

bpo-38070: visit_decref() calls _PyObject_IsFreed() #15782

merged 1 commit into from
Sep 9, 2019

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Sep 9, 2019

In debug mode, visit_decref() now calls _PyObject_IsFreed() to ensure
that the object is not freed. If it's freed, the program fails with
an assertion error and Python dumps informations about the freed
object.

https://bugs.python.org/issue38070

In debug mode, visit_decref() now calls _PyObject_IsFreed() to ensure
that the object is not freed. If it's freed, the program fails with
an assertion error and Python dumps informations about the freed
object.
Copy link
Member

@pablogsal pablogsal left a comment

Choose a reason for hiding this comment

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

LGTM

@vstinner
Copy link
Member Author

vstinner commented Sep 9, 2019

I compared performances without/with the change.

(*) Test 1: ./configure --with-pydebug; make; ./python -m test -j0 # using 8 logical CPUs and gcc -Og

  • ref: Total duration: 3 min 19 sec
  • patch: Total duration: 3 min 24 sec (almost the same)

(*) Test 2: bm_deltablue.py of pyperformance

"Benchmark hidden because not significant (1): deltablue"

Ok, it seems like this change has no significant impact on a debug build of Python.

@vstinner vstinner merged commit d91d4de into python:master Sep 9, 2019
@vstinner vstinner deleted the visit_decref branch September 9, 2019 15:45
@miss-islington
Copy link
Contributor

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 9, 2019
In debug mode, visit_decref() now calls _PyObject_IsFreed() to ensure
that the object is not freed. If it's freed, the program fails with
an assertion error and Python dumps informations about the freed
object.
(cherry picked from commit d91d4de)

Co-authored-by: Victor Stinner <[email protected]>
@bedevere-bot
Copy link

GH-15793 is a backport of this pull request to the 3.8 branch.

miss-islington added a commit that referenced this pull request Sep 9, 2019
In debug mode, visit_decref() now calls _PyObject_IsFreed() to ensure
that the object is not freed. If it's freed, the program fails with
an assertion error and Python dumps informations about the freed
object.
(cherry picked from commit d91d4de)

Co-authored-by: Victor Stinner <[email protected]>
websurfer5 pushed a commit to websurfer5/cpython that referenced this pull request Jul 20, 2020
In debug mode, visit_decref() now calls _PyObject_IsFreed() to ensure
that the object is not freed. If it's freed, the program fails with
an assertion error and Python dumps informations about the freed
object.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants