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

Appearance settings

Commit fb17fb2

Browse filesBrowse files
committed
gh-112136: Restore removed _PyArg_Parser
Restore removed private _PyArg_Parser structure and private _PyArg_ParseTupleAndKeywordsFast() function. Recreate Include/cpython/modsupport.h header file.
1 parent 6343486 commit fb17fb2
Copy full SHA for fb17fb2

File tree

Expand file treeCollapse file tree

8 files changed

+39
-24
lines changed
Filter options
Expand file treeCollapse file tree

8 files changed

+39
-24
lines changed

‎Include/cpython/modsupport.h

Copy file name to clipboard
+26Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#ifndef Py_CPYTHON_MODSUPPORT_H
2+
# error "this header file must not be included directly"
3+
#endif
4+
5+
// A data structure that can be used to run initialization code once in a
6+
// thread-safe manner. The C++11 equivalent is std::call_once.
7+
typedef struct {
8+
uint8_t v;
9+
} _PyOnceFlag;
10+
11+
typedef struct _PyArg_Parser {
12+
const char *format;
13+
const char * const *keywords;
14+
const char *fname;
15+
const char *custom_msg;
16+
_PyOnceFlag once; /* atomic one-time initialization flag */
17+
int is_kwtuple_owned; /* does this parser own the kwtuple object? */
18+
int pos; /* number of positional-only arguments */
19+
int min; /* minimal number of arguments */
20+
int max; /* maximal number of positional arguments */
21+
PyObject *kwtuple; /* tuple of keyword parameter names */
22+
struct _PyArg_Parser *next;
23+
} _PyArg_Parser;
24+
25+
PyAPI_FUNC(int) _PyArg_ParseTupleAndKeywordsFast(PyObject *, PyObject *,
26+
struct _PyArg_Parser *, ...);

‎Include/internal/pycore_lock.h

Copy file name to clipboardExpand all lines: Include/internal/pycore_lock.h
-6Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,6 @@ _PyRawMutex_Unlock(_PyRawMutex *m)
128128
_PyRawMutex_UnlockSlow(m);
129129
}
130130

131-
// A data structure that can be used to run initialization code once in a
132-
// thread-safe manner. The C++11 equivalent is std::call_once.
133-
typedef struct {
134-
uint8_t v;
135-
} _PyOnceFlag;
136-
137131
// Type signature for one-time initialization functions. The function should
138132
// return 0 on success and -1 on failure.
139133
typedef int _Py_once_fn_t(void *arg);

‎Include/internal/pycore_modsupport.h

Copy file name to clipboardExpand all lines: Include/internal/pycore_modsupport.h
-18Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,24 +67,6 @@ PyAPI_FUNC(void) _PyArg_BadArgument(
6767

6868
// --- _PyArg_Parser API ---------------------------------------------------
6969

70-
typedef struct _PyArg_Parser {
71-
const char *format;
72-
const char * const *keywords;
73-
const char *fname;
74-
const char *custom_msg;
75-
_PyOnceFlag once; /* atomic one-time initialization flag */
76-
int is_kwtuple_owned; /* does this parser own the kwtuple object? */
77-
int pos; /* number of positional-only arguments */
78-
int min; /* minimal number of arguments */
79-
int max; /* maximal number of positional arguments */
80-
PyObject *kwtuple; /* tuple of keyword parameter names */
81-
struct _PyArg_Parser *next;
82-
} _PyArg_Parser;
83-
84-
// Export for '_testclinic' shared extension
85-
PyAPI_FUNC(int) _PyArg_ParseTupleAndKeywordsFast(PyObject *, PyObject *,
86-
struct _PyArg_Parser *, ...);
87-
8870
// Export for '_dbm' shared extension
8971
PyAPI_FUNC(int) _PyArg_ParseStackAndKeywords(
9072
PyObject *const *args,

‎Include/modsupport.h

Copy file name to clipboardExpand all lines: Include/modsupport.h
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ PyAPI_FUNC(PyObject *) PyModule_FromDefAndSpec2(PyModuleDef *def,
134134

135135
#endif /* New in 3.5 */
136136

137+
#ifndef Py_LIMITED_API
138+
# define Py_CPYTHON_MODSUPPORT_H
139+
# include "cpython/modsupport.h"
140+
# undef Py_CPYTHON_MODSUPPORT_H
141+
#endif
142+
137143
#ifdef __cplusplus
138144
}
139145
#endif

‎Makefile.pre.in

Copy file name to clipboardExpand all lines: Makefile.pre.in
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,6 +1115,7 @@ PYTHON_HEADERS= \
11151115
$(srcdir)/Include/cpython/longobject.h \
11161116
$(srcdir)/Include/cpython/memoryobject.h \
11171117
$(srcdir)/Include/cpython/methodobject.h \
1118+
$(srcdir)/Include/cpython/modsupport.h \
11181119
$(srcdir)/Include/cpython/monitoring.h \
11191120
$(srcdir)/Include/cpython/object.h \
11201121
$(srcdir)/Include/cpython/objimpl.h \
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Restore removed private ``_PyArg_Parser`` structure and private
2+
``_PyArg_ParseTupleAndKeywordsFast()`` function. Patch by Victor Stinner.

‎PCbuild/pythoncore.vcxproj

Copy file name to clipboardExpand all lines: PCbuild/pythoncore.vcxproj
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@
163163
<ClInclude Include="..\Include\cpython\longobject.h" />
164164
<ClInclude Include="..\Include\cpython\memoryobject.h" />
165165
<ClInclude Include="..\Include\cpython\methodobject.h" />
166+
<ClInclude Include="..\Include\cpython\modsupport.h" />
166167
<ClInclude Include="..\Include\cpython\object.h" />
167168
<ClInclude Include="..\Include\cpython\objimpl.h" />
168169
<ClInclude Include="..\Include\cpython\odictobject.h" />

‎PCbuild/pythoncore.vcxproj.filters

Copy file name to clipboardExpand all lines: PCbuild/pythoncore.vcxproj.filters
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,9 @@
432432
<ClInclude Include="..\Include\cpython\methodobject.h">
433433
<Filter>Include\cpython</Filter>
434434
</ClInclude>
435+
<ClInclude Include="..\Include\cpython\modsupport.h">
436+
<Filter>Include\cpython</Filter>
437+
</ClInclude>
435438
<ClInclude Include="..\Include\cpython\objimpl.h">
436439
<Filter>Include\cpython</Filter>
437440
</ClInclude>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.