Content-Length: 317275 | pFad | http://github.com/python/cpython/pull/145784

3A gh-145783: Propagate errors raised in `NEW_TYPE_COMMENT` by StanFromIreland · Pull Request #145784 · python/cpython · GitHub
Skip to content

gh-145783: Propagate errors raised in NEW_TYPE_COMMENT #145784

Open
StanFromIreland wants to merge 2 commits intopython:mainfrom
StanFromIreland:raise-error-parser
Open

gh-145783: Propagate errors raised in NEW_TYPE_COMMENT #145784
StanFromIreland wants to merge 2 commits intopython:mainfrom
StanFromIreland:raise-error-parser

Conversation

@StanFromIreland
Copy link
Member

@StanFromIreland StanFromIreland commented Mar 10, 2026

_testcapi = import_helper.import_module('_testcapi')
flags = 0x0800 | 0x1000 # PyCF_IGNORE_COOKIE | PyCF_TYPE_COMMENTS
with self.assertRaises(UnicodeDecodeError):
_testcapi.Py_CompileStringExFlags(
Copy link
Member

Choose a reason for hiding this comment

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

Why does this need _testcapi? Was the error not reproducible with a direct call to e.g. compile()?

Copy link
Member Author

Choose a reason for hiding this comment

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

You can't pass PyCF_IGNORE_COOKIE to compile() (or any other Python API).

>>> compile(b'a=1 # type: \x80', '<test>', 'single', flags=0x0800|0x1000)                                                                       
ValueError: compile(): unrecognised flags

Since this is the function used in the fuzzer, (I hope) it may be useful for future issues found by it.

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.

2 participants









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/python/cpython/pull/145784

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy