8000 gh-113317: Remove Argument Clinic global variable 'clinic' by vstinner · Pull Request #114752 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-113317: Remove Argument Clinic global variable 'clinic' #114752

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-113317: Remove Argument Clinic global variable 'clinic'
* Add Clinic.warn() and Clinic.fail() methods.
* Add filename parameter to BlockParser constructor.
* Add BlockParser.fail() method.
* Add DSLParser.fail() method.
* Pass lineno parameter to DSLParser.format_docstring(): more
  accurate error reporting.
* Convert a few DSLParser static methods to regular method to be able
  to call self.fail().
* Language.render() clinic parameter is now required: None is no
  longer accepted.
* Remove warn() function.
* Remove global variable 'clinic'.

fail() and warn() methods get filename and line number from the
instance on which the method is called, rather than relying on a
global variable 'clinic'.
  • Loading branch information
vstinner committed Jan 30, 2024
commit b3d4da38307b74bd956e6affd0caffde218fb743
4 changes: 2 additions & 2 deletions Lib/test/test_clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2390,7 +2390,7 @@ def test_state_func_docstring_no_summary(self):
docstring1
docstring2
"""
self.expect_failure(block, err, lineno=0)
self.expect_failure(block, err, lineno=3)

def test_state_func_docstring_only_one_param_template(self):
err = "You may not specify {parameters} more than once in a docstring!"
Expand All @@ -2404,7 +2404,7 @@ def test_state_func_docstring_only_one_param_template(self):
these are the params again:
{parameters}
"""
self.expect_failure(block, err, lineno=0)
self.expect_failure(block, err, lineno=7)


class ClinicExternalTest(TestCase):
Expand Down
Loading
0