8000 bpo-46765: Replace Locally Cached Strings with Statically Initialized Objects by ericsnowcurrently · Pull Request #31366 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-46765: Replace Locally Cached Strings with Statically Initialized Objects #31366

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

Merged
Merged
Changes from 1 commit
Commits
File filter
8000

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use b'', not ''.
  • Loading branch information
ericsnowcurrently committed Feb 16, 2022
commit 02995b0c1186c619be339fcafcdc0ad0687c7e2c
13 changes: 7 additions & 6 deletions Objects/codeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,20 +571,21 @@ 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,
.qualname = funcname_ob,
.code = &_Py_STR(empty),
.code = emptystring,
.firstlineno = firstlineno,
.linetable = &_Py_STR(empty),
.endlinetable = &_Py_STR(empty),
.columntable = &_Py_STR(empty),
.linetable = emptystring,
.endlinetable = emptystring,
.columntable = emptystring,
.consts = nulltuple,
.names = nulltuple,
.localsplusnames = nulltuple,
.localspluskinds = &_Py_STR(empty),
.exceptiontable = &_Py_STR(empty),
.localspluskinds = emptystring,
.exceptiontable = emptystring,
};
result = _PyCode_New(&con);

Expand Down
0