-
Notifications
You must be signed in to change notification settings - Fork 853
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
Error re.error: global flags not at the start of the expression at position ... #1312
Comments
We do not yet officially support Python 3.11 and it appears that as of Python 3.11 global flags are only allowed to exist at the start of a regex (apparently this was deprecated in Python 3.6; see second to last item here). A few of our regex will need to be refactored to support Python 3.11. |
thanks, I will wait for a fix. |
So I just looked at our source code and we are not using global flags inline in our regex. However, looking more closely at your traceback, I see that the error occurs when registering the gfm.autolink extension. A quick search demonstrates that that extension is using flags. I suggest reporting this issue to the appropriate extension. In the meantime, I will leave this issue open until we verify that the base library runs fine on Python 3.11. |
I cannot find Github repo for py-GFM extension, where is it? |
As a more general concern, the regex for each inline pattern is compiled using this code: markdown/markdown/inlinepatterns.py Lines 209 to 210 in a8ad6fc
That includes any inlinepatterns defined by extensions. If an extension wants/needs additional flags, as of Python 3.11 they cannot define them within the regex. Of course, extensions can always redefine this method in their own subclasses and then define any flags they want. While not as easy as defining them anywhere within the rexeg itself, it is still possible to do. Do we want to address this somehow, and if so, how? |
I have no idea. I was not aware of the extension until today. |
The pypi page links to zopieux/py-gfm. |
But "This repository will not receive bug fixes, and might become read only soon... |
Yeah I saw that. However, we can not be responsible for third party extensions. That is the choice of the developers of the extension. Your choices include not updating to Python 3.11, finding an alternate extension, patching the extension yourself, or building your own replacement extension. |
@veksha Do you use Markdown Editing plugin for CudaText? if so, consider to patch the mentioned extension for py 3.11. |
What kind of flags are being used, can you use scoped flags? |
@facelessuser the extension is using |
Scoped flags should not throw a global flag warning. This is PY 3.11 below, no error. Python 3.11.0 (v3.11.0:deaf509e8f, Oct 24 2022, 14:43:23) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> re.compile(r'^(?i:www)stuff')
re.compile('^(?i:www)stuff') So, I don't know what is actually getting run. But I'd advise using the InlineProcessor instead of Pattern as it does not wrap the pattern: markdown/markdown/inlinepatterns.py Line 253 in a8ad6fc
|
Just an FYI on |
Ah right. So that is the answer for any third party extensions which need this: Use the new As the py311 tests are passing that I added in #1313, I am closing this. There is no action we need to take. |
CudaText plugin:
https://github.com/cudaText-addons/cuda_markdown_preview
is giving error under Python 3.11 and Win10:
What can I do?
The text was updated successfully, but these errors were encountered: