10BC0 docs: re.compile(...) fails due ops > 127 but the error is misleading · Issue #17150 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content
docs: re.compile(...) fails due ops > 127 but the error is misleading #17150
@WebReflection

Description

@WebReflection

Documentation URL

No response

Description

Apparently this is expected to fail:

import re

# this works
re.compile('^(?:a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v)$')

# this fails
re.compile('^(?:a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w)$')

but at least the error could hint that's because there are too many operations to handle, instead of:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: error in regex

'cause there is no error, strictly speaking, in that regex, it's a hard (default) limitation on MicroPython side.

Thanks.

Code of Conduct

Yes, I agree

Metadata

Metadata

Assignees

No one assigned

    Labels

    docspy-coreRelates to py/ directory in source

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0