Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 35.2k
GH-145247: Use _PyTuple_FromPair[Steal] in Objects#145884
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
eb71cca8a189d8db20d925c295d37e45fc55055af70fc920f36d7afcb1c6388a649f9e83cc5825db19220b035377ed7b941b4df9206a01ebFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -13,6 +13,7 @@ | ||
| #include "pycore_object.h" // _PyObject_GC_UNTRACK() | ||
| #include "pycore_opcode_metadata.h" // _PyOpcode_Caches | ||
| #include "pycore_optimizer.h" // _Py_Executors_InvalidateDependency() | ||
| #include "pycore_tuple.h" // _PyTuple_FromPair | ||
| #include "pycore_unicodeobject.h" // _PyUnicode_Equal() | ||
| #include "frameobject.h" // PyFrameLocalsProxyObject | ||
| @@ -630,22 +631,16 @@ framelocalsproxy_items(PyObject *self, PyObject *Py_UNUSED(ignored)) | ||
| PyObject *value = framelocalsproxy_getval(frame->f_frame, co, i); | ||
| if (value) { | ||
| PyObject *pair = PyTuple_Pack(2, name, value); | ||
| PyObject *pair = _PyTuple_FromPairSteal(Py_NewRef(name), value); | ||
| if (pair == NULL) { | ||
| Py_DECREF(items); | ||
| Py_DECREF(value); | ||
| return NULL; | ||
| } | ||
| if (PyList_Append(items, pair) < 0) { | ||
| Py_DECREF(items); | ||
| Py_DECREF(pair); | ||
| Py_DECREF(value); | ||
| return NULL; | ||
| goto error; | ||
| } | ||
| int rc = PyList_Append(items, pair); | ||
| Py_DECREF(pair); | ||
| Py_DECREF(value); | ||
| if (rc < 0) { | ||
| goto error; | ||
| } | ||
| } | ||
| } | ||
| @@ -655,23 +650,24 @@ framelocalsproxy_items(PyObject *self, PyObject *Py_UNUSED(ignored)) | ||
| PyObject *key = NULL; | ||
| PyObject *value = NULL; | ||
| while (PyDict_Next(frame->f_extra_locals, &j, &key, &value)) { | ||
| PyObject *pair = PyTuple_Pack(2, key, value); | ||
| PyObject *pair = _PyTuple_FromPair(key, value); | ||
| if (pair == NULL) { | ||
| Py_DECREF(items); | ||
| return NULL; | ||
| } | ||
| if (PyList_Append(items, pair) < 0) { | ||
| Py_DECREF(items); | ||
| Py_DECREF(pair); | ||
| return NULL; | ||
| goto error; | ||
| } | ||
| int rc = PyList_Append(items, pair); | ||
| Py_DECREF(pair); | ||
| if (rc < 0) { | ||
| goto error; | ||
| } | ||
| } | ||
| } | ||
| return items; | ||
vstinner marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| error: | ||
| Py_DECREF(items); | ||
| return NULL; | ||
| } | ||
| static Py_ssize_t | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.