GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Avoid eagerly reading sources for singe-file batches by ilevkivskyi · Pull Request #21996 · python/mypy

Conversation

@ilevkivskyi

@ilevkivskyi ilevkivskyi commented Sep 16, 2026

Copy link
Copy Markdown
Member

Fixes #21514

Currently, parse_file() (that is still used with parallel parsing if there is only one file in batch) eagerly reads file, computes hash, and parses inline configuration. This is not needed, since Ruff parser already does this. This PR unifies the logic in parse_file() with parse_all() that already avoids this overhead.

Note that few tests changed because Ruff parser ignores # coding: declaration and always uses UTF-8.

cc @JukkaL

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ilevkivskyi
Avoid eagerly reading sources for singe-file batches
37e4f7a
@github-actions

This comment has been minimized.

Sign in to view
@ilevkivskyi
Keep better error for parsing .pyd files
dd12b31
@github-actions

github-actions Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

JukkaL
JukkaL approved these changes Sep 16, 2026
View reviewed changes
@ilevkivskyi
ilevkivskyi merged commit 4c5c588 into python:master Sep 16, 2026
25 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@ilevkivskyi
ilevkivskyi deleted the fix-parse-1 branch September 16, 2026 16:19
@inchang-ing inchang-ing mentioned this pull request Sep 27, 2026
Report a clean error for files that are not valid UTF-8 #22056
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@JukkaL JukkaL JukkaL approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Native parser reads file eagerly if there is one file in parse batch

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@ilevkivskyi @JukkaL
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.