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
bpo-23689: re module, fix memory leak when a match is terminated by a signal or memory allocation failure #32283
Conversation
_CompileData can store intermediate data.
argument clinic
-_validate_inner(SRE_CODE *code, SRE_CODE *end, Py_ssize_t groups) +_validate_inner(SRE_CODE *code, SRE_CODE *end, PatternObject *self)
LGTM.
I have only one question: how to prove that we need only one SRE_REPEAT structure per the REPEAT code?
self.assertEqual(get_debug_out(r'(?:ab)*(?:cd)*'), '''\ | ||
MAX_REPEAT 0 MAXREPEAT | ||
self.assertEqual(get_debug_out(r'(?:ab)*?(?:cd)*'), '''\ | ||
MIN_REPEAT 0 MAXREPEAT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You just read my mind! I was going to propose such a change, but I thought that I was already bothering you too much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just thought this after posting this PR.
I thought that I was already bothering you too much.
As an inactive contributor, this is not a matter.
I'm not practised, so need continuously improve the patch to get to a good state.
When I think it's good, I can always find its shortcomings afterwards.
I have only one question: how to prove that we need only one SRE_REPEAT structure per the REPEAT code?
I have to think about how to answer your question.
At any time, an
This wouldn't work if re engine could memorize some backtracking states to optimize performance, but then the code of re module would be much more complicated. |
@serhiy-storchaka
This time, I checked several rounds carefully, it should be in good state.
Tested with
VERBOSE
/VVERBOSE
macros defined, it builds and runs well.https://bugs.python.org/issue23689