python / python/cpython

`pymain_run_file_obj`: validate file type before reading

Open
#142,570 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

extension-modules type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

pymain_run_file_obj attempts to skip the source first line before verifying that the file is not a directory.
https://github.com/python/cpython/blob/4eab90f4f33e1c072faf9d2e231d310bdc90ec97/Modules/main.c#L382-L401

Linked PRs
  • gh-142709

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Modules/main.c at the cited pymain_run_file_obj code around lines 382-401 and inspect the order of the file-type check and source-line handling. Done means the file type is validated before the source is read or skipped; review linked PR gh-142709 before starting.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.