Skip to content
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

bpo-30860: Consolidate stateful runtime globals. #3397

Merged
merged 94 commits into from
Sep 8, 2017

Conversation

ericsnowcurrently
Copy link
Member

@ericsnowcurrently ericsnowcurrently commented Sep 6, 2017

(trying again; see #2594)

  • group the (stateful) runtime globals into various topical structs
  • consolidate the topical structs under a single top-level _PyRuntimeState struct
  • add a check-c-globals.py script that helps identify runtime globals

Other globals are excluded (see globals.txt and check-c-globals.py).

https://bugs.python.org/issue30860

Include/ceval.h Outdated
@@ -93,7 +93,12 @@ PyAPI_FUNC(int) Py_GetRecursionLimit(void);
PyThreadState_GET()->overflowed = 0; \
} while(0)
PyAPI_FUNC(int) _Py_CheckRecursiveCall(const char *where);
PyAPI_DATA(int) _Py_CheckRecursionLimit;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is in the stable API, no?

Copy link
Member Author

Choose a reason for hiding this comment

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

:( I'm going to revert the _Py_CheckRecursionLimit part of the change for now and circle back after this patch lands.

extern "C" {
#endif

#include <ceval.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

These sorts of includes should probably be quoted and qualified "internal/ceval.h".

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

Python/pystate.c Outdated
void
_PyRuntimeState_Init(_PyRuntimeState *runtime)
{
_PyRuntimeState initial = {};
Copy link
Contributor

Choose a reason for hiding this comment

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

Empty initializers aren't standard. You should probably just memset it to 0.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed


int Py_DebugFlag;
int Py_VerboseFlag;
int Py_IgnoreEnvironmentFlag;
struct pyruntimestate _PyRuntime = {};
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto on empty initializer list

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@ericsnowcurrently ericsnowcurrently merged commit 2ebc5ce into python:master Sep 8, 2017
ma8ma added a commit to ma8ma/cpython that referenced this pull request Sep 9, 2017
Resolve conflicts:
2ebc5ce bpo-30860: Consolidate stateful runtime globals. (python#3397)
ericsnowcurrently added a commit that referenced this pull request Sep 12, 2017
PR #3397 introduced a large number of warnings to the Windows build. This patch fixes them.
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.

6 participants