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

Improve debugging of the _sre module #106508

Closed
serhiy-storchaka opened this issue Jul 7, 2023 · 0 comments
Closed

Improve debugging of the _sre module #106508

serhiy-storchaka opened this issue Jul 7, 2023 · 0 comments
Labels
3.13 bugs and security fixes build The build process and cross-build extension-modules C modules in the Modules dir topic-regex

Comments

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Jul 7, 2023

If macro VERBOSE is defined during compiling the _sre module, debugging prints are added which help to debug internals of the regular expression engine. Unfortunately, it is a global option which affects evaluation of every regular expression. Since some Python code which uses regular expressions is executed at make, it makes building much more slower. Also, some regular expressions are used at the REPR startup, which adds a lot of noise. It makes this feature almost not usable.

The proposed PR allows to enable tracing on per-pattern basis. If macro VERBOSE == 1, tracing is only enabled for patterns compiled with the DEBUG flag. If VERBOSE == 2, tracing is always enabled, if VERBOSE == 0 it is always disabled.

This feature is for core developers only.

Linked PRs

@serhiy-storchaka serhiy-storchaka added extension-modules C modules in the Modules dir build The build process and cross-build topic-regex labels Jul 7, 2023
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Jul 7, 2023
Now the VERBOSE macro can control tracing on per-pattern basis:

* 0 -- disabled
* 1 -- only if the DEBUG flag set
* 2 -- always
@serhiy-storchaka serhiy-storchaka added the 3.13 bugs and security fixes label Jul 7, 2023
serhiy-storchaka added a commit that referenced this issue Jul 8, 2023
Now the VERBOSE macro can control tracing on per-pattern basis:

* 0 -- disabled
* 1 -- only if the DEBUG flag set
* 2 -- always
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes build The build process and cross-build extension-modules C modules in the Modules dir topic-regex
Projects
None yet
Development

No branches or pull requests

1 participant