Skip to content
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

Fix tests on 3.7 #15543

Merged
merged 1 commit into from
Jun 29, 2023
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
3 changes: 3 additions & 0 deletions mypyc/irbuild/classdef.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,9 @@ def populate_non_ext_bases(builder: IRBuilder, cdef: ClassDef) -> Value:
if builder.options.capi_version < (3, 8):
# TypedDict was added to typing in Python 3.8.
module = "typing_extensions"
# It needs to be "_TypedDict" on typing_extensions 4.7.0+
# and "TypedDict" otherwise.
Copy link
Member

Choose a reason for hiding this comment

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

If this breaks tests with typing_extensions <4.7 installed, should we bump the typing_extensions lower bounds here to >=4.7.0?

mypy/setup.py

Line 225 in 9a4a5aa

"typing_extensions>=4.1.0",

typing_extensions>=4.1.0

"typing_extensions>=4.1.0",

Copy link
Member Author

Choose a reason for hiding this comment

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

Possibly, but I think it also breaks usage of mypyc-compiled extensions that have typing-extensions 4.7 lying around, which I don't think is something we can guard against.

Copy link
Member

Choose a reason for hiding this comment

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

I see. I think it still might be worth bumping the lower bound, though — it will affect freshly compiled extensions. People got unhappy with us when we started using features added in typing_extensions 4.1 without bumping our lower bound: #15487.

(I do agree with you that dropping support for 3.7 is probably the best solution here FWIW.)

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess my preference is: merge this PR now to get CI green (assuming it actually passes). If we still support 3.7 on the next release, bump the typing-extensions lower bounds, otherwise don't.

Copy link
Member

@AlexWaygood AlexWaygood Jun 28, 2023

Choose a reason for hiding this comment

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

That makes sense, but we need to make sure we remember to do that if we are still supporting 3.7 at that point!

name = "_TypedDict"
else:
# In Python 3.9 TypedDict is not a real type.
name = "_TypedDict"
Expand Down