Skip to content

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

Merged
vstinner merged 1 commit into
python:masterfrom
vstinner:visit_decref
Sep 9, 2019
Merged

bpo-38070: visit_decref() calls _PyObject_IsFreed()#15782
vstinner merged 1 commit into
python:masterfrom
vstinner:visit_decref

Conversation

@vstinner

@vstinner vstinner commented Sep 9, 2019

Copy link
Copy Markdown
Member

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.

@pablogsal pablogsal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@vstinner

vstinner commented Sep 9, 2019

Copy link
Copy Markdown
Member Author

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
Copy Markdown
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 <vstinner@redhat.com>
@bedevere-bot

Copy link
Copy Markdown

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 <vstinner@redhat.com>
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