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

Remove Python 3.7 branches #11238

Merged
merged 11 commits into from
Jan 5, 2024
Merged

Remove Python 3.7 branches #11238

merged 11 commits into from
Jan 5, 2024

Conversation

srittau
Copy link
Collaborator

@srittau srittau commented Jan 4, 2024

Part of #10113

This comment has been minimized.

Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

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

I only got up to D, but this looks generally good.

@@ -650,8 +644,8 @@ SocketType = socket

# ----- Functions -----

def close(__fd: _FD) -> None: ...
def dup(__fd: _FD) -> int: ...
def close(__fd: SupportsIndex) -> None: ...
Copy link
Member

Choose a reason for hiding this comment

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

We also have a _typeshed.FileDescriptor alias but it's just int. No change needed in this PR, but might be worth looking into whether we can make that alias usable here.

stdlib/csv.pyi Outdated Show resolved Hide resolved
@srittau
Copy link
Collaborator Author

srittau commented Jan 4, 2024

So, this crashes mypy:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "mypy/semanal.py", line 6539, in accept
  File "mypy/nodes.py", line 1310, in accept
  File "mypy/semanal.py", line 2889, in visit_assignment_stmt
  File "mypy/semanal.py", line 3393, in process_type_annotation
  File "mypy/semanal.py", line 6690, in anal_type
  File "mypy/types.py", line 955, in accept
  File "mypy/typeanal.py", line 259, in visit_unbound_type
  File "mypy/typeanal.py", line 399, in visit_unbound_type_nonoptional
  File "mypy/typeanal.py", line 6[24](https://github.com/python/typeshed/actions/runs/7411345628/job/20165674610?pr=11238#step:5:25), in try_analyze_special_unbound_type
  File "mypy/typeanal.py", line 1470, in analyze_literal_type
  File "mypy/typeanal.py", line 1484, in analyze_literal_param
  File "mypy/typeanal.py", line 1738, in named_type
  File "mypy/typeanal.py", line [25](https://github.com/python/typeshed/actions/runs/7411345628/job/20165674610?pr=11238#step:5:26)6, in lookup_fully_qualified
  File "mypy/semanal.py", line 5852, in lookup_fully_qualified
AssertionError: builtins.str

mypy fails to find builtins.str which seems weird. I reverted stdlib/builtins.pyi, but that had no effect.

@JelleZijlstra
Copy link
Member

mypy fails to find builtins.str which seems weird. I reverted stdlib/builtins.pyi, but that had no effect.

I'm guessing there is some disturbance in the builtin import cycle. Possibly because the collections import was removed from typing.pyi.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

@srittau
Copy link
Collaborator Author

srittau commented Jan 4, 2024

The jinja2 warning is in a Python 3.7 code branch.

@srittau srittau marked this pull request as ready for review January 4, 2024 16:00

This comment has been minimized.

@hauntsaninja
Copy link
Collaborator

Thanks for working on this! One request, can we merge #11219 first?

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

E-M looked good, and I have faith in you and our tests for the rest

Copy link
Contributor

github-actions bot commented Jan 5, 2024

Diff from mypy_primer, showing the effect of this PR on open source code:

spack (https://github.com/spack/spack)
+ lib/spack/spack/install_test.py:520: error: Unused "type: ignore" comment  [unused-ignore]
+ lib/spack/spack/install_test.py:522: error: Unused "type: ignore" comment  [unused-ignore]

jinja (https://github.com/pallets/jinja)
+ src/jinja2/debug.py:130: error: Argument 6 to "CodeType" has incompatible type "bytes"; expected "int"  [arg-type]
+ src/jinja2/debug.py:131: error: Argument 7 to "CodeType" has incompatible type "Tuple[Any, ...]"; expected "bytes"  [arg-type]
+ src/jinja2/debug.py:134: error: Argument 10 to "CodeType" has incompatible type "str"; expected "Tuple[str, ...]"  [arg-type]
+ src/jinja2/debug.py:136: error: Argument 12 to "CodeType" has incompatible type "int"; expected "str"  [arg-type]
+ src/jinja2/debug.py:137: error: Argument 13 to "CodeType" has incompatible type "bytes"; expected "int"  [arg-type]
+ src/jinja2/debug.py:138: error: Argument 14 to "CodeType" has incompatible type "Tuple[str, ...]"; expected "bytes"  [arg-type]
+ src/jinja2/ext.py:297: error: Incompatible redefinition (redefinition with type "Callable[[Arg(str, 'c'), Arg(str, 's')], str]", original type "Callable[[Arg(str, 'context'), Arg(str, 'message')], str]")  [misc]
+ src/jinja2/ext.py:304: error: Incompatible redefinition (redefinition with type "Callable[[Arg(str, 'c'), Arg(str, 's'), Arg(str, 'p'), Arg(int, 'n')], str]", original type "Callable[[Arg(str, 'context'), Arg(str, 'msgid1'), Arg(str, 'msgid2'), Arg(int, 'n')], str]")  [misc]

@srittau srittau merged commit 2360485 into python:main Jan 5, 2024
65 checks passed
@srittau srittau deleted the rm-3.7-branches branch January 5, 2024 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants