mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
gh-108635: Make parameters of some implementations of special methods positional-only (GH-108636)
This commit is contained in:
parent
f8be2e262c
commit
9205dfeca5
8 changed files with 36 additions and 254 deletions
37
PC/clinic/winreg.c.h
generated
37
PC/clinic/winreg.c.h
generated
|
|
@ -93,53 +93,26 @@ winreg_HKEYType___enter__(PyHKEYObject *self, PyObject *Py_UNUSED(ignored))
|
|||
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
|
||||
|
||||
PyDoc_STRVAR(winreg_HKEYType___exit____doc__,
|
||||
"__exit__($self, /, exc_type, exc_value, traceback)\n"
|
||||
"__exit__($self, exc_type, exc_value, traceback, /)\n"
|
||||
"--\n"
|
||||
"\n");
|
||||
|
||||
#define WINREG_HKEYTYPE___EXIT___METHODDEF \
|
||||
{"__exit__", _PyCFunction_CAST(winreg_HKEYType___exit__), METH_FASTCALL|METH_KEYWORDS, winreg_HKEYType___exit____doc__},
|
||||
{"__exit__", _PyCFunction_CAST(winreg_HKEYType___exit__), METH_FASTCALL, winreg_HKEYType___exit____doc__},
|
||||
|
||||
static PyObject *
|
||||
winreg_HKEYType___exit___impl(PyHKEYObject *self, PyObject *exc_type,
|
||||
PyObject *exc_value, PyObject *traceback);
|
||||
|
||||
static PyObject *
|
||||
winreg_HKEYType___exit__(PyHKEYObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
winreg_HKEYType___exit__(PyHKEYObject *self, PyObject *const *args, Py_ssize_t nargs)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
||||
|
||||
#define NUM_KEYWORDS 3
|
||||
static struct {
|
||||
PyGC_Head _this_is_not_used;
|
||||
PyObject_VAR_HEAD
|
||||
PyObject *ob_item[NUM_KEYWORDS];
|
||||
} _kwtuple = {
|
||||
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
|
||||
.ob_item = { &_Py_ID(exc_type), &_Py_ID(exc_value), &_Py_ID(traceback), },
|
||||
};
|
||||
#undef NUM_KEYWORDS
|
||||
#define KWTUPLE (&_kwtuple.ob_base.ob_base)
|
||||
|
||||
#else // !Py_BUILD_CORE
|
||||
# define KWTUPLE NULL
|
||||
#endif // !Py_BUILD_CORE
|
||||
|
||||
static const char * const _keywords[] = {"exc_type", "exc_value", "traceback", NULL};
|
||||
static _PyArg_Parser _parser = {
|
||||
.keywords = _keywords,
|
||||
.fname = "__exit__",
|
||||
.kwtuple = KWTUPLE,
|
||||
};
|
||||
#undef KWTUPLE
|
||||
PyObject *argsbuf[3];
|
||||
PyObject *exc_type;
|
||||
PyObject *exc_value;
|
||||
PyObject *traceback;
|
||||
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 3, 0, argsbuf);
|
||||
if (!args) {
|
||||
if (!_PyArg_CheckPositional("__exit__", nargs, 3, 3)) {
|
||||
goto exit;
|
||||
}
|
||||
exc_type = args[0];
|
||||
|
|
@ -1789,4 +1762,4 @@ exit:
|
|||
#ifndef WINREG_QUERYREFLECTIONKEY_METHODDEF
|
||||
#define WINREG_QUERYREFLECTIONKEY_METHODDEF
|
||||
#endif /* !defined(WINREG_QUERYREFLECTIONKEY_METHODDEF) */
|
||||
/*[clinic end generated code: output=00343ee8da923da8 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=2431b1b06b148722 input=a9049054013a1b77]*/
|
||||
|
|
|
|||
|
|
@ -324,12 +324,14 @@ winreg.HKEYType.__exit__
|
|||
exc_type: object
|
||||
exc_value: object
|
||||
traceback: object
|
||||
/
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
winreg_HKEYType___exit___impl(PyHKEYObject *self, PyObject *exc_type,
|
||||
PyObject *exc_value, PyObject *traceback)
|
||||
/*[clinic end generated code: output=923ebe7389e6a263 input=fb32489ee92403c7]*/
|
||||
/*[clinic end generated code: output=923ebe7389e6a263 input=1eac83cd06962689]*/
|
||||
{
|
||||
winreg_state *st = _PyType_GetModuleState(Py_TYPE(self));
|
||||
assert(st != NULL);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue