Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit30a20f1

Browse files
committed
fixup
1 parent80eefbf commit30a20f1

File tree

8 files changed

+51
-143
lines changed

8 files changed

+51
-143
lines changed

‎Include/abstract.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -193,15 +193,6 @@ PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *obj,
193193
constchar*name,
194194
constchar*format, ...);
195195

196-
PyAPI_FUNC(PyObject*)_PyObject_CallFunction_SizeT(PyObject*callable,
197-
constchar*format,
198-
...);
199-
200-
PyAPI_FUNC(PyObject*)_PyObject_CallMethod_SizeT(PyObject*obj,
201-
constchar*name,
202-
constchar*format,
203-
...);
204-
205196
/* Call a callable Python object 'callable' with a variable number of C
206197
arguments. The C arguments are provided as PyObject* values, terminated
207198
by a NULL.

‎Include/cpython/abstract.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
/* === Object Protocol ================================================== */
66

7-
#define_PyObject_CallMethodId _PyObject_CallMethodId_SizeT
8-
97
/* Convert keyword arguments from the FASTCALL (stack: C array, kwnames: tuple)
108
format to a Python dictionary ("kwargs" dict).
119
@@ -111,11 +109,6 @@ PyAPI_FUNC(PyObject *) _PyObject_CallMethodId(PyObject *obj,
111109
_Py_Identifier*name,
112110
constchar*format, ...);
113111

114-
PyAPI_FUNC(PyObject*)_PyObject_CallMethodId_SizeT(PyObject*obj,
115-
_Py_Identifier*name,
116-
constchar*format,
117-
...);
118-
119112
PyAPI_FUNC(PyObject*)_PyObject_CallMethodIdObjArgs(
120113
PyObject*obj,
121114
_Py_Identifier*name,

‎Include/cpython/modsupport.h

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,19 @@
22
# error "this header file must not be included directly"
33
#endif
44

5-
/* Each functions treats #-specifier to mean Py_ssize_t
6-
* regardless PY_SSIZE_T_CLEAN */
7-
#define_Py_VaBuildStack _Py_VaBuildStack_SizeT
5+
PyAPI_FUNC(PyObject**)_Py_VaBuildStack(
6+
PyObject**small_stack,
7+
Py_ssize_tsmall_stack_len,
8+
constchar*format,
9+
va_listva,
10+
Py_ssize_t*p_nargs);
11+
12+
PyAPI_FUNC(PyObject**)_Py_VaBuildStack_SizeT(
13+
PyObject**small_stack,
14+
Py_ssize_tsmall_stack_len,
15+
constchar*format,
16+
va_listva,
17+
Py_ssize_t*p_nargs);
818

