-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
black adds trailing comma despite using --target-version py35 #759
Comments
Looks like we improperly merged two different syntax changes: |
Thanks a lot! |
Due to psf/black#759 black produces code that is invalid Python 3.5 syntax even with --target-version py35. This patch disables reformatting for this call (it doesn't seem to be possible per line) until it's fixed.
Due to psf/black#759 black produces code that is invalid Python 3.5 syntax even with --target-version py35. This patch disables reformatting for this call (it doesn't seem to be possible per line) until it's fixed.
This is a rebased and fixed version of PR #27, which also adds compatibility shim for ServiceInfo.address and does a proper deprecation for it. * Present all addresses that are available. * Add support for publishing multiple addresses. * Add test for backwards compatibility. * Provide proper deprecation of the "address" argument and field * Raise deprecation warnings when address is used * Add a compatibility property to avoid breaking existing code (based on suggestion by Bas Stottelaar in PR #27) * Make addresses keyword-only, so that address can be eventually removed and replaced with it without breaking consumers * Raise TypeError instead of an assertion on conflicting address and addresses * Disable black on ServiceInfo.__init__ until black is fixed Due to psf/black#759 black produces code that is invalid Python 3.5 syntax even with --target-version py35. This patch disables reformatting for this call (it doesn't seem to be possible per line) until it's fixed.
Seems like there's a regression -I'm seeing this behavior with 20.8b1. It could be something more specific: my affected function has a return type annotation. |
@mikenerone could you please post the bug-inducing code? Might be a case of #1356. |
I believe you're right. My triggering sample below closely resembles a case shown there.
black 20.8b1 adds a trailing comma on the |
Hi,
black 19.3b0 adds trailing commas for function signatures containing
*
despite setting target version 3.5. This creates invalid code for python 3.5 which will raise a SyntaxError. Settingtarget version to py34 or using the auto detection doesn't add a trailing comma in this case.
running
> black --target-version py35 --line-length 80 foo.py
creates
Operating system: Ubuntu 18.04
Python version: Python 3.5/3.6
Black version:
> black --version black, version 19.3b0
Does also happen on master: yes
The text was updated successfully, but these errors were encountered: