mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-132775: Revert "gh-132775: Add _PyCode_VerifyStateless() (gh-133221)" (#133497)
This commit is contained in:
parent
fd37f1a8ad
commit
3c73cf51df
8 changed files with 37 additions and 362 deletions
|
@ -1165,47 +1165,6 @@ error:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
verify_stateless_code(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
PyThreadState *tstate = _PyThreadState_GET();
|
||||
PyObject *codearg;
|
||||
PyObject *globalnames = NULL;
|
||||
PyObject *globalsns = NULL;
|
||||
PyObject *builtinsns = NULL;
|
||||
static char *kwlist[] = {"code", "globalnames",
|
||||
"globalsns", "builtinsns", NULL};
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
|
||||
"O|O!O!O!:get_code_var_counts", kwlist,
|
||||
&codearg, &PySet_Type, &globalnames,
|
||||
&PyDict_Type, &globalsns, &PyDict_Type, &builtinsns))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
if (PyFunction_Check(codearg)) {
|
||||
if (globalsns == NULL) {
|
||||
globalsns = PyFunction_GET_GLOBALS(codearg);
|
||||
}
|
||||
if (builtinsns == NULL) {
|
||||
builtinsns = PyFunction_GET_BUILTINS(codearg);
|
||||
}
|
||||
codearg = PyFunction_GET_CODE(codearg);
|
||||
}
|
||||
else if (!PyCode_Check(codearg)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"argument must be a code object or a function");
|
||||
return NULL;
|
||||
}
|
||||
PyCodeObject *code = (PyCodeObject *)codearg;
|
||||
|
||||
if (_PyCode_VerifyStateless(
|
||||
tstate, code, globalnames, globalsns, builtinsns) < 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
#ifdef _Py_TIER2
|
||||
|
||||
static PyObject *
|
||||
|
@ -2333,8 +2292,6 @@ static PyMethodDef module_functions[] = {
|
|||
{"get_co_localskinds", get_co_localskinds, METH_O, NULL},
|
||||
{"get_code_var_counts", _PyCFunction_CAST(get_code_var_counts),
|
||||
METH_VARARGS | METH_KEYWORDS, NULL},
|
||||
{"verify_stateless_code", _PyCFunction_CAST(verify_stateless_code),
|
||||
METH_VARARGS | METH_KEYWORDS, NULL},
|
||||
#ifdef _Py_TIER2
|
||||
{"add_executor_dependency", add_executor_dependency, METH_VARARGS, NULL},
|
||||
{"invalidate_executors", invalidate_executors, METH_O, NULL},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue