Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 59fd3f5

Browse files
gbaian10Lee-W
authored andcommitted
refactor: remove TypeError handling since Python >=3.9 is required
Since the project requires Python >=3.9, argparse only raises SystemExit when non-existent commands are provided, making TypeError handling unnecessary.
1 parent 3a88f03 commit 59fd3f5

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

‎commitizen/cli.py‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -632,11 +632,8 @@ def main():
632632
# This is for the command required constraint in 2.0
633633
try:
634634
args, unknown_args = parser.parse_known_args()
635-
except (TypeError, SystemExit) as e:
636-
# https://github.com/commitizen-tools/commitizen/issues/429
637-
# argparse raises TypeError when non exist command is provided on Python < 3.9
638-
# but raise SystemExit with exit code == 2 on Python 3.9
639-
if isinstance(e, TypeError) or e.code == 2:
635+
except SystemExit as e:
636+
if e.code == 2:
640637
raise NoCommandFoundError()
641638
raise e
642639

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /