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

Appearance settings

gh-130070: Fix exec(<string>, closure=<non-None>) unexpected path #130071

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 17, 2025
Merged
Changes from 1 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
Prev Previous commit
Next Next commit
Tune test cases
  • Loading branch information
bswck committed Feb 13, 2025
commit 559a7ecec384d5e23743a5fb0812eb8a0b1a5ec9
21 changes: 14 additions & 7 deletions 21 Lib/test/test_builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -984,13 +984,6 @@ def four_freevars():
closure=my_closure)
self.assertEqual(result, 2520)

# should fail: closure isn't allowed
# when source is a string
self.assertRaises(TypeError,
exec,
"pass",
closure=my_closure)

# should fail: closure isn't allowed
# for functions without free vars
self.assertRaises(TypeError,
Expand Down Expand Up @@ -1021,6 +1014,20 @@ def four_freevars():
three_freevars.__globals__,
closure=my_closure)

# should fail: incorrect closure isn't allowed
# when source is a string
self.assertRaises(TypeError,
exec,
"pass",
closure=object())

# should fail: correct closure isn't allowed
# when source is a string
self.assertRaises(TypeError,
exec,
"pass",
closure=my_closure)

# should fail: closure tuple with one non-cell-var
my_closure[0] = int
my_closure = tuple(my_closure)
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.