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

gh-132775: Use _PyFunction_VerifyStateless() and _PyCode_VerifyStateless()#134439

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
Fix the tests.
  • Loading branch information
@ericsnowcurrently
ericsnowcurrently committedMay 21, 2025
commit51afd9b973df09e017d3f34a0227b73182bbce9b
3 changes: 2 additions & 1 deletionLib/test/test__interpreters.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1054,7 +1054,7 @@ def test_closure(self):
def script():
assert spam

with self.assertRaises(ValueError):
with self.assertRaises(TypeError):
_interpreters.run_func(self.id, script)

# XXX This hasn't been fixed yet.
Expand All@@ -1065,6 +1065,7 @@ def script():
with self.assertRaises(ValueError):
_interpreters.run_func(self.id, script)

@unittest.skip("we're not quite there yet")
def test_args(self):
with self.subTest('args'):
def script(a, b=0):
Expand Down
9 changes: 6 additions & 3 deletionsModules/_interpretersmodule.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -972,11 +972,14 @@ convert_code_arg(PyThreadState *tstate,
PyObject *cause;
PyCodeObject *code = NULL;
if (PyFunction_Check(arg)) {
if (_PyFunction_VerifyStateless(tstate, arg) < 0) {
// For now we allow globals, so we can't use
// _PyFunction_VerifyStateless().
PyObject *codeobj = PyFunction_GetCode(arg);
if (_PyCode_VerifyStateless(
tstate, (PyCodeObject *)codeobj, NULL, NULL, NULL) < 0) {
goto chained;
}
code = (PyCodeObject *)PyFunction_GetCode(arg);
Py_INCREF(code);
code = (PyCodeObject *)Py_NewRef(codeobj);
}
else if (PyCode_Check(arg)) {
if (_PyCode_VerifyStateless(
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp