Skip to content

Commit

Permalink
pythongh-122943: Remove the object converter for var-positional param…
Browse files Browse the repository at this point in the history
…eter (pythonGH-126560)
  • Loading branch information
serhiy-storchaka authored Nov 8, 2024
1 parent c222441 commit 06a8b0b
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 87 deletions.
24 changes: 12 additions & 12 deletions Lib/test/clinic.test.c
Original file line number Diff line number Diff line change
Expand Up @@ -4135,7 +4135,7 @@ test_vararg_and_posonly
a: object
/
*args: object
*args: tuple
[clinic start generated code]*/

Expand Down Expand Up @@ -4176,7 +4176,7 @@ test_vararg_and_posonly(PyObject *module, PyObject *const *args, Py_ssize_t narg

static PyObject *
test_vararg_and_posonly_impl(PyObject *module, PyObject *a, PyObject *args)
/*[clinic end generated code: output=0c11c475e240869e input=9cfa748bbff09877]*/
/*[clinic end generated code: output=0c11c475e240869e input=2c49a482f68545c0]*/

PyDoc_STRVAR(test_vararg_and_posonly__doc__,
"test_vararg_and_posonly($module, a, /, *args)\n"
Expand Down Expand Up @@ -4221,7 +4221,7 @@ test_vararg
a: object
*args: object
*args: tuple
[clinic start generated code]*/

Expand Down Expand Up @@ -4292,14 +4292,14 @@ test_vararg(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject

static PyObject *
test_vararg_impl(PyObject *module, PyObject *a, PyObject *args)
/*[clinic end generated code: output=e7d7da6a7e008125 input=81d33815ad1bae6e]*/
/*[clinic end generated code: output=e7d7da6a7e008125 input=7448995636d9186a]*/

/*[clinic input]
test_vararg_with_default
a: object
*args: object
*args: tuple
b: bool = False
[clinic start generated code]*/
Expand Down Expand Up @@ -4383,13 +4383,13 @@ test_vararg_with_default(PyObject *module, PyObject *const *args, Py_ssize_t nar
static PyObject *
test_vararg_with_default_impl(PyObject *module, PyObject *a, PyObject *args,
int b)
/*[clinic end generated code: output=46781f9920ecedcf input=6e110b54acd9b22d]*/
/*[clinic end generated code: output=46781f9920ecedcf input=3a0f9f557ce1f712]*/

/*[clinic input]
test_vararg_with_only_defaults
*args: object
*args: tuple
b: bool = False
c: object = ' '
Expand Down Expand Up @@ -4477,7 +4477,7 @@ test_vararg_with_only_defaults(PyObject *module, PyObject *const *args, Py_ssize
static PyObject *
test_vararg_with_only_defaults_impl(PyObject *module, PyObject *args, int b,
PyObject *c)
/*[clinic end generated code: output=d03daf5067039c03 input=fa56a709a035666e]*/
/*[clinic end generated code: output=d03daf5067039c03 input=6983e66817f82924]*/

/*[clinic input]
test_paramname_module
Expand Down Expand Up @@ -4978,7 +4978,7 @@ Test_an_metho_arg_named_arg_impl(TestObj *self, int arg)

/*[clinic input]
Test.__init__
*args: object
*args: tuple
Varargs init method. For example, nargs is translated to PyTuple_GET_SIZE.
[clinic start generated code]*/
Expand Down Expand Up @@ -5016,7 +5016,7 @@ Test___init__(PyObject *self, PyObject *args, PyObject *kwargs)

static int
Test___init___impl(TestObj *self, PyObject *args)
/*[clinic end generated code: output=f172425cec373cd6 input=2a8bd0033c9ac772]*/
/*[clinic end generated code: output=f172425cec373cd6 input=4b8388c4e6baab6f]*/

PyDoc_STRVAR(Test___init____doc__,
"Test(*args)\n"
Expand Down Expand Up @@ -5054,7 +5054,7 @@ Test___init__(PyObject *self, PyObject *args, PyObject *kwargs)
/*[clinic input]
@classmethod
Test.__new__
*args: object
*args: tuple
Varargs new method. For example, nargs is translated to PyTuple_GET_SIZE.
[clinic start generated code]*/
Expand Down Expand Up @@ -5091,7 +5091,7 @@ Test(PyTypeObject *type, PyObject *args, PyObject *kwargs)

static PyObject *
Test_impl(PyTypeObject *type, PyObject *args)
/*[clinic end generated code: output=ee1e8892a67abd4a input=70ad829df3dd9b84]*/
/*[clinic end generated code: output=ee1e8892a67abd4a input=a8259521129cad20]*/

PyDoc_STRVAR(Test__doc__,
"Test(*args)\n"
Expand Down
24 changes: 12 additions & 12 deletions Lib/test/test_clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def test_star_after_vararg(self):
my_test_func
pos_arg: object
*args: object
*args: tuple
*
kw_arg: object
[clinic start generated code]*/
Expand All @@ -353,7 +353,7 @@ def test_vararg_after_star(self):
pos_arg: object
*
*args: object
*args: tuple
kw_arg: object
[clinic start generated code]*/
"""
Expand Down Expand Up @@ -1816,7 +1816,7 @@ def test_parameters_required_after_depr_star3(self):
foo.bar
a: int
* [from 3.14]
*args: object
*args: tuple
b: int
Docstring.
"""
Expand Down Expand Up @@ -1844,7 +1844,7 @@ def test_depr_star_must_come_before_vararg(self):
module foo
foo.bar
a: int
*args: object
*args: tuple
* [from 3.14]
b: int
Docstring.
Expand Down Expand Up @@ -1980,7 +1980,7 @@ def test_slash_after_vararg(self):
foo.bar
x: int
y: int
*args: object
*args: tuple
z: int
/
"""
Expand Down Expand Up @@ -2031,7 +2031,7 @@ def test_vararg_must_come_after_depr_slash(self):
module foo
foo.bar
a: int
*args: object
*args: tuple
/ [from 3.14]
b: int
Docstring.
Expand Down Expand Up @@ -2070,8 +2070,8 @@ def test_parameters_no_more_than_one_vararg(self):
block = """
module foo
foo.bar
*vararg1: object
*vararg2: object
*vararg1: tuple
*vararg2: tuple
"""
self.expect_failure(block, err, lineno=3)

Expand Down Expand Up @@ -2156,11 +2156,11 @@ def test_indent_stack_no_tabs(self):
block = """
module foo
foo.bar
*vararg1: object
\t*vararg2: object
*vararg1: tuple
\t*vararg2: tuple
"""
err = ("Tab characters are illegal in the Clinic DSL: "
r"'\t*vararg2: object'")
r"'\t*vararg2: tuple'")
self.expect_failure(block, err)

def test_indent_stack_illegal_outdent(self):
Expand Down Expand Up @@ -2505,7 +2505,7 @@ def test_vararg_cannot_take_default_value(self):
err = "Vararg can't take a default value!"
block = """
fn
*args: object = None
*args: tuple = None
"""
self.expect_failure(block, err, lineno=1)

Expand Down
Loading

0 comments on commit 06a8b0b

Please sign in to comment.