mirror of https://github.com/python/cpython
gh-96002: Add functional test for Argument Clinic (#96178)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
This commit is contained in:
parent
653e563d80
commit
c450c8c9ed
|
@ -801,6 +801,7 @@ _PyStaticObjects_CheckRefcnt(PyInterpreterState *interp) {
|
|||
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(byteorder));
|
||||
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(bytes));
|
||||
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(bytes_per_sep));
|
||||
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(c));
|
||||
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(c_call));
|
||||
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(c_exception));
|
||||
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(c_return));
|
||||
|
@ -850,6 +851,7 @@ _PyStaticObjects_CheckRefcnt(PyInterpreterState *interp) {
|
|||
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(coro));
|
||||
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(count));
|
||||
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(cwd));
|
||||
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(d));
|
||||
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(data));
|
||||
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(database));
|
||||
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(decode));
|
||||
|
@ -877,6 +879,7 @@ _PyStaticObjects_CheckRefcnt(PyInterpreterState *interp) {
|
|||
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(dst));
|
||||
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(dst_dir_fd));
|
||||
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(duration));
|
||||
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(e));
|
||||
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(effective_ids));
|
||||
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(element_factory));
|
||||
_PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(encode));
|
||||
|
|
|
@ -287,6 +287,7 @@ struct _Py_global_strings {
|
|||
STRUCT_FOR_ID(byteorder)
|
||||
STRUCT_FOR_ID(bytes)
|
||||
STRUCT_FOR_ID(bytes_per_sep)
|
||||
STRUCT_FOR_ID(c)
|
||||
STRUCT_FOR_ID(c_call)
|
||||
STRUCT_FOR_ID(c_exception)
|
||||
STRUCT_FOR_ID(c_return)
|
||||
|
@ -336,6 +337,7 @@ struct _Py_global_strings {
|
|||
STRUCT_FOR_ID(coro)
|
||||
STRUCT_FOR_ID(count)
|
||||
STRUCT_FOR_ID(cwd)
|
||||
STRUCT_FOR_ID(d)
|
||||
STRUCT_FOR_ID(data)
|
||||
STRUCT_FOR_ID(database)
|
||||
STRUCT_FOR_ID(decode)
|
||||
|
@ -363,6 +365,7 @@ struct _Py_global_strings {
|
|||
STRUCT_FOR_ID(dst)
|
||||
STRUCT_FOR_ID(dst_dir_fd)
|
||||
STRUCT_FOR_ID(duration)
|
||||
STRUCT_FOR_ID(e)
|
||||
STRUCT_FOR_ID(effective_ids)
|
||||
STRUCT_FOR_ID(element_factory)
|
||||
STRUCT_FOR_ID(encode)
|
||||
|
|
|
@ -793,6 +793,7 @@ extern "C" {
|
|||
INIT_ID(byteorder), \
|
||||
INIT_ID(bytes), \
|
||||
INIT_ID(bytes_per_sep), \
|
||||
INIT_ID(c), \
|
||||
INIT_ID(c_call), \
|
||||
INIT_ID(c_exception), \
|
||||
INIT_ID(c_return), \
|
||||
|
@ -842,6 +843,7 @@ extern "C" {
|
|||
INIT_ID(coro), \
|
||||
INIT_ID(count), \
|
||||
INIT_ID(cwd), \
|
||||
INIT_ID(d), \
|
||||
INIT_ID(data), \
|
||||
INIT_ID(database), \
|
||||
INIT_ID(decode), \
|
||||
|
@ -869,6 +871,7 @@ extern "C" {
|
|||
INIT_ID(dst), \
|
||||
INIT_ID(dst_dir_fd), \
|
||||
INIT_ID(duration), \
|
||||
INIT_ID(e), \
|
||||
INIT_ID(effective_ids), \
|
||||
INIT_ID(element_factory), \
|
||||
INIT_ID(encode), \
|
||||
|
|
|
@ -480,6 +480,8 @@ _PyUnicode_InitStaticStrings(void) {
|
|||
PyUnicode_InternInPlace(&string);
|
||||
string = &_Py_ID(bytes_per_sep);
|
||||
PyUnicode_InternInPlace(&string);
|
||||
string = &_Py_ID(c);
|
||||
PyUnicode_InternInPlace(&string);
|
||||
string = &_Py_ID(c_call);
|
||||
PyUnicode_InternInPlace(&string);
|
||||
string = &_Py_ID(c_exception);
|
||||
|
@ -578,6 +580,8 @@ _PyUnicode_InitStaticStrings(void) {
|
|||
PyUnicode_InternInPlace(&string);
|
||||
string = &_Py_ID(cwd);
|
||||
PyUnicode_InternInPlace(&string);
|
||||
string = &_Py_ID(d);
|
||||
PyUnicode_InternInPlace(&string);
|
||||
string = &_Py_ID(data);
|
||||
PyUnicode_InternInPlace(&string);
|
||||
string = &_Py_ID(database);
|
||||
|
@ -632,6 +636,8 @@ _PyUnicode_InitStaticStrings(void) {
|
|||
PyUnicode_InternInPlace(&string);
|
||||
string = &_Py_ID(duration);
|
||||
PyUnicode_InternInPlace(&string);
|
||||
string = &_Py_ID(e);
|
||||
PyUnicode_InternInPlace(&string);
|
||||
string = &_Py_ID(effective_ids);
|
||||
PyUnicode_InternInPlace(&string);
|
||||
string = &_Py_ID(element_factory);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# Licensed to the PSF under a contributor agreement.
|
||||
|
||||
from test import support, test_tools
|
||||
from test.support import os_helper
|
||||
from test.support import import_helper, os_helper
|
||||
from unittest import TestCase
|
||||
import collections
|
||||
import inspect
|
||||
|
@ -820,5 +820,397 @@ class ClinicExternalTest(TestCase):
|
|||
self.assertEqual(new_mtime_ns, old_mtime_ns)
|
||||
|
||||
|
||||
ac_tester = import_helper.import_module('_testclinic')
|
||||
|
||||
|
||||
class ClinicFunctionalTest(unittest.TestCase):
|
||||
locals().update((name, getattr(ac_tester, name))
|
||||
for name in dir(ac_tester) if name.startswith('test_'))
|
||||
|
||||
def test_objects_converter(self):
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.objects_converter()
|
||||
self.assertEqual(ac_tester.objects_converter(1, 2), (1, 2))
|
||||
self.assertEqual(ac_tester.objects_converter([], 'whatever class'), ([], 'whatever class'))
|
||||
self.assertEqual(ac_tester.objects_converter(1), (1, None))
|
||||
|
||||
def test_bytes_object_converter(self):
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.bytes_object_converter(1)
|
||||
self.assertEqual(ac_tester.bytes_object_converter(b'BytesObject'), (b'BytesObject',))
|
||||
|
||||
def test_byte_array_object_converter(self):
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.byte_array_object_converter(1)
|
||||
byte_arr = bytearray(b'ByteArrayObject')
|
||||
self.assertEqual(ac_tester.byte_array_object_converter(byte_arr), (byte_arr,))
|
||||
|
||||
def test_unicode_converter(self):
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.unicode_converter(1)
|
||||
self.assertEqual(ac_tester.unicode_converter('unicode'), ('unicode',))
|
||||
|
||||
def test_bool_converter(self):
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.bool_converter(False, False, 'not a int')
|
||||
self.assertEqual(ac_tester.bool_converter(), (True, True, True))
|
||||
self.assertEqual(ac_tester.bool_converter('', [], 5), (False, False, True))
|
||||
self.assertEqual(ac_tester.bool_converter(('not empty',), {1: 2}, 0), (True, True, False))
|
||||
|
||||
def test_char_converter(self):
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.char_converter(1)
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.char_converter(b'ab')
|
||||
chars = [b'A', b'\a', b'\b', b'\t', b'\n', b'\v', b'\f', b'\r', b'"', b"'", b'?', b'\\', b'\000', b'\377']
|
||||
expected = tuple(ord(c) for c in chars)
|
||||
self.assertEqual(ac_tester.char_converter(), expected)
|
||||
chars = [b'1', b'2', b'3', b'4', b'5', b'6', b'7', b'8', b'9', b'0', b'a', b'b', b'c', b'd']
|
||||
expected = tuple(ord(c) for c in chars)
|
||||
self.assertEqual(ac_tester.char_converter(*chars), expected)
|
||||
|
||||
def test_unsigned_char_converter(self):
|
||||
from _testcapi import UCHAR_MAX
|
||||
with self.assertRaises(OverflowError):
|
||||
ac_tester.unsigned_char_converter(-1)
|
||||
with self.assertRaises(OverflowError):
|
||||
ac_tester.unsigned_char_converter(UCHAR_MAX + 1)
|
||||
with self.assertRaises(OverflowError):
|
||||
ac_tester.unsigned_char_converter(0, UCHAR_MAX + 1)
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.unsigned_char_converter([])
|
||||
self.assertEqual(ac_tester.unsigned_char_converter(), (12, 34, 56))
|
||||
self.assertEqual(ac_tester.unsigned_char_converter(0, 0, UCHAR_MAX + 1), (0, 0, 0))
|
||||
self.assertEqual(ac_tester.unsigned_char_converter(0, 0, (UCHAR_MAX + 1) * 3 + 123), (0, 0, 123))
|
||||
|
||||
def test_short_converter(self):
|
||||
from _testcapi import SHRT_MIN, SHRT_MAX
|
||||
with self.assertRaises(OverflowError):
|
||||
ac_tester.short_converter(SHRT_MIN - 1)
|
||||
with self.assertRaises(OverflowError):
|
||||
ac_tester.short_converter(SHRT_MAX + 1)
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.short_converter([])
|
||||
self.assertEqual(ac_tester.short_converter(-1234), (-1234,))
|
||||
self.assertEqual(ac_tester.short_converter(4321), (4321,))
|
||||
|
||||
def test_unsigned_short_converter(self):
|
||||
from _testcapi import USHRT_MAX
|
||||
with self.assertRaises(ValueError):
|
||||
ac_tester.unsigned_short_converter(-1)
|
||||
with self.assertRaises(OverflowError):
|
||||
ac_tester.unsigned_short_converter(USHRT_MAX + 1)
|
||||
with self.assertRaises(OverflowError):
|
||||
ac_tester.unsigned_short_converter(0, USHRT_MAX + 1)
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.unsigned_short_converter([])
|
||||
self.assertEqual(ac_tester.unsigned_short_converter(), (12, 34, 56))
|
||||
self.assertEqual(ac_tester.unsigned_short_converter(0, 0, USHRT_MAX + 1), (0, 0, 0))
|
||||
self.assertEqual(ac_tester.unsigned_short_converter(0, 0, (USHRT_MAX + 1) * 3 + 123), (0, 0, 123))
|
||||
|
||||
def test_int_converter(self):
|
||||
from _testcapi import INT_MIN, INT_MAX
|
||||
with self.assertRaises(OverflowError):
|
||||
ac_tester.int_converter(INT_MIN - 1)
|
||||
with self.assertRaises(OverflowError):
|
||||
ac_tester.int_converter(INT_MAX + 1)
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.int_converter(1, 2, 3)
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.int_converter([])
|
||||
self.assertEqual(ac_tester.int_converter(), (12, 34, 45))
|
||||
self.assertEqual(ac_tester.int_converter(1, 2, '3'), (1, 2, ord('3')))
|
||||
|
||||
def test_unsigned_int_converter(self):
|
||||
from _testcapi import UINT_MAX
|
||||
with self.assertRaises(ValueError):
|
||||
ac_tester.unsigned_int_converter(-1)
|
||||
with self.assertRaises(OverflowError):
|
||||
ac_tester.unsigned_int_converter(UINT_MAX + 1)
|
||||
with self.assertRaises(OverflowError):
|
||||
ac_tester.unsigned_int_converter(0, UINT_MAX + 1)
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.unsigned_int_converter([])
|
||||
self.assertEqual(ac_tester.unsigned_int_converter(), (12, 34, 56))
|
||||
self.assertEqual(ac_tester.unsigned_int_converter(0, 0, UINT_MAX + 1), (0, 0, 0))
|
||||
self.assertEqual(ac_tester.unsigned_int_converter(0, 0, (UINT_MAX + 1) * 3 + 123), (0, 0, 123))
|
||||
|
||||
def test_long_converter(self):
|
||||
from _testcapi import LONG_MIN, LONG_MAX
|
||||
with self.assertRaises(OverflowError):
|
||||
ac_tester.long_converter(LONG_MIN - 1)
|
||||
with self.assertRaises(OverflowError):
|
||||
ac_tester.long_converter(LONG_MAX + 1)
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.long_converter([])
|
||||
self.assertEqual(ac_tester.long_converter(), (12,))
|
||||
self.assertEqual(ac_tester.long_converter(-1234), (-1234,))
|
||||
|
||||
def test_unsigned_long_converter(self):
|
||||
from _testcapi import ULONG_MAX
|
||||
with self.assertRaises(ValueError):
|
||||
ac_tester.unsigned_long_converter(-1)
|
||||
with self.assertRaises(OverflowError):
|
||||
ac_tester.unsigned_long_converter(ULONG_MAX + 1)
|
||||
with self.assertRaises(OverflowError):
|
||||
ac_tester.unsigned_long_converter(0, ULONG_MAX + 1)
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.unsigned_long_converter([])
|
||||
self.assertEqual(ac_tester.unsigned_long_converter(), (12, 34, 56))
|
||||
self.assertEqual(ac_tester.unsigned_long_converter(0, 0, ULONG_MAX + 1), (0, 0, 0))
|
||||
self.assertEqual(ac_tester.unsigned_long_converter(0, 0, (ULONG_MAX + 1) * 3 + 123), (0, 0, 123))
|
||||
|
||||
def test_long_long_converter(self):
|
||||
from _testcapi import LLONG_MIN, LLONG_MAX
|
||||
with self.assertRaises(OverflowError):
|
||||
ac_tester.long_long_converter(LLONG_MIN - 1)
|
||||
with self.assertRaises(OverflowError):
|
||||
ac_tester.long_long_converter(LLONG_MAX + 1)
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.long_long_converter([])
|
||||
self.assertEqual(ac_tester.long_long_converter(), (12,))
|
||||
self.assertEqual(ac_tester.long_long_converter(-1234), (-1234,))
|
||||
|
||||
def test_unsigned_long_long_converter(self):
|
||||
from _testcapi import ULLONG_MAX
|
||||
with self.assertRaises(ValueError):
|
||||
ac_tester.unsigned_long_long_converter(-1)
|
||||
with self.assertRaises(OverflowError):
|
||||
ac_tester.unsigned_long_long_converter(ULLONG_MAX + 1)
|
||||
with self.assertRaises(OverflowError):
|
||||
ac_tester.unsigned_long_long_converter(0, ULLONG_MAX + 1)
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.unsigned_long_long_converter([])
|
||||
self.assertEqual(ac_tester.unsigned_long_long_converter(), (12, 34, 56))
|
||||
self.assertEqual(ac_tester.unsigned_long_long_converter(0, 0, ULLONG_MAX + 1), (0, 0, 0))
|
||||
self.assertEqual(ac_tester.unsigned_long_long_converter(0, 0, (ULLONG_MAX + 1) * 3 + 123), (0, 0, 123))
|
||||
|
||||
def test_py_ssize_t_converter(self):
|
||||
from _testcapi import PY_SSIZE_T_MIN, PY_SSIZE_T_MAX
|
||||
with self.assertRaises(OverflowError):
|
||||
ac_tester.py_ssize_t_converter(PY_SSIZE_T_MIN - 1)
|
||||
with self.assertRaises(OverflowError):
|
||||
ac_tester.py_ssize_t_converter(PY_SSIZE_T_MAX + 1)
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.py_ssize_t_converter([])
|
||||
self.assertEqual(ac_tester.py_ssize_t_converter(), (12, 34, 56))
|
||||
self.assertEqual(ac_tester.py_ssize_t_converter(1, 2, None), (1, 2, 56))
|
||||
|
||||
def test_slice_index_converter(self):
|
||||
from _testcapi import PY_SSIZE_T_MIN, PY_SSIZE_T_MAX
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.slice_index_converter([])
|
||||
self.assertEqual(ac_tester.slice_index_converter(), (12, 34, 56))
|
||||
self.assertEqual(ac_tester.slice_index_converter(1, 2, None), (1, 2, 56))
|
||||
self.assertEqual(ac_tester.slice_index_converter(PY_SSIZE_T_MAX, PY_SSIZE_T_MAX + 1, PY_SSIZE_T_MAX + 1234),
|
||||
(PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX))
|
||||
self.assertEqual(ac_tester.slice_index_converter(PY_SSIZE_T_MIN, PY_SSIZE_T_MIN - 1, PY_SSIZE_T_MIN - 1234),
|
||||
(PY_SSIZE_T_MIN, PY_SSIZE_T_MIN, PY_SSIZE_T_MIN))
|
||||
|
||||
def test_size_t_converter(self):
|
||||
with self.assertRaises(ValueError):
|
||||
ac_tester.size_t_converter(-1)
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.size_t_converter([])
|
||||
self.assertEqual(ac_tester.size_t_converter(), (12,))
|
||||
|
||||
def test_float_converter(self):
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.float_converter([])
|
||||
self.assertEqual(ac_tester.float_converter(), (12.5,))
|
||||
self.assertEqual(ac_tester.float_converter(-0.5), (-0.5,))
|
||||
|
||||
def test_double_converter(self):
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.double_converter([])
|
||||
self.assertEqual(ac_tester.double_converter(), (12.5,))
|
||||
self.assertEqual(ac_tester.double_converter(-0.5), (-0.5,))
|
||||
|
||||
def test_py_complex_converter(self):
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.py_complex_converter([])
|
||||
self.assertEqual(ac_tester.py_complex_converter(complex(1, 2)), (complex(1, 2),))
|
||||
self.assertEqual(ac_tester.py_complex_converter(complex('-1-2j')), (complex('-1-2j'),))
|
||||
self.assertEqual(ac_tester.py_complex_converter(-0.5), (-0.5,))
|
||||
self.assertEqual(ac_tester.py_complex_converter(10), (10,))
|
||||
|
||||
def test_str_converter(self):
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.str_converter(1)
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.str_converter('a', 'b', 'c')
|
||||
with self.assertRaises(ValueError):
|
||||
ac_tester.str_converter('a', b'b\0b', 'c')
|
||||
self.assertEqual(ac_tester.str_converter('a', b'b', 'c'), ('a', 'b', 'c'))
|
||||
self.assertEqual(ac_tester.str_converter('a', b'b', b'c'), ('a', 'b', 'c'))
|
||||
self.assertEqual(ac_tester.str_converter('a', b'b', 'c\0c'), ('a', 'b', 'c\0c'))
|
||||
|
||||
def test_py_buffer_converter(self):
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.py_buffer_converter('a', 'b')
|
||||
self.assertEqual(ac_tester.py_buffer_converter('abc', bytearray([1, 2, 3])), (b'abc', b'\x01\x02\x03'))
|
||||
|
||||
def test_keywords(self):
|
||||
self.assertEqual(ac_tester.keywords(1, 2), (1, 2))
|
||||
self.assertEqual(ac_tester.keywords(1, b=2), (1, 2))
|
||||
self.assertEqual(ac_tester.keywords(a=1, b=2), (1, 2))
|
||||
|
||||
def test_keywords_kwonly(self):
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.keywords_kwonly(1, 2)
|
||||
self.assertEqual(ac_tester.keywords_kwonly(1, b=2), (1, 2))
|
||||
self.assertEqual(ac_tester.keywords_kwonly(a=1, b=2), (1, 2))
|
||||
|
||||
def test_keywords_opt(self):
|
||||
self.assertEqual(ac_tester.keywords_opt(1), (1, None, None))
|
||||
self.assertEqual(ac_tester.keywords_opt(1, 2), (1, 2, None))
|
||||
self.assertEqual(ac_tester.keywords_opt(1, 2, 3), (1, 2, 3))
|
||||
self.assertEqual(ac_tester.keywords_opt(1, b=2), (1, 2, None))
|
||||
self.assertEqual(ac_tester.keywords_opt(1, 2, c=3), (1, 2, 3))
|
||||
self.assertEqual(ac_tester.keywords_opt(a=1, c=3), (1, None, 3))
|
||||
self.assertEqual(ac_tester.keywords_opt(a=1, b=2, c=3), (1, 2, 3))
|
||||
|
||||
def test_keywords_opt_kwonly(self):
|
||||
self.assertEqual(ac_tester.keywords_opt_kwonly(1), (1, None, None, None))
|
||||
self.assertEqual(ac_tester.keywords_opt_kwonly(1, 2), (1, 2, None, None))
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.keywords_opt_kwonly(1, 2, 3)
|
||||
self.assertEqual(ac_tester.keywords_opt_kwonly(1, b=2), (1, 2, None, None))
|
||||
self.assertEqual(ac_tester.keywords_opt_kwonly(1, 2, c=3), (1, 2, 3, None))
|
||||
self.assertEqual(ac_tester.keywords_opt_kwonly(a=1, c=3), (1, None, 3, None))
|
||||
self.assertEqual(ac_tester.keywords_opt_kwonly(a=1, b=2, c=3, d=4), (1, 2, 3, 4))
|
||||
|
||||
def test_keywords_kwonly_opt(self):
|
||||
self.assertEqual(ac_tester.keywords_kwonly_opt(1), (1, None, None))
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.keywords_kwonly_opt(1, 2)
|
||||
self.assertEqual(ac_tester.keywords_kwonly_opt(1, b=2), (1, 2, None))
|
||||
self.assertEqual(ac_tester.keywords_kwonly_opt(a=1, c=3), (1, None, 3))
|
||||
self.assertEqual(ac_tester.keywords_kwonly_opt(a=1, b=2, c=3), (1, 2, 3))
|
||||
|
||||
def test_posonly_keywords(self):
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_keywords(1)
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_keywords(a=1, b=2)
|
||||
self.assertEqual(ac_tester.posonly_keywords(1, 2), (1, 2))
|
||||
self.assertEqual(ac_tester.posonly_keywords(1, b=2), (1, 2))
|
||||
|
||||
def test_posonly_kwonly(self):
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_kwonly(1)
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_kwonly(1, 2)
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_kwonly(a=1, b=2)
|
||||
self.assertEqual(ac_tester.posonly_kwonly(1, b=2), (1, 2))
|
||||
|
||||
def test_posonly_keywords_kwonly(self):
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_keywords_kwonly(1)
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_keywords_kwonly(1, 2, 3)
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_keywords_kwonly(a=1, b=2, c=3)
|
||||
self.assertEqual(ac_tester.posonly_keywords_kwonly(1, 2, c=3), (1, 2, 3))
|
||||
self.assertEqual(ac_tester.posonly_keywords_kwonly(1, b=2, c=3), (1, 2, 3))
|
||||
|
||||
def test_posonly_keywords_opt(self):
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_keywords_opt(1)
|
||||
self.assertEqual(ac_tester.posonly_keywords_opt(1, 2), (1, 2, None, None))
|
||||
self.assertEqual(ac_tester.posonly_keywords_opt(1, 2, 3), (1, 2, 3, None))
|
||||
self.assertEqual(ac_tester.posonly_keywords_opt(1, 2, 3, 4), (1, 2, 3, 4))
|
||||
self.assertEqual(ac_tester.posonly_keywords_opt(1, b=2), (1, 2, None, None))
|
||||
self.assertEqual(ac_tester.posonly_keywords_opt(1, 2, c=3), (1, 2, 3, None))
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_keywords_opt(a=1, b=2, c=3, d=4)
|
||||
self.assertEqual(ac_tester.posonly_keywords_opt(1, b=2, c=3, d=4), (1, 2, 3, 4))
|
||||
|
||||
def test_posonly_opt_keywords_opt(self):
|
||||
self.assertEqual(ac_tester.posonly_opt_keywords_opt(1), (1, None, None, None))
|
||||
self.assertEqual(ac_tester.posonly_opt_keywords_opt(1, 2), (1, 2, None, None))
|
||||
self.assertEqual(ac_tester.posonly_opt_keywords_opt(1, 2, 3), (1, 2, 3, None))
|
||||
self.assertEqual(ac_tester.posonly_opt_keywords_opt(1, 2, 3, 4), (1, 2, 3, 4))
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_opt_keywords_opt(1, b=2)
|
||||
self.assertEqual(ac_tester.posonly_opt_keywords_opt(1, 2, c=3), (1, 2, 3, None))
|
||||
self.assertEqual(ac_tester.posonly_opt_keywords_opt(1, 2, c=3, d=4), (1, 2, 3, 4))
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_opt_keywords_opt(a=1, b=2, c=3, d=4)
|
||||
|
||||
def test_posonly_kwonly_opt(self):
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_kwonly_opt(1)
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_kwonly_opt(1, 2)
|
||||
self.assertEqual(ac_tester.posonly_kwonly_opt(1, b=2), (1, 2, None, None))
|
||||
self.assertEqual(ac_tester.posonly_kwonly_opt(1, b=2, c=3), (1, 2, 3, None))
|
||||
self.assertEqual(ac_tester.posonly_kwonly_opt(1, b=2, c=3, d=4), (1, 2, 3, 4))
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_kwonly_opt(a=1, b=2, c=3, d=4)
|
||||
|
||||
def test_posonly_opt_kwonly_opt(self):
|
||||
self.assertEqual(ac_tester.posonly_opt_kwonly_opt(1), (1, None, None, None))
|
||||
self.assertEqual(ac_tester.posonly_opt_kwonly_opt(1, 2), (1, 2, None, None))
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_opt_kwonly_opt(1, 2, 3)
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_opt_kwonly_opt(1, b=2)
|
||||
self.assertEqual(ac_tester.posonly_opt_kwonly_opt(1, 2, c=3), (1, 2, 3, None))
|
||||
self.assertEqual(ac_tester.posonly_opt_kwonly_opt(1, 2, c=3, d=4), (1, 2, 3, 4))
|
||||
|
||||
def test_posonly_keywords_kwonly_opt(self):
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_keywords_kwonly_opt(1)
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_keywords_kwonly_opt(1, 2)
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_keywords_kwonly_opt(1, b=2)
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_keywords_kwonly_opt(1, 2, 3)
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_keywords_kwonly_opt(a=1, b=2, c=3)
|
||||
self.assertEqual(ac_tester.posonly_keywords_kwonly_opt(1, 2, c=3), (1, 2, 3, None, None))
|
||||
self.assertEqual(ac_tester.posonly_keywords_kwonly_opt(1, b=2, c=3), (1, 2, 3, None, None))
|
||||
self.assertEqual(ac_tester.posonly_keywords_kwonly_opt(1, 2, c=3, d=4), (1, 2, 3, 4, None))
|
||||
self.assertEqual(ac_tester.posonly_keywords_kwonly_opt(1, 2, c=3, d=4, e=5), (1, 2, 3, 4, 5))
|
||||
|
||||
def test_posonly_keywords_opt_kwonly_opt(self):
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_keywords_opt_kwonly_opt(1)
|
||||
self.assertEqual(ac_tester.posonly_keywords_opt_kwonly_opt(1, 2), (1, 2, None, None, None))
|
||||
self.assertEqual(ac_tester.posonly_keywords_opt_kwonly_opt(1, b=2), (1, 2, None, None, None))
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_keywords_opt_kwonly_opt(1, 2, 3, 4)
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_keywords_opt_kwonly_opt(a=1, b=2)
|
||||
self.assertEqual(ac_tester.posonly_keywords_opt_kwonly_opt(1, 2, c=3), (1, 2, 3, None, None))
|
||||
self.assertEqual(ac_tester.posonly_keywords_opt_kwonly_opt(1, b=2, c=3), (1, 2, 3, None, None))
|
||||
self.assertEqual(ac_tester.posonly_keywords_opt_kwonly_opt(1, 2, 3, d=4), (1, 2, 3, 4, None))
|
||||
self.assertEqual(ac_tester.posonly_keywords_opt_kwonly_opt(1, 2, c=3, d=4), (1, 2, 3, 4, None))
|
||||
self.assertEqual(ac_tester.posonly_keywords_opt_kwonly_opt(1, 2, 3, d=4, e=5), (1, 2, 3, 4, 5))
|
||||
self.assertEqual(ac_tester.posonly_keywords_opt_kwonly_opt(1, 2, c=3, d=4, e=5), (1, 2, 3, 4, 5))
|
||||
|
||||
def test_posonly_opt_keywords_opt_kwonly_opt(self):
|
||||
self.assertEqual(ac_tester.posonly_opt_keywords_opt_kwonly_opt(1), (1, None, None, None))
|
||||
self.assertEqual(ac_tester.posonly_opt_keywords_opt_kwonly_opt(1, 2), (1, 2, None, None))
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_opt_keywords_opt_kwonly_opt(1, b=2)
|
||||
self.assertEqual(ac_tester.posonly_opt_keywords_opt_kwonly_opt(1, 2, 3), (1, 2, 3, None))
|
||||
self.assertEqual(ac_tester.posonly_opt_keywords_opt_kwonly_opt(1, 2, c=3), (1, 2, 3, None))
|
||||
self.assertEqual(ac_tester.posonly_opt_keywords_opt_kwonly_opt(1, 2, 3, d=4), (1, 2, 3, 4))
|
||||
self.assertEqual(ac_tester.posonly_opt_keywords_opt_kwonly_opt(1, 2, c=3, d=4), (1, 2, 3, 4))
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.posonly_opt_keywords_opt_kwonly_opt(1, 2, 3, 4)
|
||||
|
||||
def test_keyword_only_parameter(self):
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.keyword_only_parameter()
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.keyword_only_parameter(1)
|
||||
self.assertEqual(ac_tester.keyword_only_parameter(a=1), (1,))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Add functional test for Argument Clinic.
|
|
@ -170,6 +170,7 @@
|
|||
@MODULE__TESTBUFFER_TRUE@_testbuffer _testbuffer.c
|
||||
@MODULE__TESTINTERNALCAPI_TRUE@_testinternalcapi _testinternalcapi.c
|
||||
@MODULE__TESTCAPI_TRUE@_testcapi _testcapimodule.c _testcapi/vectorcall.c _testcapi/vectorcall_limited.c _testcapi/heaptype.c _testcapi/unicode.c _testcapi/getargs.c _testcapi/pytime.c _testcapi/datetime.c _testcapi/docstring.c _testcapi/mem.c _testcapi/watchers.c _testcapi/long.c _testcapi/float.c
|
||||
@MODULE__TESTCLINIC_TRUE@_testclinic _testclinic.c
|
||||
|
||||
# Some testing modules MUST be built as shared libraries.
|
||||
*shared*
|
||||
|
|
|
@ -0,0 +1,952 @@
|
|||
#ifndef Py_BUILD_CORE_BUILTIN
|
||||
# define Py_BUILD_CORE_MODULE 1
|
||||
#endif
|
||||
|
||||
/* Always enable assertions */
|
||||
#undef NDEBUG
|
||||
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
|
||||
#include "Python.h"
|
||||
|
||||
#include "clinic/_testclinic.c.h"
|
||||
|
||||
|
||||
/* Pack arguments to a tuple, implicitly increase all the arguments' refcount.
|
||||
* NULL arguments will be replaced to Py_None. */
|
||||
static PyObject *
|
||||
pack_arguments_newref(int argc, ...)
|
||||
{
|
||||
assert(!PyErr_Occurred());
|
||||
PyObject *tuple = PyTuple_New(argc);
|
||||
if (!tuple) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
va_list vargs;
|
||||
va_start(vargs, argc);
|
||||
for (int i = 0; i < argc; i++) {
|
||||
PyObject *arg = va_arg(vargs, PyObject *);
|
||||
if (arg) {
|
||||
if (_PyObject_IsFreed(arg)) {
|
||||
PyErr_Format(PyExc_AssertionError,
|
||||
"argument %d at %p is freed or corrupted!",
|
||||
i, arg);
|
||||
va_end(vargs);
|
||||
Py_DECREF(tuple);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
arg = Py_None;
|
||||
}
|
||||
PyTuple_SET_ITEM(tuple, i, Py_NewRef(arg));
|
||||
}
|
||||
va_end(vargs);
|
||||
return tuple;
|
||||
}
|
||||
|
||||
/* Pack arguments to a tuple.
|
||||
* `wrapper` is function which converts primitive type to PyObject.
|
||||
* `arg_type` is type that arguments should be converted to before wrapped. */
|
||||
#define RETURN_PACKED_ARGS(argc, wrapper, arg_type, ...) do { \
|
||||
assert(!PyErr_Occurred()); \
|
||||
arg_type in[argc] = {__VA_ARGS__}; \
|
||||
PyObject *out[argc] = {NULL,}; \
|
||||
for (int _i = 0; _i < argc; _i++) { \
|
||||
out[_i] = wrapper(in[_i]); \
|
||||
assert(out[_i] || PyErr_Occurred()); \
|
||||
if (!out[_i]) { \
|
||||
for (int _j = 0; _j < _i; _j++) { \
|
||||
Py_DECREF(out[_j]); \
|
||||
} \
|
||||
return NULL; \
|
||||
} \
|
||||
} \
|
||||
PyObject *tuple = PyTuple_New(argc); \
|
||||
if (!tuple) { \
|
||||
for (int _i = 0; _i < argc; _i++) { \
|
||||
Py_DECREF(out[_i]); \
|
||||
} \
|
||||
return NULL; \
|
||||
} \
|
||||
for (int _i = 0; _i < argc; _i++) { \
|
||||
PyTuple_SET_ITEM(tuple, _i, out[_i]); \
|
||||
} \
|
||||
return tuple; \
|
||||
} while (0)
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
module _testclinic
|
||||
[clinic start generated code]*/
|
||||
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=d4981b80d6efdb12]*/
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
test_empty_function
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
test_empty_function_impl(PyObject *module)
|
||||
/*[clinic end generated code: output=0f8aeb3ddced55cb input=0dd7048651ad4ae4]*/
|
||||
{
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
objects_converter
|
||||
|
||||
a: object
|
||||
b: object = NULL
|
||||
/
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
objects_converter_impl(PyObject *module, PyObject *a, PyObject *b)
|
||||
/*[clinic end generated code: output=3f9c9415ec86c695 input=1533b1bd94187de4]*/
|
||||
{
|
||||
return pack_arguments_newref(2, a, b);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
bytes_object_converter
|
||||
|
||||
a: PyBytesObject
|
||||
/
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytes_object_converter_impl(PyObject *module, PyBytesObject *a)
|
||||
/*[clinic end generated code: output=7732da869d74b784 input=94211751e7996236]*/
|
||||
{
|
||||
if (!PyBytes_Check(a)) {
|
||||
PyErr_SetString(PyExc_AssertionError,
|
||||
"argument a is not a PyBytesObject");
|
||||
return NULL;
|
||||
}
|
||||
return pack_arguments_newref(1, a);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
byte_array_object_converter
|
||||
|
||||
a: PyByteArrayObject
|
||||
/
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
byte_array_object_converter_impl(PyObject *module, PyByteArrayObject *a)
|
||||
/*[clinic end generated code: output=51f15c76f302b1f7 input=b04d253db51c6f56]*/
|
||||
{
|
||||
if (!PyByteArray_Check(a)) {
|
||||
PyErr_SetString(PyExc_AssertionError,
|
||||
"argument a is not a PyByteArrayObject");
|
||||
return NULL;
|
||||
}
|
||||
return pack_arguments_newref(1, a);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
unicode_converter
|
||||
|
||||
a: unicode
|
||||
/
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unicode_converter_impl(PyObject *module, PyObject *a)
|
||||
/*[clinic end generated code: output=1b4a4adbb6ac6e34 input=de7b5adbf07435ba]*/
|
||||
{
|
||||
if (!PyUnicode_Check(a)) {
|
||||
PyErr_SetString(PyExc_AssertionError,
|
||||
"argument a is not a unicode object");
|
||||
return NULL;
|
||||
}
|
||||
return pack_arguments_newref(1, a);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
bool_converter
|
||||
|
||||
a: bool = True
|
||||
b: bool(accept={object}) = True
|
||||
c: bool(accept={int}) = True
|
||||
/
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bool_converter_impl(PyObject *module, int a, int b, int c)
|
||||
/*[clinic end generated code: output=17005b0c29afd590 input=7f6537705b2f32f4]*/
|
||||
{
|
||||
PyObject *obj_a = a ? Py_True : Py_False;
|
||||
PyObject *obj_b = b ? Py_True : Py_False;
|
||||
PyObject *obj_c = c ? Py_True : Py_False;
|
||||
return pack_arguments_newref(3, obj_a, obj_b, obj_c);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
char_converter
|
||||
|
||||
a: char = b'A'
|
||||
b: char = b'\a'
|
||||
c: char = b'\b'
|
||||
d: char = b'\t'
|
||||
e: char = b'\n'
|
||||
f: char = b'\v'
|
||||
g: char = b'\f'
|
||||
h: char = b'\r'
|
||||
i: char = b'"'
|
||||
j: char = b"'"
|
||||
k: char = b'?'
|
||||
l: char = b'\\'
|
||||
m: char = b'\000'
|
||||
n: char = b'\377'
|
||||
/
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
char_converter_impl(PyObject *module, char a, char b, char c, char d, char e,
|
||||
char f, char g, char h, char i, char j, char k, char l,
|
||||
char m, char n)
|
||||
/*[clinic end generated code: output=f929dbd2e55a9871 input=b601bc5bc7fe85e3]*/
|
||||
{
|
||||
RETURN_PACKED_ARGS(14, PyLong_FromUnsignedLong, unsigned char,
|
||||
a, b, c, d, e, f, g, h, i, j, k, l, m, n);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
unsigned_char_converter
|
||||
|
||||
a: unsigned_char = 12
|
||||
b: unsigned_char(bitwise=False) = 34
|
||||
c: unsigned_char(bitwise=True) = 56
|
||||
/
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unsigned_char_converter_impl(PyObject *module, unsigned char a,
|
||||
unsigned char b, unsigned char c)
|
||||
/*[clinic end generated code: output=490af3b39ce0b199 input=e859502fbe0b3185]*/
|
||||
{
|
||||
RETURN_PACKED_ARGS(3, PyLong_FromUnsignedLong, unsigned char, a, b, c);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
short_converter
|
||||
|
||||
a: short = 12
|
||||
/
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
short_converter_impl(PyObject *module, short a)
|
||||
/*[clinic end generated code: output=1ebb7ddb64248988 input=b4e2309a66f650ae]*/
|
||||
{
|
||||
RETURN_PACKED_ARGS(1, PyLong_FromLong, long, a);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
unsigned_short_converter
|
||||
|
||||
a: unsigned_short = 12
|
||||
b: unsigned_short(bitwise=False) = 34
|
||||
c: unsigned_short(bitwise=True) = 56
|
||||
/
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unsigned_short_converter_impl(PyObject *module, unsigned short a,
|
||||
unsigned short b, unsigned short c)
|
||||
/*[clinic end generated code: output=5f92cc72fc8707a7 input=9d15cd11e741d0c6]*/
|
||||
{
|
||||
RETURN_PACKED_ARGS(3, PyLong_FromUnsignedLong, unsigned long, a, b, c);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
int_converter
|
||||
|
||||
a: int = 12
|
||||
b: int(accept={int}) = 34
|
||||
c: int(accept={str}) = 45
|
||||
/
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
int_converter_impl(PyObject *module, int a, int b, int c)
|
||||
/*[clinic end generated code: output=8e56b59be7d0c306 input=a1dbc6344853db7a]*/
|
||||
{
|
||||
RETURN_PACKED_ARGS(3, PyLong_FromLong, long, a, b, c);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
unsigned_int_converter
|
||||
|
||||
a: unsigned_int = 12
|
||||
b: unsigned_int(bitwise=False) = 34
|
||||
c: unsigned_int(bitwise=True) = 56
|
||||
/
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unsigned_int_converter_impl(PyObject *module, unsigned int a, unsigned int b,
|
||||
unsigned int c)
|
||||
/*[clinic end generated code: output=399a57a05c494cc7 input=8427ed9a3f96272d]*/
|
||||
{
|
||||
RETURN_PACKED_ARGS(3, PyLong_FromUnsignedLong, unsigned long, a, b, c);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
long_converter
|
||||
|
||||
a: long = 12
|
||||
/
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
long_converter_impl(PyObject *module, long a)
|
||||
/*[clinic end generated code: output=9663d936a652707a input=84ad0ef28f24bd85]*/
|
||||
{
|
||||
RETURN_PACKED_ARGS(1, PyLong_FromLong, long, a);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
unsigned_long_converter
|
||||
|
||||
a: unsigned_long = 12
|
||||
b: unsigned_long(bitwise=False) = 34
|
||||
c: unsigned_long(bitwise=True) = 56
|
||||
/
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unsigned_long_converter_impl(PyObject *module, unsigned long a,
|
||||
unsigned long b, unsigned long c)
|
||||
/*[clinic end generated code: output=120b82ea9ebd93a8 input=440dd6f1817f5d91]*/
|
||||
{
|
||||
RETURN_PACKED_ARGS(3, PyLong_FromUnsignedLong, unsigned long, a, b, c);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
long_long_converter
|
||||
|
||||
a: long_long = 12
|
||||
/
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
long_long_converter_impl(PyObject *module, long long a)
|
||||
/*[clinic end generated code: output=5fb5f2220770c3e1 input=730fcb3eecf4d993]*/
|
||||
{
|
||||
RETURN_PACKED_ARGS(1, PyLong_FromLongLong, long long, a);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
unsigned_long_long_converter
|
||||
|
||||
a: unsigned_long_long = 12
|
||||
b: unsigned_long_long(bitwise=False) = 34
|
||||
c: unsigned_long_long(bitwise=True) = 56
|
||||
/
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
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]*/
|
||||
{
|
||||
RETURN_PACKED_ARGS(3, PyLong_FromUnsignedLongLong, unsigned long long,
|
||||
a, b, c);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
py_ssize_t_converter
|
||||
|
||||
a: Py_ssize_t = 12
|
||||
b: Py_ssize_t(accept={int}) = 34
|
||||
c: Py_ssize_t(accept={int, NoneType}) = 56
|
||||
/
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
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]*/
|
||||
{
|
||||
RETURN_PACKED_ARGS(3, PyLong_FromSsize_t, Py_ssize_t, a, b, c);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
slice_index_converter
|
||||
|
||||
a: slice_index = 12
|
||||
b: slice_index(accept={int}) = 34
|
||||
c: slice_index(accept={int, NoneType}) = 56
|
||||
/
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
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]*/
|
||||
{
|
||||
RETURN_PACKED_ARGS(3, PyLong_FromSsize_t, Py_ssize_t, a, b, c);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
size_t_converter
|
||||
|
||||
a: size_t = 12
|
||||
/
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
size_t_converter_impl(PyObject *module, size_t a)
|
||||
/*[clinic end generated code: output=412b5b7334ab444d input=83ae7d9171fbf208]*/
|
||||
{
|
||||
RETURN_PACKED_ARGS(1, PyLong_FromSize_t, size_t, a);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
float_converter
|
||||
|
||||
a: float = 12.5
|
||||
/
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
float_converter_impl(PyObject *module, float a)
|
||||
/*[clinic end generated code: output=1c98f64f2cf1d55c input=a625b59ad68047d8]*/
|
||||
{
|
||||
RETURN_PACKED_ARGS(1, PyFloat_FromDouble, double, a);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
double_converter
|
||||
|
||||
a: double = 12.5
|
||||
/
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
double_converter_impl(PyObject *module, double a)
|
||||
/*[clinic end generated code: output=a4e8532d284d035d input=098df188f24e7c62]*/
|
||||
{
|
||||
RETURN_PACKED_ARGS(1, PyFloat_FromDouble, double, a);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
py_complex_converter
|
||||
|
||||
a: Py_complex
|
||||
/
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
py_complex_converter_impl(PyObject *module, Py_complex a)
|
||||
/*[clinic end generated code: output=9e6ca2eb53b14846 input=e9148a8ca1dbf195]*/
|
||||
{
|
||||
RETURN_PACKED_ARGS(1, PyComplex_FromCComplex, Py_complex, a);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
str_converter
|
||||
|
||||
a: str = "a"
|
||||
b: str(accept={robuffer}) = "b"
|
||||
c: str(accept={robuffer, str}, zeroes=True) = "c"
|
||||
/
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
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]*/
|
||||
{
|
||||
assert(!PyErr_Occurred());
|
||||
PyObject *out[3] = {NULL,};
|
||||
int i = 0;
|
||||
PyObject *arg;
|
||||
|
||||
arg = PyUnicode_FromString(a);
|
||||
assert(arg || PyErr_Occurred());
|
||||
if (!arg) {
|
||||
goto error;
|
||||
}
|
||||
out[i++] = arg;
|
||||
|
||||
arg = PyUnicode_FromString(b);
|
||||
assert(arg || PyErr_Occurred());
|
||||
if (!arg) {
|
||||
goto error;
|
||||
}
|
||||
out[i++] = arg;
|
||||
|
||||
arg = PyUnicode_FromStringAndSize(c, c_length);
|
||||
assert(arg || PyErr_Occurred());
|
||||
if (!arg) {
|
||||
goto error;
|
||||
}
|
||||
out[i++] = arg;
|
||||
|
||||
PyObject *tuple = PyTuple_New(3);
|
||||
if (!tuple) {
|
||||
goto error;
|
||||
}
|
||||
for (int j = 0; j < 3; j++) {
|
||||
PyTuple_SET_ITEM(tuple, j, out[j]);
|
||||
}
|
||||
return tuple;
|
||||
|
||||
error:
|
||||
for (int j = 0; j < i; j++) {
|
||||
Py_DECREF(out[j]);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static PyObject *
|
||||
bytes_from_buffer(Py_buffer *buf)
|
||||
{
|
||||
PyObject *bytes_obj = PyBytes_FromStringAndSize(NULL, buf->len);
|
||||
if (!bytes_obj) {
|
||||
return NULL;
|
||||
}
|
||||
void *bytes_obj_buf = ((PyBytesObject *)bytes_obj)->ob_sval;
|
||||
if (PyBuffer_ToContiguous(bytes_obj_buf, buf, buf->len, 'C') < 0) {
|
||||
Py_DECREF(bytes_obj);
|
||||
return NULL;
|
||||
}
|
||||
return bytes_obj;
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
py_buffer_converter
|
||||
|
||||
a: Py_buffer(accept={str, buffer, NoneType})
|
||||
b: Py_buffer(accept={rwbuffer})
|
||||
/
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
py_buffer_converter_impl(PyObject *module, Py_buffer *a, Py_buffer *b)
|
||||
/*[clinic end generated code: output=52fb13311e3d6d03 input=775de727de5c7421]*/
|
||||
{
|
||||
RETURN_PACKED_ARGS(2, bytes_from_buffer, Py_buffer *, a, b);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
keywords
|
||||
|
||||
a: object
|
||||
b: object
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
keywords_impl(PyObject *module, PyObject *a, PyObject *b)
|
||||
/*[clinic end generated code: output=850aaed53e26729e input=f44b89e718c1a93b]*/
|
||||
{
|
||||
return pack_arguments_newref(2, a, b);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
keywords_kwonly
|
||||
|
||||
a: object
|
||||
*
|
||||
b: object
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
keywords_kwonly_impl(PyObject *module, PyObject *a, PyObject *b)
|
||||
/*[clinic end generated code: output=a45c48241da584dc input=1f08e39c3312b015]*/
|
||||
{
|
||||
return pack_arguments_newref(2, a, b);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
keywords_opt
|
||||
|
||||
a: object
|
||||
b: object = None
|
||||
c: object = None
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
keywords_opt_impl(PyObject *module, PyObject *a, PyObject *b, PyObject *c)
|
||||
/*[clinic end generated code: output=25e4b67d91c76a66 input=b0ba0e4f04904556]*/
|
||||
{
|
||||
return pack_arguments_newref(3, a, b, c);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
keywords_opt_kwonly
|
||||
|
||||
a: object
|
||||
b: object = None
|
||||
*
|
||||
c: object = None
|
||||
d: object = None
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
keywords_opt_kwonly_impl(PyObject *module, PyObject *a, PyObject *b,
|
||||
PyObject *c, PyObject *d)
|
||||
/*[clinic end generated code: output=6aa5b655a6e9aeb0 input=f79da689d6c51076]*/
|
||||
{
|
||||
return pack_arguments_newref(4, a, b, c, d);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
keywords_kwonly_opt
|
||||
|
||||
a: object
|
||||
*
|
||||
b: object = None
|
||||
c: object = None
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
keywords_kwonly_opt_impl(PyObject *module, PyObject *a, PyObject *b,
|
||||
PyObject *c)
|
||||
/*[clinic end generated code: output=707f78eb0f55c2b1 input=e0fa1a0e46dca791]*/
|
||||
{
|
||||
return pack_arguments_newref(3, a, b, c);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
posonly_keywords
|
||||
|
||||
a: object
|
||||
/
|
||||
b: object
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
posonly_keywords_impl(PyObject *module, PyObject *a, PyObject *b)
|
||||
/*[clinic end generated code: output=6ac88f4a5f0bfc8d input=fde0a2f79fe82b06]*/
|
||||
{
|
||||
return pack_arguments_newref(2, a, b);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
posonly_kwonly
|
||||
|
||||
a: object
|
||||
/
|
||||
*
|
||||
b: object
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
posonly_kwonly_impl(PyObject *module, PyObject *a, PyObject *b)
|
||||
/*[clinic end generated code: output=483e6790d3482185 input=78b3712768da9a19]*/
|
||||
{
|
||||
return pack_arguments_newref(2, a, b);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
posonly_keywords_kwonly
|
||||
|
||||
a: object
|
||||
/
|
||||
b: object
|
||||
*
|
||||
c: object
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
posonly_keywords_kwonly_impl(PyObject *module, PyObject *a, PyObject *b,
|
||||
PyObject *c)
|
||||
/*[clinic end generated code: output=2fae573e8cc3fad8 input=a1ad5d2295eb803c]*/
|
||||
{
|
||||
return pack_arguments_newref(3, a, b, c);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
posonly_keywords_opt
|
||||
|
||||
a: object
|
||||
/
|
||||
b: object
|
||||
c: object = None
|
||||
d: object = None
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
posonly_keywords_opt_impl(PyObject *module, PyObject *a, PyObject *b,
|
||||
PyObject *c, PyObject *d)
|
||||
/*[clinic end generated code: output=f5eb66241bcf68fb input=51c10de2a120e279]*/
|
||||
{
|
||||
return pack_arguments_newref(4, a, b, c, d);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
posonly_opt_keywords_opt
|
||||
|
||||
a: object
|
||||
b: object = None
|
||||
/
|
||||
c: object = None
|
||||
d: object = None
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
posonly_opt_keywords_opt_impl(PyObject *module, PyObject *a, PyObject *b,
|
||||
PyObject *c, PyObject *d)
|
||||
/*[clinic end generated code: output=d54a30e549296ffd input=f408a1de7dfaf31f]*/
|
||||
{
|
||||
return pack_arguments_newref(4, a, b, c, d);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
posonly_kwonly_opt
|
||||
|
||||
a: object
|
||||
/
|
||||
*
|
||||
b: object
|
||||
c: object = None
|
||||
d: object = None
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
posonly_kwonly_opt_impl(PyObject *module, PyObject *a, PyObject *b,
|
||||
PyObject *c, PyObject *d)
|
||||
/*[clinic end generated code: output=a20503fe36b4fd62 input=3494253975272f52]*/
|
||||
{
|
||||
return pack_arguments_newref(4, a, b, c, d);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
posonly_opt_kwonly_opt
|
||||
|
||||
a: object
|
||||
b: object = None
|
||||
/
|
||||
*
|
||||
c: object = None
|
||||
d: object = None
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
posonly_opt_kwonly_opt_impl(PyObject *module, PyObject *a, PyObject *b,
|
||||
PyObject *c, PyObject *d)
|
||||
/*[clinic end generated code: output=64f3204a3a0413b6 input=d17516581e478412]*/
|
||||
{
|
||||
return pack_arguments_newref(4, a, b, c, d);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
posonly_keywords_kwonly_opt
|
||||
|
||||
a: object
|
||||
/
|
||||
b: object
|
||||
*
|
||||
c: object
|
||||
d: object = None
|
||||
e: object = None
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
posonly_keywords_kwonly_opt_impl(PyObject *module, PyObject *a, PyObject *b,
|
||||
PyObject *c, PyObject *d, PyObject *e)
|
||||
/*[clinic end generated code: output=dbd7e7ddd6257fa0 input=33529f29e97e5adb]*/
|
||||
{
|
||||
return pack_arguments_newref(5, a, b, c, d, e);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
posonly_keywords_opt_kwonly_opt
|
||||
|
||||
a: object
|
||||
/
|
||||
b: object
|
||||
c: object = None
|
||||
*
|
||||
d: object = None
|
||||
e: object = None
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
posonly_keywords_opt_kwonly_opt_impl(PyObject *module, PyObject *a,
|
||||
PyObject *b, PyObject *c, PyObject *d,
|
||||
PyObject *e)
|
||||
/*[clinic end generated code: output=775d12ae44653045 input=4d4cc62f11441301]*/
|
||||
{
|
||||
return pack_arguments_newref(5, a, b, c, d, e);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
posonly_opt_keywords_opt_kwonly_opt
|
||||
|
||||
a: object
|
||||
b: object = None
|
||||
/
|
||||
c: object = None
|
||||
*
|
||||
d: object = None
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
posonly_opt_keywords_opt_kwonly_opt_impl(PyObject *module, PyObject *a,
|
||||
PyObject *b, PyObject *c,
|
||||
PyObject *d)
|
||||
/*[clinic end generated code: output=40c6dc422591eade input=3964960a68622431]*/
|
||||
{
|
||||
return pack_arguments_newref(4, a, b, c, d);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
keyword_only_parameter
|
||||
|
||||
*
|
||||
a: object
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
keyword_only_parameter_impl(PyObject *module, PyObject *a)
|
||||
/*[clinic end generated code: output=c454b6ce98232787 input=8d2868b8d0b27bdb]*/
|
||||
{
|
||||
return pack_arguments_newref(1, a);
|
||||
}
|
||||
|
||||
|
||||
static PyMethodDef tester_methods[] = {
|
||||
TEST_EMPTY_FUNCTION_METHODDEF
|
||||
OBJECTS_CONVERTER_METHODDEF
|
||||
BYTES_OBJECT_CONVERTER_METHODDEF
|
||||
BYTE_ARRAY_OBJECT_CONVERTER_METHODDEF
|
||||
UNICODE_CONVERTER_METHODDEF
|
||||
BOOL_CONVERTER_METHODDEF
|
||||
CHAR_CONVERTER_METHODDEF
|
||||
UNSIGNED_CHAR_CONVERTER_METHODDEF
|
||||
SHORT_CONVERTER_METHODDEF
|
||||
UNSIGNED_SHORT_CONVERTER_METHODDEF
|
||||
INT_CONVERTER_METHODDEF
|
||||
UNSIGNED_INT_CONVERTER_METHODDEF
|
||||
LONG_CONVERTER_METHODDEF
|
||||
UNSIGNED_LONG_CONVERTER_METHODDEF
|
||||
LONG_LONG_CONVERTER_METHODDEF
|
||||
UNSIGNED_LONG_LONG_CONVERTER_METHODDEF
|
||||
PY_SSIZE_T_CONVERTER_METHODDEF
|
||||
SLICE_INDEX_CONVERTER_METHODDEF
|
||||
SIZE_T_CONVERTER_METHODDEF
|
||||
FLOAT_CONVERTER_METHODDEF
|
||||
DOUBLE_CONVERTER_METHODDEF
|
||||
PY_COMPLEX_CONVERTER_METHODDEF
|
||||
STR_CONVERTER_METHODDEF
|
||||
PY_BUFFER_CONVERTER_METHODDEF
|
||||
KEYWORDS_METHODDEF
|
||||
KEYWORDS_KWONLY_METHODDEF
|
||||
KEYWORDS_OPT_METHODDEF
|
||||
KEYWORDS_OPT_KWONLY_METHODDEF
|
||||
KEYWORDS_KWONLY_OPT_METHODDEF
|
||||
POSONLY_KEYWORDS_METHODDEF
|
||||
POSONLY_KWONLY_METHODDEF
|
||||
POSONLY_KEYWORDS_KWONLY_METHODDEF
|
||||
POSONLY_KEYWORDS_OPT_METHODDEF
|
||||
POSONLY_OPT_KEYWORDS_OPT_METHODDEF
|
||||
POSONLY_KWONLY_OPT_METHODDEF
|
||||
POSONLY_OPT_KWONLY_OPT_METHODDEF
|
||||
POSONLY_KEYWORDS_KWONLY_OPT_METHODDEF
|
||||
POSONLY_KEYWORDS_OPT_KWONLY_OPT_METHODDEF
|
||||
POSONLY_OPT_KEYWORDS_OPT_KWONLY_OPT_METHODDEF
|
||||
KEYWORD_ONLY_PARAMETER_METHODDEF
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static struct PyModuleDef _testclinic_module = {
|
||||
PyModuleDef_HEAD_INIT,
|
||||
.m_name = "_testclinic",
|
||||
.m_size = 0,
|
||||
.m_methods = tester_methods,
|
||||
};
|
||||
|
||||
PyMODINIT_FUNC
|
||||
PyInit__testclinic(void)
|
||||
{
|
||||
return PyModule_Create(&_testclinic_module);
|
||||
}
|
||||
|
||||
#undef RETURN_PACKED_ARGS
|
File diff suppressed because it is too large
Load Diff
|
@ -29,6 +29,7 @@ IGNORE = {
|
|||
'_ctypes_test',
|
||||
'_testbuffer',
|
||||
'_testcapi',
|
||||
'_testclinic',
|
||||
'_testconsole',
|
||||
'_testimportmultiple',
|
||||
'_testinternalcapi',
|
||||
|
|
|
@ -642,6 +642,8 @@ MODULE__TESTBUFFER_FALSE
|
|||
MODULE__TESTBUFFER_TRUE
|
||||
MODULE__TESTINTERNALCAPI_FALSE
|
||||
MODULE__TESTINTERNALCAPI_TRUE
|
||||
MODULE__TESTCLINIC_FALSE
|
||||
MODULE__TESTCLINIC_TRUE
|
||||
MODULE__TESTCAPI_FALSE
|
||||
MODULE__TESTCAPI_TRUE
|
||||
MODULE__HASHLIB_FALSE
|
||||
|
@ -27747,6 +27749,40 @@ fi
|
|||
$as_echo "$py_cv_module__testcapi" >&6; }
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _testclinic" >&5
|
||||
$as_echo_n "checking for stdlib extension module _testclinic... " >&6; }
|
||||
if test "$py_cv_module__testclinic" != "n/a"; then :
|
||||
|
||||
if test "$TEST_MODULES" = yes; then :
|
||||
if true; then :
|
||||
py_cv_module__testclinic=yes
|
||||
else
|
||||
py_cv_module__testclinic=missing
|
||||
fi
|
||||
else
|
||||
py_cv_module__testclinic=disabled
|
||||
fi
|
||||
|
||||
fi
|
||||
as_fn_append MODULE_BLOCK "MODULE__TESTCLINIC_STATE=$py_cv_module__testclinic$as_nl"
|
||||
if test "x$py_cv_module__testclinic" = xyes; then :
|
||||
|
||||
|
||||
|
||||
|
||||
fi
|
||||
if test "$py_cv_module__testclinic" = yes; then
|
||||
MODULE__TESTCLINIC_TRUE=
|
||||
MODULE__TESTCLINIC_FALSE='#'
|
||||
else
|
||||
MODULE__TESTCLINIC_TRUE='#'
|
||||
MODULE__TESTCLINIC_FALSE=
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__testclinic" >&5
|
||||
$as_echo "$py_cv_module__testclinic" >&6; }
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _testinternalcapi" >&5
|
||||
$as_echo_n "checking for stdlib extension module _testinternalcapi... " >&6; }
|
||||
if test "$py_cv_module__testinternalcapi" != "n/a"; then :
|
||||
|
@ -28466,6 +28502,10 @@ if test -z "${MODULE__TESTCAPI_TRUE}" && test -z "${MODULE__TESTCAPI_FALSE}"; th
|
|||
as_fn_error $? "conditional \"MODULE__TESTCAPI\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${MODULE__TESTCLINIC_TRUE}" && test -z "${MODULE__TESTCLINIC_FALSE}"; then
|
||||
as_fn_error $? "conditional \"MODULE__TESTCLINIC\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${MODULE__TESTINTERNALCAPI_TRUE}" && test -z "${MODULE__TESTINTERNALCAPI_FALSE}"; then
|
||||
as_fn_error $? "conditional \"MODULE__TESTINTERNALCAPI\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
|
|
|
@ -7350,6 +7350,7 @@ PY_STDLIB_MOD([_hashlib], [], [test "$ac_cv_working_openssl_hashlib" = yes],
|
|||
|
||||
dnl test modules
|
||||
PY_STDLIB_MOD([_testcapi], [test "$TEST_MODULES" = yes])
|
||||
PY_STDLIB_MOD([_testclinic], [test "$TEST_MODULES" = yes])
|
||||
PY_STDLIB_MOD([_testinternalcapi], [test "$TEST_MODULES" = yes])
|
||||
PY_STDLIB_MOD([_testbuffer], [test "$TEST_MODULES" = yes])
|
||||
PY_STDLIB_MOD([_testimportmultiple], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes])
|
||||
|
|
Loading…
Reference in New Issue