Skip to content
Open
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion Lib/test/lazy_imports_all_exclude.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@ test_profiling
test_pyrepl
test_subprocess
test_symtable
test_type_annotations
test_unittest
7 changes: 6 additions & 1 deletion Lib/test/test_type_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import textwrap
import types
import unittest
import sys
from test.support import run_code, check_syntax_error, import_helper, cpython_only
from test.test_inspect import inspect_stringized_annotations

Expand Down Expand Up @@ -162,7 +163,11 @@ def test_partially_executed_module(self):
partialexe.a.__annotations__,
{"v1": int, "v2": int},
)
self.assertEqual(partialexe.b.annos, {"v1": int})
# Module execution semantics differ based on the lazy imports mode:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still doesn't really say why it differs. My default assumption is that it's a bug when behavior differs depending on the lazy import mode. Maybe it's an unavoidable bug that nobody will really run into and it's fine to ignore, but we should at least investigate.

if sys.get_lazy_imports() == "all":
Comment thread
sobolevn marked this conversation as resolved.
Resolved
self.assertEqual(partialexe.b.annos, {"v1": int, "v2": int}) # full
else:
self.assertEqual(partialexe.b.annos, {"v1": int}) # partial

@cpython_only
def test_no_cell(self):
Expand Down
Loading