Skip to content

Conversation

@encukou
Copy link
Member

@encukou encukou commented Aug 26, 2020

Hopefully #21961 will be OK, but if not: here is a relatively minimal fix for bpo-41631, which basically makes compiling to/from AST fail gracefully (with a proper exception rather than a NULL without exception) if the _ast module has been tampered with.
For example, it looks like Mercurial's lazy-loading scheme replaces _astwith a proxy object; this will make AST unusable.

The second commit deals with a hack in pegen's tests – please review the commits separately, and see comments.

https://bugs.python.org/issue41631

@encukou
Copy link
Member Author

encukou commented Sep 8, 2020

@pablogsal, does this make sense for peg_generator? (Keeping in mind this would be a last-minute fix for 3.9, with a better solution hopefully coming in 3.10.)

@pablogsal
Copy link
Member

@pablogsal, does this make sense for peg_generator? (Keeping in mind this would be a last-minute fix for 3.9, with a better solution hopefully coming in 3.10.)

Yup, it does sense to me as a temporary solution 👍

encukou and others added 2 commits September 9, 2020 10:38
The previous behavior didn't always segfault -- in fact, it usually
raised a SystemError as well. A segfault (or any other behavior,
depending on the module object imported as _ast) was still *possible*,
but for that level of detail people should see the bpo issue.
@vstinner
Copy link
Member

Thanks for the workaround. PR 21961 fix has been merged instead.

@vstinner vstinner closed this Sep 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants