diff options
author | Alex Waygood <Alex.Waygood@Gmail.com> | 2023-08-08 12:12:49 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-08 12:12:49 (GMT) |
commit | 7c5153de5a2bd2c886173a317f116885a925cfce (patch) | |
tree | 91d0b7fc4f83dae5fee488702bbb2911717394a8 /Tools/clinic | |
parent | 5df8b0d5c71a168a94fb64ad9d8190377b6e73da (diff) | |
download | cpython-7c5153de5a2bd2c886173a317f116885a925cfce.zip cpython-7c5153de5a2bd2c886173a317f116885a925cfce.tar.gz cpython-7c5153de5a2bd2c886173a317f116885a925cfce.tar.bz2 |
gh-106368: Argument clinic: add tests for more failure paths (#107731)
Diffstat (limited to 'Tools/clinic')
-rwxr-xr-x | Tools/clinic/clinic.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index c6cf43a..0b336d9 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -5207,13 +5207,14 @@ class DSLParser: # but at least make an attempt at ensuring it's a valid expression. try: value = eval(default) - if value is unspecified: - fail("'unspecified' is not a legal default value!") except NameError: pass # probably a named constant except Exception as e: fail("Malformed expression given as default value " f"{default!r} caused {e!r}") + else: + if value is unspecified: + fail("'unspecified' is not a legal default value!") if bad: fail(f"Unsupported expression as default value: {default!r}") |