Skip to content

Allow nativeparse to parse source code directly#21260

Open
bzoracler wants to merge 5 commits intopython:masterfrom
bzoracler:nativeparse-source
Open

Allow nativeparse to parse source code directly#21260
bzoracler wants to merge 5 commits intopython:masterfrom
bzoracler:nativeparse-source

Conversation

@bzoracler
Copy link
Copy Markdown
Contributor

This is the mypy counterpart of mypyc/ast_serialize#54

@bzoracler
Copy link
Copy Markdown
Contributor Author

bzoracler commented Apr 17, 2026

Current CI failure is due to changed typing signature of ast_serialize.parse::source, this has been fixed in the corresponding PR in mypyc/ast_serialize (see changed line).

@github-actions

This comment has been minimized.

@bzoracler bzoracler force-pushed the nativeparse-source branch from c8c10dd to ac275e4 Compare April 28, 2026 02:28
@github-actions

This comment has been minimized.

@bzoracler bzoracler force-pushed the nativeparse-source branch from 444f4e9 to 149e459 Compare April 28, 2026 03:07
@bzoracler bzoracler marked this pull request as draft April 28, 2026 03:10
@github-actions
Copy link
Copy Markdown
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@bzoracler
Copy link
Copy Markdown
Contributor Author

bzoracler commented Apr 28, 2026

CI failures:

  • Step Compiled with_mypyc: As before, this is fixed in https://github.com/bzoracler/ast_serialize/blob/566ddc362930a821549ca5fbb0d7d0f3bd88eb6e/ast_serialize.pyi#L26
  • These errors should be fixed using the updated binaries built from the changes in Allow parsing source code directly mypyc/ast_serialize#54:
    • E TypeError: argument 'source': 'bytes' object is not an instance of 'str'
    • E ValueError: Source parsing is not supported yet for test_trivial_binary_data_from_string_source
    • E ValueError: Source parsing is not supported yet for testPackageRootMultipleParallel, testParallelRunWithSyntaxError, testCheckingStubPackagesWorksInParallelMode, and job Parallel tests with .*: I believe like the code path for parallel checking causes both the source code and a file name to be passed to parsing functions? I think the tests passed before because either the source argument was not passed or the file_exists check resulted in False (and we fell back to the old parser when the file didn't exist).

Is it possible for CI to run a non-released version of ast_serialize?

@bzoracler bzoracler marked this pull request as ready for review April 28, 2026 04:48
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