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

Replace Qt RegEx with Python RegEx #2028

Merged
merged 8 commits into from
Sep 22, 2024
Merged

Replace Qt RegEx with Python RegEx #2028

merged 8 commits into from
Sep 22, 2024

Conversation

vkbo
Copy link
Owner

@vkbo vkbo commented Sep 22, 2024

Summary:

This PR replaces QRegularExpression from Qt with Python's standard library regex module.

There are two reasons for doing this:

  • The standard library one is a little bit faster, mostly because there is no need to convert strings when calling it like is needed for the Qt one (I suspect that's the reason anyway).
  • The PyQt6 interface th QRegularExpression is broken, at least for Qt 6.4.2. The returned matches are sometimes garbled. Presumably due to UTF-16 to UTF-8 conversion, but I'm not sure. Switching to the Python implementation avoids this problem in the future when we switch to Qt6.

Related Issue(s):

Reviewer's Checklist:

  • The header of all files contain a reference to the repository license
  • The overall test coverage is increased or remains the same as before
  • All tests are passing
  • All flake8 checks are passing and the style guide is followed
  • Documentation (as docstrings) is complete and understandable
  • Only files that have been actively changed are committed

@vkbo vkbo added this to the Release 2.6 Beta 1 milestone Sep 22, 2024
@vkbo vkbo merged commit 5c07148 into main Sep 22, 2024
8 checks passed
@vkbo vkbo deleted the regex_refactor branch September 22, 2024 16:02
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.

1 participant