python / python/mypy

Syntax errors in the Python source files give exit code 2 when they should give 1 as exit code

Open
#19,807 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug topic-error-reporting
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

Syntax errors in the Python source files give 2 when they should give 1, as exit code. 1 means the files have a problem, while 2 should mean a usage error.

I haven't verified myself where this is a problem; at the moment I'm relying on second-hand info from @sterliakov

Originally posted by @wyattscarpenter in #19548

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

No source file, test, or entry point is named. Start by reproducing the reported exit-code difference with a Python source file containing a syntax error, then trace the CLI path that classifies the result. Done means syntax errors return exit code 1 while usage errors continue to return 2, with a regression test covering the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.