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

Update problem at 0.28.0 -> 0.29.0 #189

Closed
Lasica opened this issue Nov 20, 2023 · 3 comments
Closed

Update problem at 0.28.0 -> 0.29.0 #189

Lasica opened this issue Nov 20, 2023 · 3 comments
Assignees
Labels
support Support not requiring code changes

Comments

@Lasica
Copy link

Lasica commented Nov 20, 2023

I've found that my spellcheck config works for version 0.28.0 and before, but at 0.29.0 I have the following crash:

Checking files matching specified outlined in >.spellcheck.yml<
----------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/bin/pyspelling", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyspelling/__main__.py", line 30, in main
    return run(
           ^^^^
  File "/usr/local/lib/python3.11/site-packages/pyspelling/__main__.py", line 55, in run
    for results in spellcheck(
  File "/usr/local/lib/python3.11/site-packages/pyspelling/__init__.py", line 673, in spellcheck
    for result in spellchecker.run_task(task, source_patterns=sources):
  File "/usr/local/lib/python3.11/site-packages/pyspelling/__init__.py", line 311, in run_task
    self._build_pipeline(task)
  File "/usr/local/lib/python3.11/site-packages/pyspelling/__init__.py", line 265, in _build_pipeline
    self.pipeline_steps.append(module(options, **kwargs))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyspelling/filters/context.py", line 17, in __init__
    super().__init__(options, default_encoding)
  File "/usr/local/lib/python3.11/site-packages/pyspelling/filters/__init__.py", line 86, in __init__
    super().__init__(options)
  File "/usr/local/lib/python3.11/site-packages/pyspelling/plugin.py", line 23, in __init__
    self.setup()
  File "/usr/local/lib/python3.11/site-packages/pyspelling/filters/context.py", line 72, in setup
    self.delimiters.append((re.compile(pattern, re.M), group))
                            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/re/__init__.py", line 227, in compile
    return _compile(pattern, flags)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/re/__init__.py", line 294, in _compile
    p = _compiler.compile(pattern, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/re/_compiler.py", line 743, in compile
    p = _parser.parse(p, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/re/_parser.py", line 980, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/re/_parser.py", line 455, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/re/_parser.py", line 841, in _parse
    raise source.error('global flags not at the start '
re.error: global flags not at the start of the expression at position 1
::error title=Spelling errors::Files in repository contain spelling errors

and it occurs in all higher versions. Here's my spellcheck.yml:

spellchecker: aspell
matrix:
  - name: Check the english docs
    aspell:
      ignore-case: ""
      lang: en
    sources:
      - "docs/**/*.md"
      - "CONTRIBUTING.md"
      - "README.md"
    default_encoding: utf-8
    pipeline:
    - pyspelling.filters.context:
        context_visible_first: true
        escapes: \\[\\`~]
        delimiters:
          # Ignore multiline content between fences (fences can have 3 or more back ticks)
          # ```
          # content
          # ```
          - open: '^(?s)(?P<open>`{1,3})[^`]'
            close: '(?P=open)'
          # Ignore text between inline back ticks
          - open: '(?P<open>`)[^`]'
            close: '(?P=open)'
          # Ignore text in brackets [] and ()
          - open: '\['
            close: '\]'
          - open: '\('
            close: '\)'
          - open: '\{'
            close: '\}'
    - pyspelling.filters.markdown:
        markdown_extensions:
        - pymdownx.superfences
    dictionary:
      wordlists:
        - docs/spellcheck_exceptions.txt

Any ideas what could be the issue? I've checked changelog to see what's changed in those versions but apart from python/library updates I didn't see anything. There was also addition of markdown check to default spelling.yml

@Lasica
Copy link
Author

Lasica commented Nov 20, 2023

Ok I see this is regex python 3.11 issue:
https://docs.python.org/3/whatsnew/3.11.html#porting-to-python-3-11

@Lasica
Copy link
Author

Lasica commented Nov 20, 2023

So we can close it, leave it archived so maybe someone else encounters this issue.

the (?s) in regex was the cause.

@Lasica Lasica closed this as completed Nov 20, 2023
@jonasbn jonasbn self-assigned this Nov 20, 2023
@jonasbn jonasbn added the support Support not requiring code changes label Nov 20, 2023
jonasbn added a commit that referenced this issue Dec 11, 2023
Updated diagnostics with a new section, based on content from #189
@jonasbn
Copy link
Collaborator

jonasbn commented Dec 11, 2023

Created a new diagnostic section in the documentation based on this, ref: #190

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Support not requiring code changes
Projects
None yet
Development

No branches or pull requests

2 participants