Skip to content

gh-149183: avoid MemoryError in tokenize#149445

Draft
KowalskiThomas wants to merge 1 commit intopython:mainfrom
KowalskiThomas:kowalski/fix-avoid-memoryerror-in-tokenize
Draft

gh-149183: avoid MemoryError in tokenize#149445
KowalskiThomas wants to merge 1 commit intopython:mainfrom
KowalskiThomas:kowalski/fix-avoid-memoryerror-in-tokenize

Conversation

@KowalskiThomas
Copy link
Copy Markdown
Contributor

@KowalskiThomas KowalskiThomas commented May 6, 2026

@read-the-docs-community
Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #32556385 | 📁 Comparing 10e5ccf against main (970b043)

  🔍 Preview build  

65 files changed · ± 64 modified · - 1 deleted

± Modified

- Deleted

@StanFromIreland StanFromIreland changed the title fix: avoid MemoryError in tokenize gh-149183: avoid MemoryError in tokenize May 6, 2026
Comment thread Parser/lexer/lexer.c
Comment on lines +124 to +125
Py_ssize_t expr_len = tok_mode->last_expr_size - tok_mode->last_expr_end;
if (expr_len < 0) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Put this check before the declaration of res

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.

2 participants