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 /Objects/codeobject.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 'Objects/codeobject.c')
-rw-r--r-- | Objects/codeobject.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/Objects/codeobject.c b/Objects/codeobject.c index 9a27f12..f8ef1e6 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -553,16 +553,11 @@ PyCode_New(int argcount, int kwonlyargcount, PyCodeObject * PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno) { - PyObject *emptystring = NULL; PyObject *nulltuple = NULL; PyObject *filename_ob = NULL; PyObject *funcname_ob = NULL; PyCodeObject *result = NULL; - emptystring = PyBytes_FromString(""); - if (emptystring == NULL) { - goto failed; - } nulltuple = PyTuple_New(0); if (nulltuple == NULL) { goto failed; @@ -576,6 +571,7 @@ PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno) goto failed; } +#define emptystring (PyObject *)&_Py_SINGLETON(bytes_empty) struct _PyCodeConstructor con = { .filename = filename_ob, .name = funcname_ob, @@ -594,7 +590,6 @@ PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno) result = _PyCode_New(&con); failed: - Py_XDECREF(emptystring); Py_XDECREF(nulltuple); Py_XDECREF(funcname_ob); Py_XDECREF(filename_ob); |