diff options
author | Brandt Bucher <brandtbucher@microsoft.com> | 2023-08-04 23:24:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-04 23:24:50 (GMT) |
commit | 05a824f294f1409f33e32f1799d5b413dcf24445 (patch) | |
tree | 173417047763313af6cc1a3c4c54f1d510d28d62 /Python | |
parent | ec0a0d2bd9faa247d5b3208a8138e4399b2da890 (diff) | |
download | cpython-05a824f294f1409f33e32f1799d5b413dcf24445.zip cpython-05a824f294f1409f33e32f1799d5b413dcf24445.tar.gz cpython-05a824f294f1409f33e32f1799d5b413dcf24445.tar.bz2 |
GH-84436: Skip refcounting for known immortals (GH-107605)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 2 | ||||
-rw-r--r-- | Python/context.c | 2 | ||||
-rw-r--r-- | Python/fileutils.c | 2 | ||||
-rw-r--r-- | Python/hamt.c | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index b85e967..30f722e 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1265,7 +1265,7 @@ initialize_locals(PyThreadState *tstate, PyFunctionObject *func, if (co->co_flags & CO_VARARGS) { PyObject *u = NULL; if (argcount == n) { - u = Py_NewRef(&_Py_SINGLETON(tuple_empty)); + u = (PyObject *)&_Py_SINGLETON(tuple_empty); } else { assert(args != NULL); diff --git a/Python/context.c b/Python/context.c index 9ac5187..c94c014 100644 --- a/Python/context.c +++ b/Python/context.c @@ -1267,7 +1267,7 @@ PyTypeObject _PyContextTokenMissing_Type = { static PyObject * get_token_missing(void) { - return Py_NewRef(&_Py_SINGLETON(context_token_missing)); + return (PyObject *)&_Py_SINGLETON(context_token_missing); } diff --git a/Python/fileutils.c b/Python/fileutils.c index f262c3e..19b23f6 100644 --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -105,7 +105,7 @@ _Py_device_encoding(int fd) #else if (_PyRuntime.preconfig.utf8_mode) { _Py_DECLARE_STR(utf_8, "utf-8"); - return Py_NewRef(&_Py_STR(utf_8)); + return &_Py_STR(utf_8); } return _Py_GetLocaleEncodingObject(); #endif diff --git a/Python/hamt.c b/Python/hamt.c index c78b5a7..24265ed 100644 --- a/Python/hamt.c +++ b/Python/hamt.c @@ -514,7 +514,7 @@ hamt_node_bitmap_new(Py_ssize_t size) /* Since bitmap nodes are immutable, we can cache the instance for size=0 and reuse it whenever we need an empty bitmap node. */ - return (PyHamtNode *)Py_NewRef(&_Py_SINGLETON(hamt_bitmap_node_empty)); + return (PyHamtNode *)&_Py_SINGLETON(hamt_bitmap_node_empty); } assert(size >= 0); |