diff options
author | Larry Hastings <larry@hastings.org> | 2014-02-09 06:15:29 (GMT) |
---|---|---|
committer | Larry Hastings <larry@hastings.org> | 2014-02-09 06:15:29 (GMT) |
commit | 2623c8c23cead505a78ec416072223552e94727e (patch) | |
tree | 9ac129d693fd98eb33d548bc836d89e006bbb937 /Modules/_testcapimodule.c | |
parent | 09f08fe2483aaefba367c6b0b4654c3490a32c42 (diff) | |
download | cpython-2623c8c23cead505a78ec416072223552e94727e.zip cpython-2623c8c23cead505a78ec416072223552e94727e.tar.gz cpython-2623c8c23cead505a78ec416072223552e94727e.tar.bz2 |
Issue #20530: Argument Clinic's signature format has been revised again.
The new syntax is highly human readable while still preventing false
positives. The syntax also extends Python syntax to denote "self" and
positional-only parameters, allowing inspect.Signature objects to be
totally accurate for all supported builtins in Python 3.4.
Diffstat (limited to 'Modules/_testcapimodule.c')
-rw-r--r-- | Modules/_testcapimodule.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 260e53d..9e81787 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -2851,26 +2851,40 @@ PyDoc_STRVAR(docstring_no_signature, ); PyDoc_STRVAR(docstring_with_invalid_signature, -"sig= (module, boo)\n" +"docstring_with_invalid_signature($module, /, boo)\n" "\n" "This docstring has an invalid signature." ); +PyDoc_STRVAR(docstring_with_invalid_signature2, +"docstring_with_invalid_signature2($module, /, boo)\n" +"\n" +"--\n" +"\n" +"This docstring also has an invalid signature." +); + PyDoc_STRVAR(docstring_with_signature, -"sig=(module, sig)\n" +"docstring_with_signature($module, /, sig)\n" +"--\n" +"\n" "This docstring has a valid signature." ); PyDoc_STRVAR(docstring_with_signature_and_extra_newlines, -"sig=(module, parameter)\n" -"\n" +"docstring_with_signature_and_extra_newlines($module, /, parameter)\n" +"--\n" "\n" "\n" "This docstring has a valid signature and some extra newlines." ); PyDoc_STRVAR(docstring_with_signature_with_defaults, -"sig=(module, s='avocado', b=b'bytes', d=3.14, i=35, n=None, t=True, f=False, local=the_number_three, sys=sys.maxsize, exp=sys.maxsize - 1)\n" +"docstring_with_signature_with_defaults(module, s='avocado',\n" +" b=b'bytes', d=3.14, i=35, n=None, t=True, f=False,\n" +" local=the_number_three, sys=sys.maxsize,\n" +" exp=sys.maxsize - 1)\n" +"--\n" "\n" "\n" "\n" @@ -3090,6 +3104,9 @@ static PyMethodDef TestMethods[] = { {"docstring_with_invalid_signature", (PyCFunction)test_with_docstring, METH_NOARGS, docstring_with_invalid_signature}, + {"docstring_with_invalid_signature2", + (PyCFunction)test_with_docstring, METH_NOARGS, + docstring_with_invalid_signature2}, {"docstring_with_signature", (PyCFunction)test_with_docstring, METH_NOARGS, docstring_with_signature}, |