]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-104683: Rework Argument Clinic error handling (#107551)
authorErlend E. Aasland <erlend@python.org>
Thu, 3 Aug 2023 00:00:06 +0000 (02:00 +0200)
committerGitHub <noreply@github.com>
Thu, 3 Aug 2023 00:00:06 +0000 (00:00 +0000)
commit1cd479c6d371605e9689c88ae1789dbcbceb2da0
tree920479f62bc515a3289bc389c9b5ab77730c51c8
parent017f047183fa33743f7e36c5c360f5c670032be3
gh-104683: Rework Argument Clinic error handling (#107551)

Introduce ClinicError, and use it in fail(). The CLI runs main(),
catches ClinicError, formats the error message, prints to stderr
and exits with an error.

As a side effect, this refactor greatly improves the accuracy of
reported line numbers in case of error.

Also, adapt the test suite to work with ClinicError.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Lib/test/test_clinic.py
Tools/clinic/clinic.py