Skip to content

Commit b3d4da3

Browse files
committed
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'.
1 parent 809eed4 commit b3d4da3

File tree

2 files changed

+186
-171
lines changed

2 files changed

+186
-171
lines changed

Lib/test/test_clinic.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2390,7 +2390,7 @@ def test_state_func_docstring_no_summary(self):
23902390
docstring1
23912391
docstring2
23922392
"""
2393-
self.expect_failure(block, err, lineno=0)
2393+
self.expect_failure(block, err, lineno=3)
23942394

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

24092409

24102410
class ClinicExternalTest(TestCase):

0 commit comments

Comments
 (0)