forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pythongh-112136: Restore removed _PyArg_Parser (python#121262)
Restore the private _PyArg_Parser structure and the private _PyArg_ParseTupleAndKeywordsFast() function, previously removed in Python 3.13 alpha 1. Recreate Include/cpython/modsupport.h header file.
- Loading branch information
Showing
8 changed files
with
40 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef Py_CPYTHON_MODSUPPORT_H | ||
# error "this header file must not be included directly" | ||
#endif | ||
|
||
// A data structure that can be used to run initialization code once in a | ||
// thread-safe manner. The C++11 equivalent is std::call_once. | ||
typedef struct { | ||
uint8_t v; | ||
} _PyOnceFlag; | ||
|
||
typedef struct _PyArg_Parser { | ||
const char *format; | ||
const char * const *keywords; | ||
const char *fname; | ||
const char *custom_msg; | ||
_PyOnceFlag once; /* atomic one-time initialization flag */ | ||
int is_kwtuple_owned; /* does this parser own the kwtuple object? */ | ||
int pos; /* number of positional-only arguments */ | ||
int min; /* minimal number of arguments */ | ||
int max; /* maximal number of positional arguments */ | ||
PyObject *kwtuple; /* tuple of keyword parameter names */ | ||
struct _PyArg_Parser *next; | ||
} _PyArg_Parser; | ||
|
||
PyAPI_FUNC(int) _PyArg_ParseTupleAndKeywordsFast(PyObject *, PyObject *, | ||
struct _PyArg_Parser *, ...); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
Misc/NEWS.d/next/C API/2024-07-02-11-03-40.gh-issue-112136.f3fiY8.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Restore the private ``_PyArg_Parser`` structure and the private | ||
``_PyArg_ParseTupleAndKeywordsFast()`` function, previously removed in Python | ||
3.13 alpha 1. Patch by Victor Stinner. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters