Skip to content

Commit 166cdaa

Browse files
authored
gh-111489: Remove _PyTuple_FromArray() alias (#139973)
Replace _PyTuple_FromArray() with PyTuple_FromArray(). Remove pycore_tuple.h includes.
1 parent 447c7a8 commit 166cdaa

23 files changed

+62
-73
lines changed

Include/internal/pycore_tuple.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ extern PyStatus _PyTuple_InitGlobalObjects(PyInterpreterState *);
2323

2424
#define _PyTuple_ITEMS(op) _Py_RVALUE(_PyTuple_CAST(op)->ob_item)
2525

26-
// Alias for backward compatibility
27-
#define _PyTuple_FromArray PyTuple_FromArray
28-
2926
PyAPI_FUNC(PyObject *)_PyTuple_FromStackRefStealOnSuccess(const union _PyStackRef *, Py_ssize_t);
3027
PyAPI_FUNC(PyObject *)_PyTuple_FromArraySteal(PyObject *const *, Py_ssize_t);
3128

Lib/test/clinic.test.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4341,7 +4341,7 @@ test_vararg_and_posonly(PyObject *module, PyObject *const *args, Py_ssize_t narg
43414341
goto exit;
43424342
}
43434343
a = args[0];
4344-
__clinic_args = _PyTuple_FromArray(args + 1, nargs - 1);
4344+
__clinic_args = PyTuple_FromArray(args + 1, nargs - 1);
43454345
if (__clinic_args == NULL) {
43464346
goto exit;
43474347
}
@@ -4356,7 +4356,7 @@ test_vararg_and_posonly(PyObject *module, PyObject *const *args, Py_ssize_t narg
43564356

43574357
static PyObject *
43584358
test_vararg_and_posonly_impl(PyObject *module, PyObject *a, PyObject *args)
4359-
/*[clinic end generated code: output=0c11c475e240869e input=2c49a482f68545c0]*/
4359+
/*[clinic end generated code: output=83cbe9554d04add2 input=2c49a482f68545c0]*/
43604360

43614361
/*[clinic input]
43624362
test_vararg
@@ -4421,7 +4421,7 @@ test_vararg(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
44214421
}
44224422
a = fastargs[0];
44234423
__clinic_args = nargs > 1
4424-
? _PyTuple_FromArray(args + 1, nargs - 1)
4424+
? PyTuple_FromArray(args + 1, nargs - 1)
44254425
: PyTuple_New(0);
44264426
if (__clinic_args == NULL) {
44274427
goto exit;
@@ -4437,7 +4437,7 @@ test_vararg(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
44374437

44384438
static PyObject *
44394439
test_vararg_impl(PyObject *module, PyObject *a, PyObject *args)
4440-
/*[clinic end generated code: output=17ba625cdd0369c1 input=7448995636d9186a]*/
4440+
/*[clinic end generated code: output=d773f7b54e61f73a input=7448995636d9186a]*/
44414441

44424442
/*[clinic input]
44434443
test_vararg_with_default
@@ -4514,7 +4514,7 @@ test_vararg_with_default(PyObject *module, PyObject *const *args, Py_ssize_t nar
45144514
}
45154515
skip_optional_kwonly:
45164516
__clinic_args = nargs > 1
4517-
? _PyTuple_FromArray(args + 1, nargs - 1)
4517+
? PyTuple_FromArray(args + 1, nargs - 1)
45184518
: PyTuple_New(0);
45194519
if (__clinic_args == NULL) {
45204520
goto exit;
@@ -4531,7 +4531,7 @@ test_vararg_with_default(PyObject *module, PyObject *const *args, Py_ssize_t nar
45314531
static PyObject *
45324532
test_vararg_with_default_impl(PyObject *module, PyObject *a, PyObject *args,
45334533
int b)
4534-
/*[clinic end generated code: output=3f2b06ab08d5d0be input=3a0f9f557ce1f712]*/
4534+
/*[clinic end generated code: output=d25e56802c197344 input=3a0f9f557ce1f712]*/
45354535

45364536
/*[clinic input]
45374537
test_vararg_with_only_defaults
@@ -4612,7 +4612,7 @@ test_vararg_with_only_defaults(PyObject *module, PyObject *const *args, Py_ssize
46124612
}
46134613
c = fastargs[1];
46144614
skip_optional_kwonly:
4615-
__clinic_args = _PyTuple_FromArray(args, nargs);
4615+
__clinic_args = PyTuple_FromArray(args, nargs);
46164616
if (__clinic_args == NULL) {
46174617
goto exit;
46184618
}
@@ -4628,7 +4628,7 @@ test_vararg_with_only_defaults(PyObject *module, PyObject *const *args, Py_ssize
46284628
static PyObject *
46294629
test_vararg_with_only_defaults_impl(PyObject *module, PyObject *args, int b,
46304630
PyObject *c)
4631-
/*[clinic end generated code: output=f46666f0b1bf86b9 input=6983e66817f82924]*/
4631+
/*[clinic end generated code: output=7366943a7df42e05 input=6983e66817f82924]*/
46324632

46334633
/*[clinic input]
46344634
test_paramname_module

Modules/_testclinic.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pack_arguments_2pos_varpos(PyObject *a, PyObject *b,
6363
PyObject * const *args, Py_ssize_t args_length)
6464
/*[clinic end generated code: output=267032f41bd039cc input=86ee3064b7853e86]*/
6565
{
66-
PyObject *tuple = _PyTuple_FromArray(args, args_length);
66+
PyObject *tuple = PyTuple_FromArray(args, args_length);
6767
if (tuple == NULL) {
6868
return NULL;
6969
}
@@ -1174,7 +1174,7 @@ varpos_array_impl(PyObject *module, PyObject * const *args,
11741174
Py_ssize_t args_length)
11751175
/*[clinic end generated code: output=a25f42f39c9b13ad input=97b8bdcf87e019c7]*/
11761176
{
1177-
return _PyTuple_FromArray(args, args_length);
1177+
return PyTuple_FromArray(args, args_length);
11781178
}
11791179

11801180

@@ -1610,7 +1610,7 @@ _testclinic_TestClass_varpos_array_no_fastcall_impl(PyTypeObject *type,
16101610
Py_ssize_t args_length)
16111611
/*[clinic end generated code: output=27c9da663e942617 input=9ba5ae1f1eb58777]*/
16121612
{
1613-
return _PyTuple_FromArray(args, args_length);
1613+
return PyTuple_FromArray(args, args_length);
16141614
}
16151615

16161616

Modules/clinic/_testclinic.c.h

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/clinic/_testclinic_depr.c.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/clinic/_testclinic_kwds.c.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/clinic/gcmodule.c.h

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/gcmodule.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include "pycore_gc.h"
99
#include "pycore_object.h" // _PyObject_IS_GC()
1010
#include "pycore_pystate.h" // _PyInterpreterState_GET()
11-
#include "pycore_tuple.h" // _PyTuple_FromArray()
1211

1312
typedef struct _gc_runtime_state GCState;
1413

Modules/itertoolsmodule.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2131,7 +2131,7 @@ product_next_lock_held(PyObject *op)
21312131
/* Copy the previous result tuple or re-use it if available */
21322132
if (Py_REFCNT(result) > 1) {
21332133
PyObject *old_result = result;
2134-
result = _PyTuple_FromArray(_PyTuple_ITEMS(old_result), npools);
2134+
result = PyTuple_FromArray(_PyTuple_ITEMS(old_result), npools);
21352135
if (result == NULL)
21362136
goto empty;
21372137
lz->result = result;
@@ -2366,7 +2366,7 @@ combinations_next_lock_held(PyObject *op)
23662366
/* Copy the previous result tuple or re-use it if available */
23672367
if (Py_REFCNT(result) > 1) {
23682368
PyObject *old_result = result;
2369-
result = _PyTuple_FromArray(_PyTuple_ITEMS(old_result), r);
2369+
result = PyTuple_FromArray(_PyTuple_ITEMS(old_result), r);
23702370
if (result == NULL)
23712371
goto empty;
23722372
co->result = result;
@@ -2620,7 +2620,7 @@ cwr_next(PyObject *op)
26202620
/* Copy the previous result tuple or re-use it if available */
26212621
if (Py_REFCNT(result) > 1) {
26222622
PyObject *old_result = result;
2623-
result = _PyTuple_FromArray(_PyTuple_ITEMS(old_result), r);
2623+
result = PyTuple_FromArray(_PyTuple_ITEMS(old_result), r);
26242624
if (result == NULL)
26252625
goto empty;
26262626
co->result = result;
@@ -2881,7 +2881,7 @@ permutations_next(PyObject *op)
28812881
/* Copy the previous result tuple or re-use it if available */
28822882
if (Py_REFCNT(result) > 1) {
28832883
PyObject *old_result = result;
2884-
result = _PyTuple_FromArray(_PyTuple_ITEMS(old_result), r);
2884+
result = PyTuple_FromArray(_PyTuple_ITEMS(old_result), r);
28852885
if (result == NULL)
28862886
goto empty;
28872887
po->result = result;

Objects/call.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ _PyObject_MakeTpCall(PyThreadState *tstate, PyObject *callable,
213213
return NULL;
214214
}
215215

216-
PyObject *argstuple = _PyTuple_FromArray(args, nargs);
216+
PyObject *argstuple = PyTuple_FromArray(args, nargs);
217217
if (argstuple == NULL) {
218218
return NULL;
219219
}

0 commit comments

Comments
 (0)