Skip to content

Conversation

@Avasam
Copy link
Contributor

@Avasam Avasam commented Nov 2, 2025

Fixes #381

This updates tests expectations, but alternatively I can update glob_to_re's implementation to always capitalize \z so that the result stays consistent across Python versions (at least for as long as \Z stays supported, which I guess is gonna be quite a while)

if os.sep == '\\':
sep = re.escape(os.sep)
sep = re.escape(os.sep) if os.sep == '\\' else os.sep
# https://docs.python.org/3/whatsnew/3.14.html#re
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sep = os.sep
if os.sep == '\\':
sep = re.escape(os.sep)
sep = re.escape(os.sep) if os.sep == '\\' else os.sep
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively:

Suggested change
sep = re.escape(os.sep) if os.sep == '\\' else os.sep
sep = r"\\" if os.sep == "\\" else os.sep

or even:

Suggested change
sep = re.escape(os.sep) if os.sep == '\\' else os.sep
sep = re.escape(os.sep)

@Avasam Avasam force-pushed the Fix-regex-tests-on-Python-3.14 branch from f8db9de to 9ac82dc Compare November 2, 2025 20:05
# function) -- authors of new compiler interface classes are
# responsible for updating 'compiler_class'!
compiler_type: ClassVar[str] = None # type: ignore[assignment]
compiler_type: ClassVar[str] = None
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be added back in #368 , but tests currently fails with this due to unused type-ignore

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.

Python 3.14 tests failing with AssertionError: assert '(?s:foo[^/]*)\\z' == '(?s:foo[^/]*)\\Z'

1 participant