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

Make flake8 pass when run with Python 3.12 #4050

Merged
merged 2 commits into from
Nov 18, 2023

Conversation

AlexWaygood
Copy link
Contributor

@AlexWaygood AlexWaygood commented Nov 18, 2023

Description

If you run pre-commit run -a flake8 on Black with a Python 3.12 environment, it fails:

(.venv) C:\Users\alexw\coding\black>pre-commit run -a flake8
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-mypy.
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-mypy:types-PyYAML,tomli >= 0.2.6, < 2.0.0,click >= 8.1.0, != 8.1.4, != 8.1.5,packaging >= 22.0,platformdirs >= 2.1.0,pytest,hypothesis,aiohttp >= 3.7.4,types-commonmark,urllib3,hypothesmith.
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

src/black/parsing.py:178:31: E226 missing whitespace around arithmetic operator
src/black/parsing.py:214:35: E226 missing whitespace around arithmetic operator

This is because flake8 is now able to detect errors inside f-strings on Python 3.12. It isn't able to do this on older versions of Python, but, due to changes in Python's tokenizer on Python 3.12, it can when run using Python 3.12.

Checklist - did you ...

  • Add an entry in CHANGES.md if necessary?
  • Add / update tests if necessary?
  • Add new / update outdated documentation?

@JelleZijlstra JelleZijlstra added the skip news Pull requests that don't need a changelog entry. label Nov 18, 2023
@JelleZijlstra
Copy link
Collaborator

hm, PyPy on Windows is failing consistently with

.tox\ci-pypy3\lib\site-packages\aiohttp\cookiejar.py:64: in CookieJar
    calendar.timegm(time.gmtime(MAX_TIME))
E   ValueError: Invalid argument

I assume it's a regression in the latest aiohttp, but I don't see it reported anywhere yet.

@JelleZijlstra
Copy link
Collaborator

Likely due to aio-libs/aiohttp#7824

@JelleZijlstra
Copy link
Collaborator

Reported aio-libs/aiohttp#7848

@AlexWaygood
Copy link
Contributor Author

hm, PyPy on Windows is failing consistently

I opened #4051 to get CI green again :)

Copy link

diff-shades reports zero changes comparing this PR (1a978bd) to main (85b1c71).


What is this? | Workflow run | diff-shades documentation

@JelleZijlstra JelleZijlstra merged commit c4cd200 into psf:main Nov 18, 2023
41 checks passed
@AlexWaygood AlexWaygood deleted the flake8-312 branch November 18, 2023 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news Pull requests that don't need a changelog entry.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants