Skip to content

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented Nov 20, 2019

Add PyInterpreterState.runtime field: reference to the _PyRuntime
global variable. This field exists to not have to pass runtime in
addition to tstate to a function. Get runtime from tstate:
tstate->interp->runtime.

Remove "_PyRuntimeState *runtime" parameter from functions already
taking a "PyThreadState *tstate" parameter.

_PyGC_Init() first parameter becomes "PyThreadState *tstate".

https://bugs.python.org/issue36710

Add PyInterpreterState.runtime field: reference to the _PyRuntime
global variable. This field exists to not have to pass runtime in
addition to tstate to a function.  Get runtime from tstate:
tstate->interp->runtime.

Remove "_PyRuntimeState *runtime" parameter from functions already
taking a "PyThreadState *tstate" parameter.

_PyGC_Init() first parameter becomes "PyThreadState *tstate".
@vstinner
Copy link
Member Author

@ericsnowcurrently @nanjekyejoannah: First, I was strongly opposed to this change. But you can now see that this PR now simply a lot of code, since I modified many functions to pass tstate.

@vstinner vstinner merged commit 01b1cc1 into python:master Nov 20, 2019
@vstinner vstinner deleted the interp_runtime branch November 20, 2019 01:27
@ericsnowcurrently
Copy link
Member

Yeah, I was just thinking I had made this exact same change at some point. :) Thanks for doing this!

@vstinner
Copy link
Member Author

I also decided to make it since the code is now more ready to be able to move fields from _PyRuntime to PyInterpreterState.

jacobneiltaylor pushed a commit to jacobneiltaylor/cpython that referenced this pull request Dec 5, 2019
Add PyInterpreterState.runtime field: reference to the _PyRuntime
global variable. This field exists to not have to pass runtime in
addition to tstate to a function.  Get runtime from tstate:
tstate->interp->runtime.

Remove "_PyRuntimeState *runtime" parameter from functions already
taking a "PyThreadState *tstate" parameter.

_PyGC_Init() first parameter becomes "PyThreadState *tstate".
shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Jan 31, 2020
Add PyInterpreterState.runtime field: reference to the _PyRuntime
global variable. This field exists to not have to pass runtime in
addition to tstate to a function.  Get runtime from tstate:
tstate->interp->runtime.

Remove "_PyRuntimeState *runtime" parameter from functions already
taking a "PyThreadState *tstate" parameter.

_PyGC_Init() first parameter becomes "PyThreadState *tstate".
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