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 in Modules(1)#148000
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
File 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 |
|---|---|---|
| @@ -21,6 +21,7 @@ | ||
| #include "pycore_setobject.h" // _PySet_NextEntry() | ||
| #include "pycore_symtable.h" // _Py_Mangle() | ||
| #include "pycore_sysmodule.h" // _PySys_GetSizeOf() | ||
| #include "pycore_tuple.h" // _PyTuple_FromPair | ||
| #include "pycore_unicodeobject.h" // _PyUnicode_EqualToASCIIString() | ||
| #include <stdlib.h> // strtol() | ||
| @@ -3767,7 +3768,7 @@ fix_imports(PickleState *st, PyObject **module_name, PyObject **global_name) | ||
| PyObject *key; | ||
| PyObject *item; | ||
| key = PyTuple_Pack(2, *module_name, *global_name); | ||
| key = _PyTuple_FromPair(*module_name, *global_name); | ||
| if (key == NULL) | ||
| return -1; | ||
| item = PyDict_GetItemWithError(st->name_mapping_3to2, key); | ||
| @@ -3873,7 +3874,7 @@ save_global(PickleState *st, PicklerObject *self, PyObject *obj, | ||
| char pdata[5]; | ||
| Py_ssize_t n; | ||
| extension_key = PyTuple_Pack(2, module_name, global_name); | ||
| extension_key = _PyTuple_FromPair(module_name, global_name); | ||
| if (extension_key == NULL) { | ||
| goto error; | ||
| } | ||
| @@ -5133,26 +5134,19 @@ static PyObject * | ||
| _pickle_PicklerMemoProxy___reduce___impl(PicklerMemoProxyObject *self) | ||
| /*[clinic end generated code: output=bebba1168863ab1d input=2f7c540e24b7aae4]*/ | ||
| { | ||
| PyObject *reduce_value, *dict_args; | ||
| PyObject *dict_args; | ||
| PyObject *contents = _pickle_PicklerMemoProxy_copy_impl(self); | ||
| if (contents == NULL) | ||
| return NULL; | ||
| reduce_value = PyTuple_New(2); | ||
| if (reduce_value == NULL) { | ||
| Py_DECREF(contents); | ||
| return NULL; | ||
| } | ||
| dict_args = PyTuple_New(1); | ||
sergey-miryanov marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| if (dict_args == NULL) { | ||
| Py_DECREF(contents); | ||
| Py_DECREF(reduce_value); | ||
| return NULL; | ||
| } | ||
| PyTuple_SET_ITEM(dict_args, 0, contents); | ||
| PyTuple_SET_ITEM(reduce_value, 0, Py_NewRef(&PyDict_Type)); | ||
| PyTuple_SET_ITEM(reduce_value, 1, dict_args); | ||
| return reduce_value; | ||
| return _PyTuple_FromPairSteal(Py_NewRef(&PyDict_Type), dict_args); | ||
| } | ||
| static PyMethodDef picklerproxy_methods[] = { | ||
| @@ -7310,7 +7304,7 @@ _pickle_Unpickler_find_class_impl(UnpicklerObject *self, PyTypeObject *cls, | ||
| /* Check if the global (i.e., a function or a class) was renamed | ||
| or moved to another module. */ | ||
| key = PyTuple_Pack(2, module_name, global_name); | ||
| key = _PyTuple_FromPair(module_name, global_name); | ||
| if (key == NULL) | ||
| return NULL; | ||
| item = PyDict_GetItemWithError(st->name_mapping_2to3, key); | ||
| @@ -7640,27 +7634,19 @@ static PyObject * | ||
| _pickle_UnpicklerMemoProxy___reduce___impl(UnpicklerMemoProxyObject *self) | ||
| /*[clinic end generated code: output=6da34ac048d94cca input=6920862413407199]*/ | ||
| { | ||
| PyObject *reduce_value; | ||
| PyObject *constructor_args; | ||
| PyObject *contents = _pickle_UnpicklerMemoProxy_copy_impl(self); | ||
| if (contents == NULL) | ||
| return NULL; | ||
| reduce_value = PyTuple_New(2); | ||
| if (reduce_value == NULL) { | ||
| Py_DECREF(contents); | ||
| return NULL; | ||
| } | ||
| constructor_args = PyTuple_New(1); | ||
sergey-miryanov marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| if (constructor_args == NULL) { | ||
| Py_DECREF(contents); | ||
| Py_DECREF(reduce_value); | ||
| return NULL; | ||
| } | ||
| PyTuple_SET_ITEM(constructor_args, 0, contents); | ||
| PyTuple_SET_ITEM(reduce_value, 0, Py_NewRef(&PyDict_Type)); | ||
| PyTuple_SET_ITEM(reduce_value, 1, constructor_args); | ||
| return reduce_value; | ||
| return _PyTuple_FromPairSteal(Py_NewRef(&PyDict_Type), constructor_args); | ||
| } | ||
| static PyMethodDef unpicklerproxy_methods[] = { | ||
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.