Skip to content

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented Nov 21, 2019

finalize_interp_clear() now explicitly clears the codec registry and
then trigger a GC collection to clear all references.

https://bugs.python.org/issue36854

finalize_interp_clear() now explicitly clears the codec registry and
then trigger a GC collection to clear all references.
@vstinner
Copy link
Member Author

test_tracemalloc does crash while trying to free _Py_TrueStruct (Py_True). This object is supposed to be immortal, no?

_PyGC_CollectNoFail();

/* Clear interpreter state and all thread states */
PyInterpreterState_Clear(tstate->interp);
Copy link
Member

Choose a reason for hiding this comment

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

IMHO, Can it be replaced by the newly declared variable?

PyInterpreterState_Clear(interp);

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, right, interp could be used. I hesitate between adding "interp" variables or using "tstate->interp" :-) I may change this in my next PR, I already merged this once before I read your comment, sorry.

Copy link
Member

Choose a reason for hiding this comment

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

Thank you for the reply :)

@vstinner vstinner merged commit 310e2d2 into python:master Nov 22, 2019
@vstinner vstinner deleted the finalize_interp_clear2 branch November 22, 2019 09:58
jacobneiltaylor pushed a commit to jacobneiltaylor/cpython that referenced this pull request Dec 5, 2019
finalize_interp_clear() now explicitly clears the codec registry and
then trigger a GC collection to clear all references.
shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Jan 31, 2020
finalize_interp_clear() now explicitly clears the codec registry and
then trigger a GC collection to clear all references.
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.

4 participants