8000 gh-127651: Use __file__ in diagnostics if origin is missing by hauntsaninja · Pull Request #127660 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-127651: Use __file__ in diagnostics if origin is missing #127660

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 15 commits into from
Dec 10, 2024
Merged
Prev Previous commit
Next Next commit
use mortal objects
  • Loading branch information
hauntsaninja committed Dec 9, 2024
commit 33e3fb6ffa0605c04bf52f6d4c36958293930fcd
6 changes: 3 additions & 3 deletions Lib/test/test_import/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ def test_frozen_module_from_import_error(self):
"""
import os
os.__spec__.has_location = False
os.__file__ = 123
os.__file__ = []
from os import this_will_never_exist
""",
"""
Expand Down Expand Up @@ -1105,7 +1105,7 @@ class substr(str):
except AttributeError as e:
print(str(e))

fractions.__spec__.origin = 0
fractions.__spec__.origin = []
try:
fractions.Fraction
except AttributeError as e:
Expand All @@ -1129,7 +1129,7 @@ class substr(str):
except ImportError as e:
print(str(e))

fractions.__spec__.origin = 0
fractions.__spec__.origin = []
try:
from fractions import Fraction
except ImportError as e:
Expand Down
0