Giter Club home page Giter Club logo

Comments (6)

JelleZijlstra avatar JelleZijlstra commented on May 28, 2024 1

This is fixed in Black 24.4.1.

from black.

JelleZijlstra avatar JelleZijlstra commented on May 28, 2024 1

#4352

from black.

bmitc avatar bmitc commented on May 28, 2024

Thanks for the heads up! I verified this on my machine.

I was relying on the instructions:

  1. Use the online formatter at https://black.vercel.app/?version=main, which will use the latest main branch.

to get the latest version, and so I continued on with the bug report since it also has an issue. Does that mean that the latest version has a new, different issue?

As mentioned in the bug report, the online formatter returns:

cannot use --safe with this file; failed to parse source file AST: f-string: unmatched '[' (, line 3)
This could be caused by running Black with an older Python version that does not support new syntax used in your source file.

from black.

JelleZijlstra avatar JelleZijlstra commented on May 28, 2024

Good point that maybe we should stop recommending the online formatter.

The online formatter doesn't work here because this syntax is new in Python 3.12, and the formatter apparently runs an older version of Black at runtime. Black's own parser is independent of the Python version, but the AST safety check relies on Python's builtin parser.

from black.

bmitc avatar bmitc commented on May 28, 2024

Ahh, gotcha. Yea, I apologize for not doing due diligence and running poetry update black locally, but it was faster to click the link to the online formatter. :)

I am somewhat new to the Python ecosystem, and I immediately upgraded the existing codebase I inherited to Python 3.12, so I'm often unaware of the subtle changes that have happened across the versions.

from black.

bmitc avatar bmitc commented on May 28, 2024

Great! Thanks!

from black.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.