support defaults for typing.TypeVar and typing.TypeVarTuple#1318
support defaults for typing.TypeVar and typing.TypeVarTuple#1318WKarel wants to merge 3 commits into
Conversation
|
To consider this for merging, it will need some test coverage.. |
| s_ref.insert(5, "") | ||
| s_ref.insert(6, "from typing_extensions import CapsuleType") | ||
|
|
||
| if "test_typing_ext" in p_in.name and sys.version_info < (3, 13): |
There was a problem hiding this comment.
This seems quite complicated/fragile
There was a problem hiding this comment.
Depending on the Python version to be tested, up to 2 names less are imported from the typing-module, crossing stubGen.py's threshold for the maximum line length. Hence, the import-statement is either a one-liner, or it spreads across multiple lines (see my initial comment about this being too complicated to be tested). The test code thus copy/pastes stubGen.py's generation of import statements, which is ready for future changes in the number of names imported from the typing-module. But it will break in case of relevant changes of stubGen.py. An alternative would be to hard-code the resp. import-statement for different Python versions, but that seems more fragile to me. Suggestions?
Python-3.13 added optional defaults for typing.TypeVar and typing.TypeVarTuple. This PR makes stubGen.py document the defaults in stub files.
Tests fine with Python-3.14, and with
test_typing.cppcontaining, and
test_typing_ext.pyicontainingBut the CI runs stub tests on Python-3.10+, and doing the comparisons correctly for versions below 3.13 seems too complicated.