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

Fix FutureWarning for words() with "[" #1854

Merged
merged 1 commit into from Jul 6, 2021

Conversation

jeanas
Copy link
Contributor

@jeanas jeanas commented Jul 6, 2021

regex_opt() groups characters in sets when possible. The
warning was caused when the "[" character ended up at the beginning
of a set: r"[[...]". This emits a FutureWarning since Python 3.7
due to possible changes in semantics in the future
(https://bugs.python.org/issue30349). Just add "[" to the list
of characters that should be escaped in sets. Add unit tests
for words().

[Closes #1853.]

regex_opt() groups characters in sets when possible. The
warning was caused when the "[" character ended up at the beginning
of a set: r"[[...]". This emits a FutureWarning since Python 3.7
due to possible changes in semantics in the future
(https://bugs.python.org/issue30349). Just add "[" to the list
of characters that should be escaped in sets. Add unit tests
for words().

[Closes pygments#1853.]
@birkenfeld
Copy link
Member

Very nice!

@birkenfeld birkenfeld merged commit fa7772c into pygments:master Jul 6, 2021
@Anteru Anteru self-assigned this Jul 7, 2021
@Anteru Anteru added the changelog-update Items which need to get mentioned in the changelog label Jul 7, 2021
@Anteru Anteru added this to the 2.10 milestone Jul 7, 2021
@Anteru Anteru removed the changelog-update Items which need to get mentioned in the changelog label Aug 8, 2021
@jeanas jeanas deleted the bracket-regexopt branch September 1, 2023 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warning upon words() on list containing "["
3 participants