919
PyAPI_FUNC(int)_PyArg_UnpackStack(
1020
PyObject*const*args,
@@ -33,13 +43,6 @@ PyAPI_FUNC(int) _PyArg_CheckPositional(const char *, Py_ssize_t,
3343
((!_Py_ANY_VARARGS(max) && (min) <= (nargs) && (nargs) <= (max)) \
3444
|| _PyArg_CheckPositional((funcname), (nargs), (min), (max)))
3545

36-
PyAPI_FUNC(PyObject**)_Py_VaBuildStack(
37-
PyObject**small_stack,
38-
Py_ssize_tsmall_stack_len,
39-
constchar*format,
40-
va_listva,
41-
Py_ssize_t*p_nargs);
42-
4346
typedefstruct_PyArg_Parser {
4447
intinitialized;
4548
constchar*format;
@@ -53,11 +56,6 @@ typedef struct _PyArg_Parser {
5356
struct_PyArg_Parser*next;
5457
}_PyArg_Parser;
5558

56-
#define_PyArg_ParseTupleAndKeywordsFast _PyArg_ParseTupleAndKeywordsFast_SizeT
57-
#define_PyArg_ParseStack _PyArg_ParseStack_SizeT
58-
#define_PyArg_ParseStackAndKeywords _PyArg_ParseStackAndKeywords_SizeT
59-
#define_PyArg_VaParseTupleAndKeywordsFast _PyArg_VaParseTupleAndKeywordsFast_SizeT
60-
6159
PyAPI_FUNC(int)_PyArg_ParseTupleAndKeywordsFast(PyObject*,PyObject*,
6260
struct_PyArg_Parser*, ...);
6361
PyAPI_FUNC(int)_PyArg_ParseStack(

‎Include/modsupport.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ PyAPI_FUNC(int) PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *,
3333
PyAPI_FUNC(int)PyArg_ValidateKeywordArguments(PyObject*);
3434
PyAPI_FUNC(int)PyArg_UnpackTuple(PyObject*,constchar*,Py_ssize_t,Py_ssize_t, ...);
3535
PyAPI_FUNC(PyObject*)Py_BuildValue(constchar*, ...);
36-
PyAPI_FUNC(PyObject*)_Py_BuildValue_SizeT(constchar*, ...);
37-
38-
3936
PyAPI_FUNC(PyObject*)Py_VaBuildValue(constchar*,va_list);
4037

4138
// Add an attribute with name 'name' and value 'obj' to the module 'mod.

‎Objects/call.c

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -572,8 +572,9 @@ _PyObject_CallFunctionVa(PyThreadState *tstate, PyObject *callable,
572572
returnresult;
573573
}
574574

575-
576-
PyObject*
575+
// Export for the stable ABI
576+
#undef PyObject_CallFunction
577+
PyAPI_FUNC(PyObject*)
577578
PyObject_CallFunction(PyObject*callable,constchar*format, ...)
578579
{
579580
va_listva;
@@ -634,7 +635,9 @@ callmethod(PyThreadState *tstate, PyObject* callable, const char *format, va_lis
634635
return_PyObject_CallFunctionVa(tstate,callable,format,va,is_size_t);
635636
}
636637

637-
PyObject*
638+
// Export for the stable ABI
639+
#undef PyObject_CallMethod
640+
PyAPI_FUNC(PyObject*)
638641
PyObject_CallMethod(PyObject*obj,constchar*name,constchar*format, ...)
639642
{
640643
PyThreadState*tstate=_PyThreadState_GET();
@@ -724,7 +727,7 @@ _PyObject_CallMethodId(PyObject *obj, _Py_Identifier *name,
724727

725728
va_listva;
726729
va_start(va,format);
727-
PyObject*retval=callmethod(tstate,callable,format,va,0);
730+
PyObject*retval=callmethod(tstate,callable,format,va,1);
728731
va_end(va);
729732

730733
Py_DECREF(callable);
@@ -767,30 +770,6 @@ _PyObject_CallMethod_SizeT(PyObject *obj, const char *name,
767770
}
768771

769772

770-
PyObject*
771-
_PyObject_CallMethodId_SizeT(PyObject*obj,_Py_Identifier*name,
772-
constchar*format, ...)
773-
{
774-
PyThreadState*tstate=_PyThreadState_GET();
775-
if (obj==NULL||name==NULL) {
776-
returnnull_error(tstate);
777-
}
778-
779-
PyObject*callable=_PyObject_GetAttrId(obj,name);
780-
if (callable==NULL) {
781-
returnNULL;
782-
}
783-
784-
va_listva;
785-
va_start(va,format);
786-
PyObject*retval=callmethod(tstate,callable,format,va,1);
787-
va_end(va);
788-
789-
Py_DECREF(callable);
790-
returnretval;
791-
}
792-
793-
794773
/* --- Call with "..." arguments ---------------------------------- */
795774

796775
staticPyObject*

‎Python/getargs.c

Lines changed: 23 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -12,40 +12,39 @@
1212
#ifdef__cplusplus
1313
extern"C" {
1414
#endif
15-
intPyArg_Parse(PyObject*,constchar*, ...);
16-
intPyArg_ParseTuple(PyObject*,constchar*, ...);
17-
intPyArg_VaParse(PyObject*,constchar*,va_list);
18-
19-
intPyArg_ParseTupleAndKeywords(PyObject*,PyObject*,
20-
constchar*,char**, ...);
21-
intPyArg_VaParseTupleAndKeywords(PyObject*,PyObject*,
22-
constchar*,char**,va_list);
23-
24-
int_PyArg_ParseTupleAndKeywordsFast(PyObject*,PyObject*,
25-
struct_PyArg_Parser*, ...);
26-
int_PyArg_VaParseTupleAndKeywordsFast(PyObject*,PyObject*,
27-
struct_PyArg_Parser*,va_list);
15+
// Remove alias to _SizeT version in modsupport.h
16+
// These functions are kept for stable ABI.
17+
#undef PyArg_Parse
18+
#undef PyArg_ParseTuple
19+
#undef PyArg_ParseTupleAndKeywords
20+
#undef PyArg_VaParse
21+
#undef PyArg_VaParseTupleAndKeywords
22+
PyAPI_FUNC(int)PyArg_Parse(PyObject*,constchar*, ...);
23+
PyAPI_FUNC(int)PyArg_ParseTuple(PyObject*,constchar*, ...);
24+
PyAPI_FUNC(int)PyArg_VaParse(PyObject*,constchar*,va_list);
25+
26+
PyAPI_FUNC(int)PyArg_ParseTupleAndKeywords(
27+
PyObject*,PyObject*,constchar*,char**, ...);
28+
PyAPI_FUNC(int)PyArg_VaParseTupleAndKeywords(
29+
PyObject*,PyObject*,constchar*,char**,va_list);
30+
31+
PyAPI_FUNC(int)_PyArg_ParseTupleAndKeywordsFast(
32+
PyObject*,PyObject*,struct_PyArg_Parser*, ...);
33+
PyAPI_FUNC(int)_PyArg_VaParseTupleAndKeywordsFast(
34+
PyObject*,PyObject*,struct_PyArg_Parser*,va_list);
2835

2936
#ifdefHAVE_DECLSPEC_DLL
3037
/* Export functions */
3138
PyAPI_FUNC(int)_PyArg_Parse_SizeT(PyObject*,constchar*, ...);
3239
PyAPI_FUNC(int)_PyArg_ParseStack_SizeT(PyObject*const*args,Py_ssize_tnargs,
3340
constchar*format, ...);
34-
PyAPI_FUNC(int)_PyArg_ParseStackAndKeywords_SizeT(PyObject*const*args,Py_ssize_tnargs,
35-
PyObject*kwnames,
36-
struct_PyArg_Parser*parser, ...);
3741
PyAPI_FUNC(int)_PyArg_ParseTuple_SizeT(PyObject*,constchar*, ...);
3842
PyAPI_FUNC(int)_PyArg_ParseTupleAndKeywords_SizeT(PyObject*,PyObject*,
3943
constchar*,char**, ...);
4044
PyAPI_FUNC(PyObject*)_Py_BuildValue_SizeT(constchar*, ...);
4145
PyAPI_FUNC(int)_PyArg_VaParse_SizeT(PyObject*,constchar*,va_list);
4246
PyAPI_FUNC(int)_PyArg_VaParseTupleAndKeywords_SizeT(PyObject*,PyObject*,
4347
constchar*,char**,va_list);
44-
45-
PyAPI_FUNC(int)_PyArg_ParseTupleAndKeywordsFast_SizeT(PyObject*,PyObject*,
46-
struct_PyArg_Parser*, ...);
47-
PyAPI_FUNC(int)_PyArg_VaParseTupleAndKeywordsFast_SizeT(PyObject*,PyObject*,
48-
struct_PyArg_Parser*,va_list);
4948
#endif
5049

5150
#defineFLAG_COMPAT 1
@@ -151,25 +150,12 @@ _PyArg_ParseStack(PyObject *const *args, Py_ssize_t nargs, const char *format, .
151150
intretval;
152151
va_listva;
153152

154-
va_start(va,format);
155-
retval=vgetargs1_impl(NULL,args,nargs,format,&va,0);
156-
va_end(va);
157-
returnretval;
158-
}
159-
160-
PyAPI_FUNC(int)
161-
_PyArg_ParseStack_SizeT(PyObject*const*args,Py_ssize_tnargs,constchar*format, ...)
162-
{
163-
intretval;
164-
va_listva;
165-
166153
va_start(va,format);
167154
retval=vgetargs1_impl(NULL,args,nargs,format,&va,FLAG_SIZE_T);
168155
va_end(va);
169156
returnretval;
170157
}
171158

172-
173159
int
174160
PyArg_VaParse(PyObject*args,constchar*format,va_listva)
175161
{
@@ -1372,7 +1358,6 @@ _PyArg_ParseTupleAndKeywords_SizeT(PyObject *args,
13721358
returnretval;
13731359
}
13741360

1375-
13761361
int
13771362
PyArg_VaParseTupleAndKeywords(PyObject*args,
13781363
PyObject*keywords,
@@ -1424,60 +1409,33 @@ _PyArg_VaParseTupleAndKeywords_SizeT(PyObject *args,
14241409
returnretval;
14251410
}
14261411

1427-
PyAPI_FUNC(int)
1412+
int
14281413
_PyArg_ParseTupleAndKeywordsFast(PyObject*args,PyObject*keywords,
14291414
struct_PyArg_Parser*parser, ...)
14301415
{
14311416
intretval;
14321417
va_listva;
14331418

1434-
va_start(va,parser);
1435-
retval=vgetargskeywordsfast(args,keywords,parser,&va,0);
1436-
va_end(va);
1437-
returnretval;
1438-
}
1439-
1440-
PyAPI_FUNC(int)
1441-
_PyArg_ParseTupleAndKeywordsFast_SizeT(PyObject*args,PyObject*keywords,
1442-
struct_PyArg_Parser*parser, ...)
1443-
{
1444-
intretval;
1445-
va_listva;
1446-
14471419
va_start(va,parser);
14481420
retval=vgetargskeywordsfast(args,keywords,parser,&va,FLAG_SIZE_T);
14491421
va_end(va);
14501422
returnretval;
14511423
}
14521424

1453-
PyAPI_FUNC(int)
1425+
int
14541426
_PyArg_ParseStackAndKeywords(PyObject*const*args,Py_ssize_tnargs,PyObject*kwnames,
14551427
struct_PyArg_Parser*parser, ...)
14561428
{
14571429
intretval;
14581430
va_listva;
14591431

1460-
va_start(va,parser);
1461-
retval=vgetargskeywordsfast_impl(args,nargs,NULL,kwnames,parser,&va,0);
1462-
va_end(va);
1463-
returnretval;
1464-
}
1465-
1466-
PyAPI_FUNC(int)
1467-
_PyArg_ParseStackAndKeywords_SizeT(PyObject*const*args,Py_ssize_tnargs,PyObject*kwnames,
1468-
struct_PyArg_Parser*parser, ...)
1469-
{
1470-
intretval;
1471-
va_listva;
1472-
14731432
va_start(va,parser);
14741433
retval=vgetargskeywordsfast_impl(args,nargs,NULL,kwnames,parser,&va,FLAG_SIZE_T);
14751434
va_end(va);
14761435
returnretval;
14771436
}
14781437

1479-
1480-
PyAPI_FUNC(int)
1438+
int
14811439
_PyArg_VaParseTupleAndKeywordsFast(PyObject*args,PyObject*keywords,
14821440
struct_PyArg_Parser*parser,va_listva)
14831441
{
@@ -1486,20 +1444,6 @@ _PyArg_VaParseTupleAndKeywordsFast(PyObject *args, PyObject *keywords,
14861444

14871445
va_copy(lva,va);
14881446

1489-
retval=vgetargskeywordsfast(args,keywords,parser,&lva,0);
1490-
va_end(lva);
1491-
returnretval;
1492-
}
1493-
1494-
PyAPI_FUNC(int)
1495-
_PyArg_VaParseTupleAndKeywordsFast_SizeT(PyObject*args,PyObject*keywords,
1496-
struct_PyArg_Parser*parser,va_listva)
1497-
{
1498-
intretval;
1499-
va_listlva;
1500-
1501-
va_copy(lva,va);
1502-
15031447
retval=vgetargskeywordsfast(args,keywords,parser,&lva,FLAG_SIZE_T);
15041448
va_end(lva);
15051449
returnretval;

‎Python/modsupport.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
#include"pycore_abstract.h"// _PyIndex_Check()
66
#include"pycore_object.h"// _PyType_IsReady()
77

8+
// Remove alias to _SizeT version in modsupport.h
9+
// These two functions are kept for stable ABI.
10+
#undef Py_BuildValue
11+
#undef Py_VaBuildValue
12+
PyAPI_FUNC(PyObject*)Py_BuildValue(constchar*, ...);
13+
PyAPI_FUNC(PyObject*)Py_VaBuildValue(constchar*,va_list);
14+
815
#defineFLAG_SIZE_T 1
916
typedefdoubleva_double;
1017

@@ -507,7 +514,6 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags)
507514
#undef ERROR_NEED_PY_SSIZE_T_CLEAN
508515
}
509516

510-
511517
PyObject*
512518
Py_BuildValue(constchar*format, ...)
513519
{

‎Python/sysmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ sys_audit_tstate(PyThreadState *ts, const char *event,
211211

212212
/* Initialize event args now */
213213
if (argFormat&&argFormat[0]) {
214-
eventArgs=_Py_VaBuildValue_SizeT(argFormat,vargs);
214+
eventArgs=Py_VaBuildValue(argFormat,vargs);
215215
if (eventArgs&& !PyTuple_Check(eventArgs)) {
216216
PyObject*argTuple=PyTuple_Pack(1,eventArgs);
217217
Py_SETREF(eventArgs,argTuple);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp