Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add a test for * [from ...] with not inlined parsing code
  • Loading branch information
serhiy-storchaka committed Aug 17, 2023
commit e271834f983054e9b500ba34a289530671b5a9bc
13 changes: 13 additions & 0 deletions Lib/test/test_clinic.py
Comment thread
erlend-aasland marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -3276,6 +3276,19 @@ def test_depr_star_pos2_len2_with_kwd(self):
check("a", "b", "c", d=0, e=0)
check("a", "b", "c", "d", e=0)

def test_depr_star_noinline(self):
fn = ac_tester.depr_star_noinline
self.assertRaises(TypeError, fn, "a")
fn(a="a", b="b")
fn(a="a", b="b", c="c")
fn("a", b="b")
fn("a", b="b", c="c")
check = partial(self.check_depr_star, "'b' and 'c'", fn)
check("a", "b")
check("a", "b", "c")
check("a", "b", c="c")
self.assertRaises(TypeError, fn, "a", "b", "c", "d")

def test_depr_kwd_required_1(self):
fn = ac_tester.depr_kwd_required_1
fn("a", "b")
Expand Down
21 changes: 21 additions & 0 deletions Modules/_testclinic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1500,6 +1500,26 @@ depr_star_pos2_len2_with_kwd_impl(PyObject *module, PyObject *a, PyObject *b,
}


/*[clinic input]
depr_star_noinline
a: object
* [from 3.14]
b: object
c: object = None
*
# Force to use _PyArg_ParseStackAndKeywords.
d: str(accept={str, robuffer}, zeroes=True) = ''
[clinic start generated code]*/

static PyObject *
depr_star_noinline_impl(PyObject *module, PyObject *a, PyObject *b,
PyObject *c, const char *d, Py_ssize_t d_length)
/*[clinic end generated code: output=cc27dacf5c2754af input=d36cc862a2daef98]*/
{
Py_RETURN_NONE;
}


/*[clinic input]
depr_kwd_required_1
a: object
Expand Down Expand Up @@ -1698,6 +1718,7 @@ static PyMethodDef tester_methods[] = {
DEPR_STAR_POS2_LEN1_METHODDEF
DEPR_STAR_POS2_LEN2_METHODDEF
DEPR_STAR_POS2_LEN2_WITH_KWD_METHODDEF
DEPR_STAR_NOINLINE_METHODDEF
DEPR_KWD_REQUIRED_1_METHODDEF
DEPR_KWD_REQUIRED_2_METHODDEF
DEPR_KWD_OPTIONAL_1_METHODDEF
Expand Down
83 changes: 82 additions & 1 deletion Modules/clinic/_testclinic_depr_star.c.h
Comment thread
erlend-aasland marked this conversation as resolved.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.