Replace _PyTuple_FromArray() with PyTuple_FromArray().
Remove pycore_tuple.h includes.
#define _PyTuple_ITEMS(op) _Py_RVALUE(_PyTuple_CAST(op)->ob_item)
-// Alias for backward compatibility
-#define _PyTuple_FromArray PyTuple_FromArray
-
PyAPI_FUNC(PyObject *)_PyTuple_FromStackRefStealOnSuccess(const union _PyStackRef *, Py_ssize_t);
PyAPI_FUNC(PyObject *)_PyTuple_FromArraySteal(PyObject *const *, Py_ssize_t);
goto exit;
}
a = args[0];
- __clinic_args = _PyTuple_FromArray(args + 1, nargs - 1);
+ __clinic_args = PyTuple_FromArray(args + 1, nargs - 1);
if (__clinic_args == NULL) {
goto exit;
}
static PyObject *
test_vararg_and_posonly_impl(PyObject *module, PyObject *a, PyObject *args)
-/*[clinic end generated code: output=0c11c475e240869e input=2c49a482f68545c0]*/
+/*[clinic end generated code: output=83cbe9554d04add2 input=2c49a482f68545c0]*/
/*[clinic input]
test_vararg
}
a = fastargs[0];
__clinic_args = nargs > 1
- ? _PyTuple_FromArray(args + 1, nargs - 1)
+ ? PyTuple_FromArray(args + 1, nargs - 1)
: PyTuple_New(0);
if (__clinic_args == NULL) {
goto exit;
static PyObject *
test_vararg_impl(PyObject *module, PyObject *a, PyObject *args)
-/*[clinic end generated code: output=17ba625cdd0369c1 input=7448995636d9186a]*/
+/*[clinic end generated code: output=d773f7b54e61f73a input=7448995636d9186a]*/
/*[clinic input]
test_vararg_with_default
}
skip_optional_kwonly:
__clinic_args = nargs > 1
- ? _PyTuple_FromArray(args + 1, nargs - 1)
+ ? PyTuple_FromArray(args + 1, nargs - 1)
: PyTuple_New(0);
if (__clinic_args == NULL) {
goto exit;
static PyObject *
test_vararg_with_default_impl(PyObject *module, PyObject *a, PyObject *args,
int b)
-/*[clinic end generated code: output=3f2b06ab08d5d0be input=3a0f9f557ce1f712]*/
+/*[clinic end generated code: output=d25e56802c197344 input=3a0f9f557ce1f712]*/
/*[clinic input]
test_vararg_with_only_defaults
}
c = fastargs[1];
skip_optional_kwonly:
- __clinic_args = _PyTuple_FromArray(args, nargs);
+ __clinic_args = PyTuple_FromArray(args, nargs);
if (__clinic_args == NULL) {
goto exit;
}
static PyObject *
test_vararg_with_only_defaults_impl(PyObject *module, PyObject *args, int b,
PyObject *c)
-/*[clinic end generated code: output=f46666f0b1bf86b9 input=6983e66817f82924]*/
+/*[clinic end generated code: output=7366943a7df42e05 input=6983e66817f82924]*/
/*[clinic input]
test_paramname_module
PyObject * const *args, Py_ssize_t args_length)
/*[clinic end generated code: output=267032f41bd039cc input=86ee3064b7853e86]*/
{
- PyObject *tuple = _PyTuple_FromArray(args, args_length);
+ PyObject *tuple = PyTuple_FromArray(args, args_length);
if (tuple == NULL) {
return NULL;
}
Py_ssize_t args_length)
/*[clinic end generated code: output=a25f42f39c9b13ad input=97b8bdcf87e019c7]*/
{
- return _PyTuple_FromArray(args, args_length);
+ return PyTuple_FromArray(args, args_length);
}
Py_ssize_t args_length)
/*[clinic end generated code: output=27c9da663e942617 input=9ba5ae1f1eb58777]*/
{
- return _PyTuple_FromArray(args, args_length);
+ return PyTuple_FromArray(args, args_length);
}
#include "pycore_long.h" // _PyLong_UnsignedShort_Converter()
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
#include "pycore_runtime.h" // _Py_ID()
-#include "pycore_tuple.h" // _PyTuple_FromArray()
+#include "pycore_tuple.h" // _PyTuple_ITEMS()
PyDoc_STRVAR(test_empty_function__doc__,
"test_empty_function($module, /)\n"
PyObject *return_value = NULL;
PyObject *__clinic_args = NULL;
- __clinic_args = _PyTuple_FromArray(args, nargs);
+ __clinic_args = PyTuple_FromArray(args, nargs);
if (__clinic_args == NULL) {
goto exit;
}
}
a = args[0];
b = args[1];
- __clinic_args = _PyTuple_FromArray(args + 2, nargs - 2);
+ __clinic_args = PyTuple_FromArray(args + 2, nargs - 2);
if (__clinic_args == NULL) {
goto exit;
}
b = args[1];
skip_optional:
__clinic_args = nargs > 2
- ? _PyTuple_FromArray(args + 2, nargs - 2)
+ ? PyTuple_FromArray(args + 2, nargs - 2)
: PyTuple_New(0);
if (__clinic_args == NULL) {
goto exit;
a = fastargs[0];
b = fastargs[1];
__clinic_args = nargs > 2
- ? _PyTuple_FromArray(args + 2, nargs - 2)
+ ? PyTuple_FromArray(args + 2, nargs - 2)
: PyTuple_New(0);
if (__clinic_args == NULL) {
goto exit;
}
a = fastargs[0];
__clinic_args = nargs > 1
- ? _PyTuple_FromArray(args + 1, nargs - 1)
+ ? PyTuple_FromArray(args + 1, nargs - 1)
: PyTuple_New(0);
if (__clinic_args == NULL) {
goto exit;
}
skip_optional_kwonly:
__clinic_args = nargs > 1
- ? _PyTuple_FromArray(args + 1, nargs - 1)
+ ? PyTuple_FromArray(args + 1, nargs - 1)
: PyTuple_New(0);
if (__clinic_args == NULL) {
goto exit;
c = fastargs[2];
skip_optional_kwonly:
__clinic_args = nargs > 1
- ? _PyTuple_FromArray(args + 1, nargs - 1)
+ ? PyTuple_FromArray(args + 1, nargs - 1)
: PyTuple_New(0);
if (__clinic_args == NULL) {
goto exit;
}
b = fastargs[0];
skip_optional_kwonly:
- __clinic_args = _PyTuple_FromArray(args, nargs);
+ __clinic_args = PyTuple_FromArray(args, nargs);
if (__clinic_args == NULL) {
goto exit;
}
}
c = fastargs[2];
skip_optional_kwonly:
- __clinic_args = _PyTuple_FromArray(args, nargs);
+ __clinic_args = PyTuple_FromArray(args, nargs);
if (__clinic_args == NULL) {
goto exit;
}
kw2 = fastargs[3];
skip_optional_kwonly:
varargs = nargs > 2
- ? _PyTuple_FromArray(args + 2, nargs - 2)
+ ? PyTuple_FromArray(args + 2, nargs - 2)
: PyTuple_New(0);
if (varargs == NULL) {
goto exit;
kw = fastargs[1];
skip_optional_kwonly:
__clinic_args = nargs > 1
- ? _PyTuple_FromArray(args + 1, nargs - 1)
+ ? PyTuple_FromArray(args + 1, nargs - 1)
: PyTuple_New(0);
if (__clinic_args == NULL) {
goto exit;
PyObject *return_value = NULL;
PyObject *__clinic_args = NULL;
- __clinic_args = _PyTuple_FromArray(args, nargs);
+ __clinic_args = PyTuple_FromArray(args, nargs);
if (__clinic_args == NULL) {
goto exit;
}
}
skip_optional_kwonly:
constraints = nargs > 1
- ? _PyTuple_FromArray(args + 1, nargs - 1)
+ ? PyTuple_FromArray(args + 1, nargs - 1)
: PyTuple_New(0);
if (constraints == NULL) {
goto exit;
if (!fastargs) {
goto exit;
}
- __clinic_args = _PyTuple_FromArray(args, nargs);
+ __clinic_args = PyTuple_FromArray(args, nargs);
if (__clinic_args == NULL) {
goto exit;
}
}
a = fastargs[0];
b = fastargs[1];
- __clinic_args = _PyTuple_FromArray(args + 2, nargs - 2);
+ __clinic_args = PyTuple_FromArray(args + 2, nargs - 2);
if (__clinic_args == NULL) {
goto exit;
}
exit:
return return_value;
}
-/*[clinic end generated code: output=0764e6f8c9d94057 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=290d2e346ea7bfa1 input=a9049054013a1b77]*/
#include "pycore_long.h" // _PyLong_UnsignedShort_Converter()
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
#include "pycore_runtime.h" // _Py_ID()
-#include "pycore_tuple.h" // _PyTuple_FromArray()
+#include "pycore_tuple.h" // _PyTuple_ITEMS()
PyDoc_STRVAR(depr_star_new__doc__,
"DeprStarNew(a=None)\n"
exit:
return return_value;
}
-/*[clinic end generated code: output=4e60af44fd6b7b94 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=2231bec0ed196830 input=a9049054013a1b77]*/
#include "pycore_long.h" // _PyLong_UnsignedShort_Converter()
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
#include "pycore_runtime.h" // _Py_ID()
-#include "pycore_tuple.h" // _PyTuple_FromArray()
+#include "pycore_tuple.h" // _PyTuple_ITEMS()
PyDoc_STRVAR(lone_kwds__doc__,
"lone_kwds($module, /, **kwds)\n"
return return_value;
}
-/*[clinic end generated code: output=e4dea1070e003f5d input=a9049054013a1b77]*/
+/*[clinic end generated code: output=3e5251b10aa44382 input=a9049054013a1b77]*/
#endif
#include "pycore_abstract.h" // _Py_convert_optional_to_ssize_t()
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
-#include "pycore_tuple.h" // _PyTuple_FromArray()
PyDoc_STRVAR(gc_enable__doc__,
"enable($module, /)\n"
PyObject *return_value = NULL;
PyObject *objs = NULL;
- objs = _PyTuple_FromArray(args, nargs);
+ objs = PyTuple_FromArray(args, nargs);
if (objs == NULL) {
goto exit;
}
PyObject *return_value = NULL;
PyObject *objs = NULL;
- objs = _PyTuple_FromArray(args, nargs);
+ objs = PyTuple_FromArray(args, nargs);
if (objs == NULL) {
goto exit;
}
exit:
return return_value;
}
-/*[clinic end generated code: output=96d057eac558e6ca input=a9049054013a1b77]*/
+/*[clinic end generated code: output=19738854607938db input=a9049054013a1b77]*/
#include "pycore_gc.h"
#include "pycore_object.h" // _PyObject_IS_GC()
#include "pycore_pystate.h" // _PyInterpreterState_GET()
-#include "pycore_tuple.h" // _PyTuple_FromArray()
typedef struct _gc_runtime_state GCState;
/* Copy the previous result tuple or re-use it if available */
if (Py_REFCNT(result) > 1) {
PyObject *old_result = result;
- result = _PyTuple_FromArray(_PyTuple_ITEMS(old_result), npools);
+ result = PyTuple_FromArray(_PyTuple_ITEMS(old_result), npools);
if (result == NULL)
goto empty;
lz->result = result;
/* Copy the previous result tuple or re-use it if available */
if (Py_REFCNT(result) > 1) {
PyObject *old_result = result;
- result = _PyTuple_FromArray(_PyTuple_ITEMS(old_result), r);
+ result = PyTuple_FromArray(_PyTuple_ITEMS(old_result), r);
if (result == NULL)
goto empty;
co->result = result;
/* Copy the previous result tuple or re-use it if available */
if (Py_REFCNT(result) > 1) {
PyObject *old_result = result;
- result = _PyTuple_FromArray(_PyTuple_ITEMS(old_result), r);
+ result = PyTuple_FromArray(_PyTuple_ITEMS(old_result), r);
if (result == NULL)
goto empty;
co->result = result;
/* Copy the previous result tuple or re-use it if available */
if (Py_REFCNT(result) > 1) {
PyObject *old_result = result;
- result = _PyTuple_FromArray(_PyTuple_ITEMS(old_result), r);
+ result = PyTuple_FromArray(_PyTuple_ITEMS(old_result), r);
if (result == NULL)
goto empty;
po->result = result;
return NULL;
}
- PyObject *argstuple = _PyTuple_FromArray(args, nargs);
+ PyObject *argstuple = PyTuple_FromArray(args, nargs);
if (argstuple == NULL) {
return NULL;
}
if (method_check_args(func, args, nargs, kwnames)) {
return NULL;
}
- PyObject *argstuple = _PyTuple_FromArray(args+1, nargs-1);
+ PyObject *argstuple = PyTuple_FromArray(args+1, nargs-1);
if (argstuple == NULL) {
return NULL;
}
if (method_check_args(func, args, nargs, NULL)) {
return NULL;
}
- PyObject *argstuple = _PyTuple_FromArray(args+1, nargs-1);
+ PyObject *argstuple = PyTuple_FromArray(args+1, nargs-1);
if (argstuple == NULL) {
return NULL;
}
#include "pycore_modsupport.h" // _PyArg_NoKeywords()
#include "pycore_object.h"
#include "pycore_pyerrors.h" // struct _PyErr_SetRaisedException
-#include "pycore_tuple.h" // _PyTuple_FromArray()
#include "osdefs.h" // SEP
#include "clinic/exceptions.c.h"
self->context = NULL;
self->suppress_context = 0;
- self->args = _PyTuple_FromArray(args, PyVectorcall_NARGS(nargsf));
+ self->args = PyTuple_FromArray(args, PyVectorcall_NARGS(nargsf));
if (!self->args) {
Py_DECREF(self);
return NULL;
#include "pycore_critical_section.h" // _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED()
#include "pycore_dict.h" // _PyDictViewObject
#include "pycore_freelist.h" // _Py_FREELIST_FREE(), _Py_FREELIST_POP()
-#include "pycore_pyatomic_ft_wrappers.h"
#include "pycore_interp.h" // PyInterpreterState.list
#include "pycore_list.h" // struct _Py_list_freelist, _PyListIterObject
#include "pycore_long.h" // _PyLong_DigitCount
#include "pycore_modsupport.h" // _PyArg_NoKwnames()
#include "pycore_object.h" // _PyObject_GC_TRACK(), _PyDebugAllocatorStats()
+#include "pycore_pyatomic_ft_wrappers.h"
+#include "pycore_setobject.h" // _PySet_NextEntry()
#include "pycore_stackref.h" // _Py_TryIncrefCompareStackRef()
-#include "pycore_tuple.h" // _PyTuple_FromArray()
+#include "pycore_tuple.h" // _PyTuple_FromArraySteal()
#include "pycore_typeobject.h" // _Py_TYPE_VERSION_LIST
-#include "pycore_setobject.h" // _PySet_NextEntry()
#include <stddef.h>
/*[clinic input]
PyObject *ret;
PyListObject *self = (PyListObject *)v;
Py_BEGIN_CRITICAL_SECTION(self);
- ret = _PyTuple_FromArray(self->ob_item, Py_SIZE(v));
+ ret = PyTuple_FromArray(self->ob_item, Py_SIZE(v));
Py_END_CRITICAL_SECTION();
return ret;
}
#include "pycore_modsupport.h" // _PyArg_NoPositional()
#include "pycore_object.h" // _PyObject_GC_TRACK()
#include "pycore_structseq.h" // PyStructSequence_InitType()
-#include "pycore_tuple.h" // _PyTuple_FromArray()
+#include "pycore_tuple.h" // _PyTuple_RESET_HASH_CACHE()
#include "pycore_typeobject.h" // _PyStaticType_FiniBuiltin()
static const char visible_length_key[] = "n_sequence_fields";
if (n_unnamed_fields < 0) {
return NULL;
}
- tup = _PyTuple_FromArray(self->ob_item, n_visible_fields);
+ tup = PyTuple_FromArray(self->ob_item, n_visible_fields);
if (!tup)
goto error;
if (ilow == 0 && ihigh == Py_SIZE(a) && PyTuple_CheckExact(a)) {
return Py_NewRef(a);
}
- return _PyTuple_FromArray(a->ob_item + ilow, ihigh - ilow);
+ return PyTuple_FromArray(a->ob_item + ilow, ihigh - ilow);
}
PyObject *
#include "pycore_pyhash.h" // _Py_HashSecret_t
#include "pycore_pylifecycle.h" // _Py_SetFileSystemEncoding()
#include "pycore_pystate.h" // _PyInterpreterState_GET()
-#include "pycore_tuple.h" // _PyTuple_FromArray()
#include "pycore_ucnhash.h" // _PyUnicode_Name_CAPI
#include "pycore_unicodeobject.h" // struct _Py_unicode_state
#include "pycore_unicodeobject_generated.h" // _PyUnicode_InitStaticStrings()
Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
if (kwnames != NULL && PyTuple_GET_SIZE(kwnames) != 0) {
// Fallback to unicode_new()
- PyObject *tuple = _PyTuple_FromArray(args, nargs);
+ PyObject *tuple = PyTuple_FromArray(args, nargs);
if (tuple == NULL) {
return NULL;
}
#include "Python.h"
#include "pycore_ast.h" // _PyAST_Validate()
#include "pycore_call.h" // _PyObject_CallNoArgs()
+#include "pycore_cell.h" // PyCell_GetRef()
#include "pycore_ceval.h" // _PyEval_Vector()
#include "pycore_compile.h" // _PyAST_Compile()
#include "pycore_fileutils.h" // _PyFile_Flush
#include "pycore_pyerrors.h" // _PyErr_NoMemory()
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "pycore_pythonrun.h" // _Py_SourceAsString()
-#include "pycore_tuple.h" // _PyTuple_FromArray()
-#include "pycore_cell.h" // PyCell_GetRef()
+#include "pycore_tuple.h" // _PyTuple_Recycle()
#include "clinic/bltinmodule.c.h"
"__build_class__: name is not a string");
return NULL;
}
- orig_bases = _PyTuple_FromArray(args + 2, nargs - 2);
+ orig_bases = PyTuple_FromArray(args + 2, nargs - 2);
if (orig_bases == NULL)
return NULL;
{
PyThreadState *tstate = _PyThreadState_GET();
PyObject *res = NULL;
- PyObject *defaults = _PyTuple_FromArray(defs, defcount);
+ PyObject *defaults = PyTuple_FromArray(defs, defcount);
if (defaults == NULL) {
return NULL;
}
# include "pycore_runtime.h" // _Py_ID()
#endif
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
-#include "pycore_tuple.h" // _PyTuple_FromArray()
PyDoc_STRVAR(sys_addaudithook__doc__,
"addaudithook($module, /, hook)\n"
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
- __clinic_args = _PyTuple_FromArray(args + 1, nargs - 1);
+ __clinic_args = PyTuple_FromArray(args + 1, nargs - 1);
if (__clinic_args == NULL) {
goto exit;
}
#ifndef SYS_GETANDROIDAPILEVEL_METHODDEF
#define SYS_GETANDROIDAPILEVEL_METHODDEF
#endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */
-/*[clinic end generated code: output=449d16326e69dcf6 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=5f7d84c5bf00d557 input=a9049054013a1b77]*/
#include "pycore_intrinsics.h" // INTRINSIC_PRINT
#include "pycore_pyerrors.h" // _PyErr_SetString()
#include "pycore_runtime.h" // _Py_ID()
-#include "pycore_tuple.h" // _PyTuple_FromArray()
#include "pycore_typevarobject.h" // _Py_make_typevar()
#include "pycore_unicodeobject.h" // _PyUnicode_FromASCII()
list_to_tuple(PyThreadState* unused, PyObject *v)
{
assert(PyList_Check(v));
- return _PyTuple_FromArray(((PyListObject *)v)->ob_item, Py_SIZE(v));
+ return PyTuple_FromArray(((PyListObject *)v)->ob_item, Py_SIZE(v));
}
static PyObject *
#include "pycore_opcode_utils.h" // MAX_REAL_OPCODE
#include "pycore_optimizer.h" // _Py_uop_analyze_and_optimize()
#include "pycore_pystate.h" // _PyInterpreterState_GET()
-#include "pycore_tuple.h" // _PyTuple_FromArraySteal
+#include "pycore_tuple.h" // _PyTuple_FromArraySteal
#include "pycore_unicodeobject.h" // _PyUnicode_FromASCII
#include "pycore_uop_ids.h"
#include "pycore_jit.h"
#include "pycore_long.h"
#include "pycore_optimizer.h"
#include "pycore_stats.h"
-#include "pycore_tuple.h" // _PyTuple_FromArray()
#include <stdbool.h>
#include <stdint.h>
"tuple item does not match value used to create tuple"
);
PyObject *pair[2] = { val_42, val_43 };
- tuple = _PyTuple_FromArray(pair, 2);
+ tuple = PyTuple_FromArray(pair, 2);
ref = _Py_uop_sym_new_const(ctx, tuple);
TEST_PREDICATE(
_Py_uop_sym_get_const(ctx, _Py_uop_sym_tuple_getitem(ctx, ref, 1)) == val_43,
}}}}
"""
else:
- self.add_include('pycore_tuple.h', '_PyTuple_FromArray()')
start = f'args + {max_pos}' if max_pos else 'args'
size = f'nargs - {max_pos}' if max_pos else 'nargs'
if min(pos_only, min_pos) < max_pos:
return f"""
{paramname} = nargs > {max_pos}
- ? _PyTuple_FromArray({start}, {size})
+ ? PyTuple_FromArray({start}, {size})
: PyTuple_New(0);
if ({paramname} == NULL) {{{{
goto exit;
"""
else:
return f"""
- {paramname} = _PyTuple_FromArray({start}, {size});
+ {paramname} = PyTuple_FromArray({start}, {size});
if ({paramname} == NULL) {{{{
goto exit;
}}}}