diff options
author | Victor Stinner <vstinner@redhat.com> | 2018-07-24 23:37:05 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-24 23:37:05 (GMT) |
commit | 53b7d4e40208d91eb30ae28821213b2d8f2befc4 (patch) | |
tree | c3d58a8726b64126e7dfa863f09bc7fa168d38a0 /Python/pystate.c | |
parent | 95d34c2a37f4c5046f6439abef881925d34fe4ac (diff) | |
download | cpython-53b7d4e40208d91eb30ae28821213b2d8f2befc4.zip cpython-53b7d4e40208d91eb30ae28821213b2d8f2befc4.tar.gz cpython-53b7d4e40208d91eb30ae28821213b2d8f2befc4.tar.bz2 |
bpo-34170: Add _PyCoreConfig.bytes_warning (GH-8447)
Add more fields to _PyCoreConfig:
* _check_hash_pycs_mode
* bytes_warning
* debug
* inspect
* interactive
* legacy_windows_fs_encoding
* legacy_windows_stdio
* optimization_level
* quiet
* unbuffered_stdio
* user_site_directory
* verbose
* write_bytecode
Changes:
* Remove pymain_get_global_config() and pymain_set_global_config()
which became useless. These functions have been replaced by
_PyCoreConfig_GetGlobalConfig() and
_PyCoreConfig_SetGlobalConfig().
* sys.flags.dont_write_bytecode value is now restricted to 1 even if
-B option is specified multiple times on the command line.
* PyThreadState_Clear() now uses the config from the current
interpreter rather than using global Py_VerboseFlag
Diffstat (limited to 'Python/pystate.c')
-rw-r--r-- | Python/pystate.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/pystate.c b/Python/pystate.c index 629598e..e8d390d 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -568,7 +568,9 @@ _PyState_ClearModules(void) void PyThreadState_Clear(PyThreadState *tstate) { - if (Py_VerboseFlag && tstate->frame != NULL) + int verbose = tstate->interp->core_config.verbose; + + if (verbose && tstate->frame != NULL) fprintf(stderr, "PyThreadState_Clear: warning: thread still has a frame\n"); @@ -586,7 +588,7 @@ PyThreadState_Clear(PyThreadState *tstate) Py_CLEAR(tstate->exc_state.exc_traceback); /* The stack of exception states should contain just this thread. */ - if (Py_VerboseFlag && tstate->exc_info != &tstate->exc_state) { + if (verbose && tstate->exc_info != &tstate->exc_state) { fprintf(stderr, "PyThreadState_Clear: warning: thread still has a generator\n"); } |