#include "pycore_pyerrors.h" // _PyErr_ProgramDecodedTextObject()
#include "pycore_runtime.h" // _Py_ID()
+#include "pycore_tuple.h" // _PyTuple_FromPair
#include "lexer/state.h"
#include "lexer/lexer.h"
#include "pegen.h"
goto error;
}
- tuple = PyTuple_Pack(2, errstr, tmp);
+ tuple = _PyTuple_FromPair(errstr, tmp);
Py_DECREF(tmp);
if (!tuple) {
goto error;
if (!tmp) {
goto error;
}
- value = PyTuple_Pack(2, errstr, tmp);
+ value = _PyTuple_FromPair(errstr, tmp);
Py_DECREF(tmp);
if (!value) {
goto error;
#include "Python.h"
#include "errcode.h"
#include "internal/pycore_critical_section.h" // Py_BEGIN_CRITICAL_SECTION
+#include "internal/pycore_tuple.h" // _PyTuple_FromPair
#include "../Parser/lexer/state.h"
#include "../Parser/lexer/lexer.h"
#include "../Parser/tokenizer/tokenizer.h"
goto exit;
}
- value = PyTuple_Pack(2, errstr, tmp);
+ value = _PyTuple_FromPair(errstr, tmp);
if (!value) {
result = -1;
goto exit;
#include "pycore_pylifecycle.h" // _Py_IsInterpreterFinalizing()
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "pycore_traceback.h" // _Py_DisplaySourceLine()
+#include "pycore_tuple.h" // _PyTuple_FromPair
#include "pycore_unicodeobject.h" // _PyUnicode_EqualToASCIIString()
#include <stdbool.h>
if (add_zero)
altkey = PyTuple_Pack(3, text, category, _PyLong_GetZero());
else
- altkey = PyTuple_Pack(2, text, category);
+ altkey = _PyTuple_FromPair(text, category);
rc = already_warned(interp, registry, altkey, 1);
Py_XDECREF(altkey);
if (lz->strict) {
return PyTuple_Pack(3, Py_TYPE(lz), lz->ittuple, Py_True);
}
- return PyTuple_Pack(2, Py_TYPE(lz), lz->ittuple);
+ return _PyTuple_FromPair((PyObject *)Py_TYPE(lz), lz->ittuple);
}
static PyObject *
#include "pycore_runtime.h" // _Py_ID()
#include "pycore_setobject.h" // _PySet_NextEntry()
#include "pycore_stats.h"
+#include "pycore_tuple.h" // _PyTuple_FromPair
#include "pycore_unicodeobject.h" // _PyUnicode_EqualToASCIIString()
#include "cpython/code.h"
return NULL;
}
/* Allocate a copy of the instruction sequence on the heap */
- res = PyTuple_Pack(2, _PyCompile_InstrSequence(c), metadata);
+ res = _PyTuple_FromPair((PyObject *)_PyCompile_InstrSequence(c), metadata);
finally:
Py_XDECREF(metadata);
#include "pycore_initconfig.h" // _PyStatus_OK()
#include "pycore_long.h" // _PyLong_Format()
#include "pycore_object.h" // _PyObject_GC_TRACK()
+#include "pycore_tuple.h" // _PyTuple_FromPair
#include <stddef.h> // offsetof()
static PyObject *
hamt_iter_yield_items(PyObject *key, PyObject *val)
{
- return PyTuple_Pack(2, key, val);
+ return _PyTuple_FromPair(key, val);
}
PyObject *
#include "pycore_object.h" // _PyObject_IsUniquelyReferenced
#include "pycore_pystate.h" // _PyInterpreterState_GET()
#include "pycore_setobject.h" // _PySet_NextEntryRef()
+#include "pycore_tuple.h" // _PyTuple_FromPairSteal
#include "pycore_unicodeobject.h" // _PyUnicode_InternImmortal()
#include "marshal.h" // Py_MARSHAL_VERSION
Py_DECREF(value);
break;
}
- PyObject *pair = PyTuple_Pack(2, dump, value);
- Py_DECREF(dump);
- Py_DECREF(value);
+ PyObject *pair = _PyTuple_FromPairSteal(dump, value);
if (pair == NULL) {
p->error = WFERR_NOMEMORY;
break;
#include "pycore_stats.h" // _PyStats_InterpInit()
#include "pycore_sysmodule.h" // _PySys_ClearAttrString()
#include "pycore_traceback.h" // _Py_DumpTracebackThreads()
+#include "pycore_tuple.h" // _PyTuple_FromPair
#include "pycore_typeobject.h" // _PyTypes_InitTypes()
#include "pycore_typevarobject.h" // _Py_clear_generic_types()
#include "pycore_unicodeobject.h" // _PyUnicode_InitTypes()
if (weaklist != NULL) { \
PyObject *wr = PyWeakref_NewRef(mod, NULL); \
if (wr) { \
- PyObject *tup = PyTuple_Pack(2, name, wr); \
+ PyObject *tup = _PyTuple_FromPair(name, wr); \
if (!tup || PyList_Append(weaklist, tup) < 0) { \
PyErr_FormatUnraisable("Exception ignored while removing modules"); \
} \