-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
breaking change in 22.1.0 TypeError: set object expected; got list
#2829
Comments
This is a consequence of mypyc, which adds strict runtime type checks as the price for improved performance. The first argument to Mode is a set: https://github.com/psf/black/blob/main/src/black/mode.py#L139. I am not inclined to change this back. We don't have a publicly documented API, and to the extent we do, the type annotations already say you need to pass a set, not a list. |
it looks like it was unintentionally changed to disallow iterables here: f2ea461 (a confusion between |
The history here isn't really relevant. Even if we made some half-hearted backward compatibility hacks in the past, this was never a documented public API, and we can and do change it in incompatible ways without warning. That will continue to be the case until #779 is resolved. One API-like structure we have are the type annotations, and those already said We could probably fix your use case by using an annotation like |
I think I would prefer black fix the regression rather than having to adjust my code |
Because of adamchainz/blacken-docs#141 / psf/black#2829
I'll have to agree with Jelle here. Additionally:
I feel for you because of the breakage, but I'll echo Jelle: I'm not inclined to change anything here. But we'll continue discussing the public API! Personally, I'm interested in taking care of it pretty soon so people can start using Black within Python as well 👍 |
I'm a bit disappointed in the choice, this feels very much like a "we're a bigger project so do what we say" decision rather than one which is helpful for the community and integrations |
* Update black to stable version Also remove shebang pre-commit check as it is just hassle * Disable blacken-docs until this regression bug is fixed: psf/black#2829
this worked fine in previous versions but was broken with the most recently release
here's the calling code: https://github.com/asottile/blacken-docs/blob/fb39015204c88c8f4f7365d7b4ac049ea8cb6450/blacken_docs.py#L237-L241
Describe the bug
FileMode
changed in a backward incompatible way in 22.1.0To Reproduce
here is the minimal reproduction
python3 -c 'import black; black.FileMode([])'
Expected behavior
this used to work
Environment
Additional context
this is breaking blacken-docs: adamchainz/blacken-docs#141
The text was updated successfully, but these errors were encountered: