mirror of
https://github.com/python/cpython.git
synced 2025-12-11 03:20:01 +00:00
GH-137630: Argument Clinic: Reduce use of 'as' for renaming in `_interpretersmodule.c` (#137680)
Some checks are pending
Tests / (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / Ubuntu SSL tests with AWS-LC (push) Blocked by required conditions
Tests / Android (aarch64) (push) Blocked by required conditions
Tests / Android (x86_64) (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Sanitizers (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Lint / lint (push) Waiting to run
Tests / All required checks pass (push) Blocked by required conditions
mypy / Run mypy on Lib/test/libregrtest (push) Waiting to run
mypy / Run mypy on Lib/tomllib (push) Waiting to run
mypy / Run mypy on Tools/build (push) Waiting to run
mypy / Run mypy on Tools/cases_generator (push) Waiting to run
mypy / Run mypy on Tools/clinic (push) Waiting to run
mypy / Run mypy on Tools/jit (push) Waiting to run
mypy / Run mypy on Tools/peg_generator (push) Waiting to run
mypy / Run mypy on Lib/_pyrepl (push) Waiting to run
Some checks are pending
Tests / (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / Ubuntu SSL tests with AWS-LC (push) Blocked by required conditions
Tests / Android (aarch64) (push) Blocked by required conditions
Tests / Android (x86_64) (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Sanitizers (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Lint / lint (push) Waiting to run
Tests / All required checks pass (push) Blocked by required conditions
mypy / Run mypy on Lib/test/libregrtest (push) Waiting to run
mypy / Run mypy on Lib/tomllib (push) Waiting to run
mypy / Run mypy on Tools/build (push) Waiting to run
mypy / Run mypy on Tools/cases_generator (push) Waiting to run
mypy / Run mypy on Tools/clinic (push) Waiting to run
mypy / Run mypy on Tools/jit (push) Waiting to run
mypy / Run mypy on Tools/peg_generator (push) Waiting to run
mypy / Run mypy on Lib/_pyrepl (push) Waiting to run
This commit is contained in:
parent
e93dca7223
commit
797c2c33e1
2 changed files with 24 additions and 26 deletions
|
|
@ -1276,8 +1276,8 @@ _interpreters_run_func_impl(PyObject *module, PyObject *id, PyObject *func,
|
||||||
_interpreters.call
|
_interpreters.call
|
||||||
id: object
|
id: object
|
||||||
callable: object
|
callable: object
|
||||||
args as args_obj: object(subclass_of='&PyTuple_Type', c_default='NULL') = ()
|
args: object(subclass_of='&PyTuple_Type', c_default='NULL') = ()
|
||||||
kwargs as kwargs_obj: object(subclass_of='&PyDict_Type', c_default='NULL') = {}
|
kwargs: object(subclass_of='&PyDict_Type', c_default='NULL') = {}
|
||||||
*
|
*
|
||||||
preserve_exc: bool = False
|
preserve_exc: bool = False
|
||||||
restrict as restricted: bool = False
|
restrict as restricted: bool = False
|
||||||
|
|
@ -1289,9 +1289,9 @@ Pass the given args and kwargs, if possible.
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_interpreters_call_impl(PyObject *module, PyObject *id, PyObject *callable,
|
_interpreters_call_impl(PyObject *module, PyObject *id, PyObject *callable,
|
||||||
PyObject *args_obj, PyObject *kwargs_obj,
|
PyObject *args, PyObject *kwargs, int preserve_exc,
|
||||||
int preserve_exc, int restricted)
|
int restricted)
|
||||||
/*[clinic end generated code: output=983ee27b3c43f6ef input=77590fdb3f519d65]*/
|
/*[clinic end generated code: output=b7a4a27d72df3ebc input=b026d0b212a575e6]*/
|
||||||
{
|
{
|
||||||
PyThreadState *tstate = _PyThreadState_GET();
|
PyThreadState *tstate = _PyThreadState_GET();
|
||||||
int reqready = 1;
|
int reqready = 1;
|
||||||
|
|
@ -1302,7 +1302,7 @@ _interpreters_call_impl(PyObject *module, PyObject *id, PyObject *callable,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct interp_call call = {0};
|
struct interp_call call = {0};
|
||||||
if (_interp_call_pack(tstate, &call, callable, args_obj, kwargs_obj) < 0) {
|
if (_interp_call_pack(tstate, &call, callable, args, kwargs) < 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1376,7 +1376,7 @@ _interpreters_is_running_impl(PyObject *module, PyObject *id, int restricted)
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
_interpreters.get_config
|
_interpreters.get_config
|
||||||
id as idobj: object
|
id: object
|
||||||
*
|
*
|
||||||
restrict as restricted: bool = False
|
restrict as restricted: bool = False
|
||||||
|
|
||||||
|
|
@ -1384,17 +1384,16 @@ Return a representation of the config used to initialize the interpreter.
|
||||||
[clinic start generated code]*/
|
[clinic start generated code]*/
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_interpreters_get_config_impl(PyObject *module, PyObject *idobj,
|
_interpreters_get_config_impl(PyObject *module, PyObject *id, int restricted)
|
||||||
int restricted)
|
/*[clinic end generated code: output=56773353b9b7224a input=59519a01c22d96d1]*/
|
||||||
/*[clinic end generated code: output=63f81d35c2fe1387 input=aa38d50f534eb3c5]*/
|
|
||||||
{
|
{
|
||||||
if (idobj == Py_None) {
|
if (id == Py_None) {
|
||||||
idobj = NULL;
|
id = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int reqready = 0;
|
int reqready = 0;
|
||||||
PyInterpreterState *interp = \
|
PyInterpreterState *interp = \
|
||||||
resolve_interp(idobj, restricted, reqready, "get the config of");
|
resolve_interp(id, restricted, reqready, "get the config of");
|
||||||
if (interp == NULL) {
|
if (interp == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
25
Modules/clinic/_interpretersmodule.c.h
generated
25
Modules/clinic/_interpretersmodule.c.h
generated
|
|
@ -639,8 +639,8 @@ PyDoc_STRVAR(_interpreters_call__doc__,
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_interpreters_call_impl(PyObject *module, PyObject *id, PyObject *callable,
|
_interpreters_call_impl(PyObject *module, PyObject *id, PyObject *callable,
|
||||||
PyObject *args_obj, PyObject *kwargs_obj,
|
PyObject *args, PyObject *kwargs, int preserve_exc,
|
||||||
int preserve_exc, int restricted);
|
int restricted);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_interpreters_call(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
|
_interpreters_call(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
|
|
@ -677,8 +677,8 @@ _interpreters_call(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py
|
||||||
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
|
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
|
||||||
PyObject *id;
|
PyObject *id;
|
||||||
PyObject *callable;
|
PyObject *callable;
|
||||||
PyObject *args_obj = NULL;
|
PyObject *__clinic_args = NULL;
|
||||||
PyObject *kwargs_obj = NULL;
|
PyObject *__clinic_kwargs = NULL;
|
||||||
int preserve_exc = 0;
|
int preserve_exc = 0;
|
||||||
int restricted = 0;
|
int restricted = 0;
|
||||||
|
|
||||||
|
|
@ -697,7 +697,7 @@ _interpreters_call(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py
|
||||||
_PyArg_BadArgument("call", "argument 'args'", "tuple", args[2]);
|
_PyArg_BadArgument("call", "argument 'args'", "tuple", args[2]);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
args_obj = args[2];
|
__clinic_args = args[2];
|
||||||
if (!--noptargs) {
|
if (!--noptargs) {
|
||||||
goto skip_optional_pos;
|
goto skip_optional_pos;
|
||||||
}
|
}
|
||||||
|
|
@ -707,7 +707,7 @@ _interpreters_call(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py
|
||||||
_PyArg_BadArgument("call", "argument 'kwargs'", "dict", args[3]);
|
_PyArg_BadArgument("call", "argument 'kwargs'", "dict", args[3]);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
kwargs_obj = args[3];
|
__clinic_kwargs = args[3];
|
||||||
if (!--noptargs) {
|
if (!--noptargs) {
|
||||||
goto skip_optional_pos;
|
goto skip_optional_pos;
|
||||||
}
|
}
|
||||||
|
|
@ -730,7 +730,7 @@ skip_optional_pos:
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
skip_optional_kwonly:
|
skip_optional_kwonly:
|
||||||
return_value = _interpreters_call_impl(module, id, callable, args_obj, kwargs_obj, preserve_exc, restricted);
|
return_value = _interpreters_call_impl(module, id, callable, __clinic_args, __clinic_kwargs, preserve_exc, restricted);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
|
|
@ -872,8 +872,7 @@ PyDoc_STRVAR(_interpreters_get_config__doc__,
|
||||||
{"get_config", _PyCFunction_CAST(_interpreters_get_config), METH_FASTCALL|METH_KEYWORDS, _interpreters_get_config__doc__},
|
{"get_config", _PyCFunction_CAST(_interpreters_get_config), METH_FASTCALL|METH_KEYWORDS, _interpreters_get_config__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_interpreters_get_config_impl(PyObject *module, PyObject *idobj,
|
_interpreters_get_config_impl(PyObject *module, PyObject *id, int restricted);
|
||||||
int restricted);
|
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_interpreters_get_config(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
|
_interpreters_get_config(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
|
|
@ -908,7 +907,7 @@ _interpreters_get_config(PyObject *module, PyObject *const *args, Py_ssize_t nar
|
||||||
#undef KWTUPLE
|
#undef KWTUPLE
|
||||||
PyObject *argsbuf[2];
|
PyObject *argsbuf[2];
|
||||||
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
|
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
|
||||||
PyObject *idobj;
|
PyObject *id;
|
||||||
int restricted = 0;
|
int restricted = 0;
|
||||||
|
|
||||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser,
|
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser,
|
||||||
|
|
@ -916,7 +915,7 @@ _interpreters_get_config(PyObject *module, PyObject *const *args, Py_ssize_t nar
|
||||||
if (!args) {
|
if (!args) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
idobj = args[0];
|
id = args[0];
|
||||||
if (!noptargs) {
|
if (!noptargs) {
|
||||||
goto skip_optional_kwonly;
|
goto skip_optional_kwonly;
|
||||||
}
|
}
|
||||||
|
|
@ -925,7 +924,7 @@ _interpreters_get_config(PyObject *module, PyObject *const *args, Py_ssize_t nar
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
skip_optional_kwonly:
|
skip_optional_kwonly:
|
||||||
return_value = _interpreters_get_config_impl(module, idobj, restricted);
|
return_value = _interpreters_get_config_impl(module, id, restricted);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
|
|
@ -1199,4 +1198,4 @@ skip_optional_pos:
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=cf3f54caaa2dd6a2 input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=c80f73761f860f6c input=a9049054013a1b77]*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue