Fix unwanted crashes caused by AST equivalency check (#4290)
Preview style
if guards in case blocks are now wrapped in parentheses when the line is too long.
(#4269)
Stop moving multiline strings to a new line unless inside brackets (#4289)
Integrations
Add a new option use_pyproject to the GitHub Action psf/black. This will read the
Black version from pyproject.toml. (#4294)
24.3.0
Highlights
This release is a milestone: it fixes Black's first CVE security vulnerability. If you
run Black on untrusted input, or if you habitually put thousands of leading tab
characters in your docstrings, you are strongly encouraged to upgrade immediately to fix
CVE-2024-21503.
This release also fixes a bug in Black's AST safety check that allowed Black to make
incorrect changes to certain f-strings that are valid in Python 3.12 and higher.
Stable style
Don't move comments along with delimiters, which could cause crashes (#4248)
Strengthen AST safety check to catch more unsafe changes to strings. Previous versions
of Black would incorrectly format the contents of certain unusual f-strings containing
nested strings with the same quote type. Now, Black will crash on such strings until
support for the new f-string syntax is implemented. (#4270)
Fix a bug where line-ranges exceeding the last code line would not work as expected
(#4273)
Performance
Fix catastrophic performance on docstrings that contain large numbers of leading tab
characters. This fixes
CVE-2024-21503.
(#4278)
Documentation
Note what happens when --check is used with --quiet (#4236)
We’ve just uploaded mypy 1.9 to the Python Package Index (PyPI). Mypy is a static type checker for Python. This release includes new features, performance improvements and bug fixes. You can install it as follows:
python3 -m pip install -U mypy
You can read the full documentation for this release on Read the Docs.
Breaking Changes
Because the version of typeshed we use in mypy 1.9 doesn't support 3.7, neither does mypy 1.9. (Jared Hance, PR 16883)
We are planning to enable
local partial types (enabled via the
--local-partial-types flag) later this year by default. This change
was announced years ago, but now it's finally happening. This is a
major backward-incompatible change, so we'll probably include it as
part of the upcoming mypy 2.0 release. This makes daemon and
non-daemon mypy runs have the same behavior by default.
Local partial types can also be enabled in the mypy config file:
local_partial_types = True
We are looking at providing a tool to make it easier to migrate
projects to use --local-partial-types, but it's not yet clear whether
this is practical. The migration usually involves adding some
explicit type annotations to module-level and class-level variables.
Basic Support for Type Parameter Defaults (PEP 696)
This release contains new experimental support for type parameter
defaults (PEP 696). Please try it
out! This feature was contributed by Marc Mueller.
Since this feature will be officially introduced in the next Python
feature release (3.13), you will need to import TypeVar, ParamSpec
or TypeVarTuple from typing_extensions to use defaults for now.
This example adapted from the PEP defines a default for BotT:
from typing import Generic
from typing_extensions import TypeVar
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself)
- `@dependabot ignore minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself)
- `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency
- `@dependabot unignore ` will remove the ignore condition of the specified dependency and ignore conditions
Updates the requirements on black[jupyter] and mypy to permit the latest version. Updates
black[jupyter]
to 24.4.0Release notes
Sourced from black[jupyter]'s releases.
Changelog
Sourced from black[jupyter]'s changelog.
... (truncated)
Commits
8fe6270
Prepare release 24.4.0 (#4307)6b25e7c
Bump peter-evans/find-comment from 3.0.0 to 3.1.0 (#4304)07fe1ca
docs: remove repetitive word (#4303)3383f53
GitHub Action: Allow reading version from pyproject.toml (#4294)c8f1a55
[pre-commit.ci] pre-commit autoupdate (#4297)836acad
Improve AST safety check (#4290)13bd092
fix: Stop moving multiline strings to a new line unless inside brackets (#4289)c9d2635
Remove mocking from tests (#4287)bf11956
Fix two logging calls in the test helper (#4286)97993f9
Bump pypa/cibuildwheel from 2.16.5 to 2.17.0 (#4283)Updates
mypy
to 1.9.0Changelog
Sourced from mypy's changelog.
... (truncated)
Commits
5ff46f8
Remove +dev.155909a
[Release 1.9] Unsupport targetting 3.7. (#16883) (#16900)6615cab
[Release 1.9] Stubtest: ignore a new protocol dunder (#16895) (#16899)b956e6a
stubtest: Private parameters can be omitted (#16507)ede0b20
Bump ruff to 0.2.0 (#16870)7bdd61f
stubgen: Fix crash on star unpack of TypeVarTuple (#16869)8c2ef9d
Update hashes in sync-typeshed.py following recent typeshed sync0dd4b6f
Revert use ofParamSpec
forfunctools.wraps
dd12a2d
Revert typeshed ctypes changed132999
Revert sum literal integer change (#13961)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show