Skip to content

gh-130999: Fix globals() poisoning in test_traceback #135030

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 1 commit into from
Jun 2, 2025

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant

Merged
Changes from all commits
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
9 changes: 5 additions & 4 deletions Lib/test/test_traceback.py
Original file line number Diff line number Diff line change
@@ -4232,8 +4232,8 @@ def make_module(self, code):

return mod_name

def get_import_from_suggestion(self, mod_dict, name):
modname = self.make_module(mod_dict)
def get_import_from_suggestion(self, code, name):
modname = self.make_module(code)

def callable():
try:
@@ -4416,8 +4416,9 @@ def func():
def test_name_error_suggestions_with_non_string_candidates(self):
def func():
abc = 1
globals()[0] = 1
abv
custom_globals = globals().copy()
custom_globals[0] = 1
print(eval("abv", custom_globals, locals()))
actual = self.get_suggestion(func)
self.assertIn("abc", actual)

Loading
Oops, something went wrong.

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant