8000 gh-96002: Add functional test for Argument Clinic by colorfulappl · Pull Request #96178 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-96002: Add functional test for Argument Clinic #96178

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

Merged
merged 35 commits into from
Nov 21, 2022
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f00bb03
Support functional test for Argument Clinic
colorfulappl Aug 22, 2022
a59e304
📜🤖 Added by blurb_it.
blurb-it[bot] Aug 22, 2022
2bd331e
Revert "Support functional test for Argument Clinic"
colorfulappl Aug 23, 2022
fac5b77
Add functional test for Argument Clinic
colorfulappl Aug 23, 2022
962434c
Add testcases written in C
colorfulappl Aug 23, 2022
b93b2ae
Rename _testclinicfunctionality.c to _testclinic.c
colorfulappl Oct 25, 2022
35c5f13
Add _testclinic to stdlib IGNORE list
colorfulappl Oct 25, 2022
86703de
Merge TestClinicFunctionalityC class into TestClinicFunctionality
colorfulappl Oct 25, 2022
e66d60b
Format code in _testclinic.c
colorfulappl Oct 25, 2022
f1fb377
Merge test_clinic_functionality.py into test_clinic.py
colorfulappl Oct 26, 2022
449c8fe
Simplify testcases
colorfulappl Oct 26, 2022
1553574
Merge branch 'main' into test_clinic_functionality
colorfulappl Oct 26, 2022
81fe77b
Add more testcases
colorfulappl Oct 28, 2022
7c269d0
Rename class TestClinicFunctionality to ClinicFunctionalTest
colorfulappl Nov 1, 2022
a3a3455
Fix UB problem
colorfulappl Nov 2, 2022
80ba71a
Fix refleaks
colorfulappl Nov 4, 2022
cf77785
Clean code
colorfulappl Nov 4, 2022
10ce3c7
Add PoC of GH-99233
colorfulappl Nov 8, 2022
2cc6c0a
Add PoC of GH-99240
colorfulappl Nov 8, 2022
6a2d334
Delete test cases which fail this test
colorfulappl Nov 10, 2022
d82ef72
Merge branch 'main' into test_clinic_functionality
colorfulappl Nov 10, 2022
b27b43d
8000 Rerun `make regen-all`
colorfulappl Nov 10, 2022
1cae160
Fix leaking
colorfulappl Nov 13, 2022
fb6d3be
Fix code style
colorfulappl Nov 13, 2022
fd1ed14
Merge branch 'main' into test_clinic_functionality
colorfulappl Nov 13, 2022
e82c88a
Rerun `make regen-all`
colorfulappl Nov 13, 2022
598568c
Fix object leaking and code style
colorfulappl Nov 14, 2022
dd43f24
Change argument release order
colorfulappl Nov 14, 2022
325e35b
Rename macro
colorfulappl Nov 14, 2022
967dda6
Update news
colorfulappl Nov 14, 2022
d568683
Fix object leaking
colorfulappl Nov 14, 2022
ce337e8
Remove unnecessary logic
colorfulappl Nov 15, 2022
3314465
Merge branch 'main' into test_clinic_functionality
colorfulappl Nov 15, 2022
68277c5
Merge branch 'main' into test_clinic_functionality
colorfulappl Nov 15, 2022
da0789f
Merge branch 'main' into test_clinic_functionality
colorfulappl Nov 17, 2022
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
Rename macro
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
  • Loading branch information
colorfulappl and erlend-aasland committed Nov 14, 2022
commit 325e35bc1abdb2b10d3838a018d889655facdba7
122 changes: 61 additions & 61 deletions Modules/_testclinic.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pack_arguments_newref(int argc, ...)

/* Pack arguments to a tuple, all the arguments' refcounts should be increased before passing in.
* Do not accept NULL arguments unless error occurs. */
#define PACK_ARGUMENTS(argc, ...) do { \
#define RETURN_PACKED_ARGS(argc, ...) do { \
assert(!PyErr_Occurred()); \
PyObject *out[argc] = {NULL,}; \
for (int _i = 0; _i < argc; _i++) { \
Expand Down Expand Up @@ -222,21 +222,21 @@ char_converter_impl(PyObject *module, char a, char b, char c, char d, char e,
char m, char n)
/*[clinic end generated code: output=f929dbd2e55a9871 input=b601bc5bc7fe85e3]*/
{
PACK_ARGUMENTS(14,
PyLong_FromUnsignedLong((unsigned char)a),
PyLong_FromUnsignedLong((unsigned char)b),
PyLong_FromUnsignedLong((unsigned char)c),
PyLong_FromUnsignedLong((unsigned char)d),
PyLong_FromUnsignedLong((unsigned char)e),
PyLong_FromUnsignedLong((unsigned char)f),
PyLong_FromUnsignedLong((unsigned char)g),
PyLong_FromUnsignedLong((unsigned char)h),
PyLong_FromUnsignedLong((unsigned char)i),
PyLong_FromUnsignedLong((unsigned char)j),
PyLong_FromUnsignedLong((unsigned char)k),
PyLong_FromUnsignedLong((unsigned char)l),
PyLong_FromUnsignedLong((unsigned char)m),
PyLong_FromUnsignedLong((unsigned char)n));
RETURN_PACKED_ARGS(14,
PyLong_FromUnsignedLong((unsigned char)a),
PyLong_FromUnsignedLong((unsigned char)b),
PyLong_FromUnsignedLong((unsigned char)c),
PyLong_FromUnsignedLong((unsigned char)d),
PyLong_FromUnsignedLong((unsigned char)e),
PyLong_FromUnsignedLong((unsigned char)f),
PyLong_FromUnsignedLong((unsigned char)g),
PyLong_FromUnsignedLong((unsigned char)h),
PyLong_FromUnsignedLong((unsigned char)i),
PyLong_FromUnsignedLong((unsigned char)j),
PyLong_FromUnsignedLong((unsigned char)k),
PyLong_FromUnsignedLong((unsigned char)l),
PyLong_FromUnsignedLong((unsigned char)m),
PyLong_FromUnsignedLong((unsigned char)n));
}


Expand All @@ -255,10 +255,10 @@ unsigned_char_converter_impl(PyObject *module, unsigned char a,
unsigned char b, unsigned char c)
/*[clinic end generated code: output=490af3b39ce0b199 input=e859502fbe0b3185]*/
{
PACK_ARGUMENTS(3,
PyLong_FromUnsignedLong(a),
PyLong_FromUnsignedLong(b),
PyLong_FromUnsignedLong(c));
RETURN_PACKED_ARGS(3,
PyLong_FromUnsignedLong(a),
PyLong_FromUnsignedLong(b),
PyLong_FromUnsignedLong(c));
}


Expand All @@ -274,7 +274,7 @@ static PyObject *
short_converter_impl(PyObject *module, short a)
/*[clinic end generated code: output=1ebb7ddb64248988 input=b4e2309a66f650ae]*/
{
PACK_ARGUMENTS(1, PyLong_FromLong(a));
RETURN_PACKED_ARGS(1, PyLong_FromLong(a));
}


Expand All @@ -293,10 +293,10 @@ unsigned_short_converter_impl(PyObject *module, unsigned short a,
unsigned short b, unsigned short c)
/*[clinic end generated code: output=5f92cc72fc8707a7 input=9d15cd11e741d0c6]*/
{
PACK_ARGUMENTS(3,
PyLong_FromUnsignedLong(a),
PyLong_FromUnsignedLong(b),
PyLong_FromUnsignedLong(c));
RETURN_PACKED_ARGS(3,
PyLong_FromUnsignedLong(a),
PyLong_FromUnsignedLong(b),
PyLong_FromUnsignedLong(c));
}


Expand All @@ -314,10 +314,10 @@ static PyObject *
int_converter_impl(PyObject *module, int a, int b, int c)
/*[clinic end generated code: output=8e56b59be7d0c306 input=a1dbc6344853db7a]*/
{
PACK_ARGUMENTS(3,
PyLong_FromLong(a),
PyLong_FromLong(b),
PyLong_FromLong(c));
RETURN_PACKED_ARGS(3,
PyLong_FromLong(a),
PyLong_FromLong(b),
PyLong_FromLong(c));
}


Expand All @@ -336,10 +336,10 @@ unsigned_int_converter_impl(PyObject *module, unsigned int a, unsigned int b,
unsigned int c)
/*[clinic end generated code: output=399a57a05c494cc7 input=8427ed9a3f96272d]*/
{
PACK_ARGUMENTS(3,
PyLong_FromUnsignedLong(a),
PyLong_FromUnsignedLong(b),
PyLong_FromUnsignedLong(c));
RETURN_PACKED_ARGS(3,
PyLong_FromUnsignedLong(a),
PyLong_FromUnsignedLong(b),
PyLong_FromUnsignedLong(c));
}


Expand All @@ -355,7 +355,7 @@ static PyObject *
long_converter_impl(PyObject *module, long a)
/*[clinic end generated code: output=9663d936a652707a input=84ad0ef28f24bd85]*/
{
PACK_ARGUMENTS(1, PyLong_FromLong(a));
RETURN_PACKED_ARGS(1, PyLong_FromLong(a));
}


Expand All @@ -374,10 +374,10 @@ unsigned_long_converter_impl(PyObject *module, unsigned long a,
unsigned long b, unsigned long c)
/*[clinic end generated code: output=120b82ea9ebd93a8 input=440dd6f1817f5d91]*/
{
PACK_ARGUMENTS(3,
PyLong_FromUnsignedLong(a),
PyLong_FromUnsignedLong(b),
PyLong_FromUnsignedLong(c));
RETURN_PACKED_ARGS(3,
PyLong_FromUnsignedLong(a),
PyLong_FromUnsignedLong(b),
PyLong_FromUnsignedLong(c));
}


Expand All @@ -393,7 +393,7 @@ static PyObject *
long_long_converter_impl(PyObject *module, long long a)
/*[clinic end generated code: output=5fb5f2220770c3e1 input=730fcb3eecf4d993]*/
{
PACK_ARGUMENTS(1, PyLong_FromLongLong(a));
RETURN_PACKED_ARGS(1, PyLong_FromLongLong(a));
}


Expand All @@ -412,10 +412,10 @@ unsigned_long_long_converter_impl(PyObject *module, unsigned long long a,
unsigned long long b, unsigned long long c)
/*[clinic end generated code: output=65b7273e63501762 input=300737b0bdb230e9]*/
{
PACK_ARGUMENTS(3,
PyLong_FromUnsignedLongLong(a),
PyLong_FromUnsignedLongLong(b),
PyLong_FromUnsignedLongLong(c));
RETURN_PACKED_ARGS(3,
PyLong_FromUnsignedLongLong(a),
PyLong_FromUnsignedLongLong(b),
PyLong_FromUnsignedLongLong(c));
}


Expand All @@ -434,10 +434,10 @@ py_ssize_t_converter_impl(PyObject *module, Py_ssize_t a, Py_ssize_t b,
Py_ssize_t c)
/*[clinic end generated code: output=ce252143e0ed0372 input=76d0f342e9317a1f]*/
{
PACK_ARGUMENTS(3,
PyLong_FromSsize_t(a),
PyLong_FromSsize_t(b),
PyLong_FromSsize_t(c));
RETURN_PACKED_ARGS(3,
PyLong_FromSsize_t(a),
PyLong_FromSsize_t(b),
PyLong_FromSsize_t(c));
}


Expand All @@ -456,10 +456,10 @@ slice_index_converter_impl(PyObject *module, Py_ssize_t a, Py_ssize_t b,
Py_ssize_t c)
/*[clinic end generated code: output=923c6cac77666a6b input=64f99f3f83265e47]*/
{
PACK_ARGUMENTS(3,
PyLong_FromSsize_t(a),
PyLong_FromSsize_t(b),
PyLong_FromSsize_t(c));
RETURN_PACKED_ARGS(3,
PyLong_FromSsize_t(a),
PyLong_FromSsize_t(b),
PyLong_FromSsize_t(c));
}


Expand All @@ -475,7 +475,7 @@ static PyObject *
size_t_converter_impl(PyObject *module, size_t a)
/*[clinic end generated code: output=412b5b7334ab444d input=83ae7d9171fbf208]*/
{
PACK_ARGUMENTS(1, PyLong_FromSize_t(a));
RETURN_PACKED_ARGS(1, PyLong_FromSize_t(a));
}


Expand All @@ -491,7 +491,7 @@ static PyObject *
float_converter_impl(PyObject *module, float a)
/*[clinic end generated code: output=1c98f64f2cf1d55c input=a625b59ad68047d8]*/
{
PACK_ARGUMENTS(1, PyFloat_FromDouble((double)a));
RETURN_PACKED_ARGS(1, PyFloat_FromDouble((double)a));
}


Expand All @@ -507,7 +507,7 @@ static PyObject *
double_converter_impl(PyObject *module, double a)
/*[clinic end generated code: output=a4e8532d284d035d input=098df188f24e7c62]*/
{
PACK_ARGUMENTS(1, PyFloat_FromDouble(a));
RETURN_PACKED_ARGS(1, PyFloat_FromDouble(a));
}


Expand All @@ -523,7 +523,7 @@ static PyObject *
py_complex_converter_impl(PyObject *module, Py_complex a)
/*[clinic end generated code: output=9e6ca2eb53b14846 input=e9148a8ca1dbf195]*/
{
PACK_ARGUMENTS(1, PyComplex_FromCComplex(a));
RETURN_PACKED_ARGS(1, PyComplex_FromCComplex(a));
}


Expand All @@ -542,10 +542,10 @@ str_converter_impl(PyObject *module, const char *a, const char *b,
const char *c, Py_ssize_t c_length)
/*[clinic end generated code: output=475bea40548c8cd6 input=bff2656c92ee25de]*/
{
PACK_ARGUMENTS(3,
PyUnicode_FromString(a),
PyUnicode_FromString(b),
PyUnicode_FromStringAndSize(c, c_length));
RETURN_PACKED_ARGS(3,
PyUnicode_FromString(a),
PyUnicode_FromString(b),
PyUnicode_FromStringAndSize(c, c_length));
}


Expand Down Expand Up @@ -586,7 +586,7 @@ py_buffer_converter_impl(PyObject *module, Py_buffer *a, Py_buffer *b)
}
PyBuffer_Release(b);

PACK_ARGUMENTS(2, new_a, new_b);
RETURN_PACKED_ARGS(2, new_a, new_b);
}


Expand Down Expand Up @@ -956,4 +956,4 @@ PyInit__testclinic(void)
return PyModule_Create(&_testclinic_module);
}

#undef PACK_ARGUMENTS
#undef RETURN_PACKED_ARGS
0