Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitbcc081b

Browse files
Drop _testinternalcapi.code_set_co_extra().
This reverts commitb943bb0.
1 parentb943bb0 commitbcc081b

File tree

2 files changed

+0
-66
lines changed

2 files changed

+0
-66
lines changed

‎Lib/test/test_code.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,18 +1088,6 @@ def test_stateless(self):
10881088
withself.assertRaises(Exception):
10891089
_testinternalcapi.verify_stateless_code(func)
10901090

1091-
defspam():
1092-
pass
1093-
1094-
withself.subTest('with co_extra'):
1095-
_testinternalcapi.verify_stateless_code(spam)
1096-
extra='spam'
1097-
_testinternalcapi.code_set_co_extra(spam.__code__,0,extra)
1098-
withself.assertRaises(ValueError):
1099-
_testinternalcapi.verify_stateless_code(spam)
1100-
_testinternalcapi.code_set_co_extra(spam.__code__,0,expect=extra)
1101-
_testinternalcapi.verify_stateless_code(spam)
1102-
11031091

11041092
defisinterned(s):
11051093
returnsissys.intern(('_'+s+'_')[1:-1])

‎Modules/_testinternalcapi.c

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,58 +1206,6 @@ verify_stateless_code(PyObject *self, PyObject *args, PyObject *kwargs)
12061206
Py_RETURN_NONE;
12071207
}
12081208

1209-
staticPyObject*
1210-
code_set_co_extra(PyObject*self,PyObject*args,PyObject*kwargs)
1211-
{
1212-
PyObject*codearg;
1213-
Py_ssize_tindex;
1214-
PyObject*value=NULL;
1215-
PyObject*expected=NULL;
1216-
PyObject*notset=Py_None;
1217-
staticchar*kwlist[]=
1218-
{"code","index","value","expect","notset",NULL};
1219-
if (!PyArg_ParseTupleAndKeywords(args,kwargs,
1220-
"O!n|OOO:code_set_co_extra",kwlist,
1221-
&PyCode_Type,&codearg,&index,&value,&expected,&notset))
1222-
{
1223-
returnNULL;
1224-
}
1225-
1226-
void*extra;
1227-
if (PyUnstable_Code_GetExtra(codearg,index,&extra)<0) {
1228-
returnNULL;
1229-
}
1230-
1231-
PyObject*old;
1232-
if (extra==NULL) {
1233-
old=Py_NewRef(notset);
1234-
}
1235-
elseif (extra==expected) {
1236-
old=Py_NewRef(expected);
1237-
}
1238-
elseif (extra==value) {
1239-
old=Py_NewRef(value);
1240-
}
1241-
else {
1242-
if (expected==NULL) {
1243-
PyErr_SetString(PyExc_ValueError,
1244-
"expected existing co_extra to be NULL");
1245-
}
1246-
else {
1247-
PyErr_Format(PyExc_ValueError,
1248-
"expected existing co_extra to be %R",expected);
1249-
}
1250-
returnNULL;
1251-
}
1252-
1253-
if (PyUnstable_Code_SetExtra(codearg,index,value)<0) {
1254-
Py_DECREF(old);
1255-
returnNULL;
1256-
}
1257-
1258-
returnold;
1259-
}
1260-
12611209
#ifdef_Py_TIER2
12621210

12631211
staticPyObject*
@@ -2387,8 +2335,6 @@ static PyMethodDef module_functions[] = {
23872335
METH_VARARGS |METH_KEYWORDS,NULL},
23882336
{"verify_stateless_code",_PyCFunction_CAST(verify_stateless_code),
23892337
METH_VARARGS |METH_KEYWORDS,NULL},
2390-
{"code_set_co_extra",_PyCFunction_CAST(code_set_co_extra),
2391-
METH_VARARGS |METH_KEYWORDS,NULL},
23922338
#ifdef_Py_TIER2
23932339
{"add_executor_dependency",add_executor_dependency,METH_VARARGS,NULL},
23942340
{"invalidate_executors",invalidate_executors,METH_O,NULL},

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp