diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2022-02-23 00:23:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-23 00:23:51 (GMT) |
commit | 1f455361ecfb1892e375bdbee813cdf095b6cfb8 (patch) | |
tree | d7def4d5d167965a45c4b0e30bb5a1a0bb5c3b4a /Python/_warnings.c | |
parent | cff4d5c5d29528299ec1ac5b3b3a6f7735577c01 (diff) | |
download | cpython-1f455361ecfb1892e375bdbee813cdf095b6cfb8.zip cpython-1f455361ecfb1892e375bdbee813cdf095b6cfb8.tar.gz cpython-1f455361ecfb1892e375bdbee813cdf095b6cfb8.tar.bz2 |
bpo-46765: Replace Locally Cached Strings with Statically Initialized Objects (gh-31366)
https://bugs.python.org/issue46765
Diffstat (limited to 'Python/_warnings.c')
-rw-r--r-- | Python/_warnings.c | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c index 03e6ffc..be962e7 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -768,25 +768,6 @@ warn_explicit(PyThreadState *tstate, PyObject *category, PyObject *message, static int is_internal_frame(PyFrameObject *frame) { - static PyObject *importlib_string = NULL; - static PyObject *bootstrap_string = NULL; - int contains; - - if (importlib_string == NULL) { - importlib_string = PyUnicode_FromString("importlib"); - if (importlib_string == NULL) { - return 0; - } - - bootstrap_string = PyUnicode_FromString("_bootstrap"); - if (bootstrap_string == NULL) { - Py_DECREF(importlib_string); - return 0; - } - Py_INCREF(importlib_string); - Py_INCREF(bootstrap_string); - } - if (frame == NULL) { return 0; } @@ -802,12 +783,12 @@ is_internal_frame(PyFrameObject *frame) return 0; } - contains = PyUnicode_Contains(filename, importlib_string); + int contains = PyUnicode_Contains(filename, &_Py_ID(importlib)); if (contains < 0) { return 0; } else if (contains > 0) { - contains = PyUnicode_Contains(filename, bootstrap_string); + contains = PyUnicode_Contains(filename, &_Py_ID(_bootstrap)); if (contains < 0) { return 0; } |