@@ -1395,6 +1395,33 @@ test_unicode(PyObject *Py_UNUSED(module), PyObject *Py_UNUSED(args))
13951395}
13961396
13971397
1398+ static PyObject *
1399+ test_list (PyObject * Py_UNUSED (module ), PyObject * Py_UNUSED (args ))
1400+ {
1401+ PyObject * list = PyList_New (0 );
1402+ if (list == NULL ) {
1403+ return NULL ;
1404+ }
1405+
1406+ PyObject * abc = PyUnicode_FromString ("abc" );
1407+ if (abc == NULL ) {
1408+ return NULL ;
1409+ }
1410+
1411+ // test PyList_Extend()
1412+ assert (PyList_Extend (list , abc ) == 0 );
1413+ Py_DECREF (abc );
1414+ assert (PyList_GET_SIZE (list ) == 3 );
1415+
1416+ // test PyList_Clear()
1417+ assert (PyList_Clear (list ) == 0 );
1418+ assert (PyList_GET_SIZE (list ) == 0 );
1419+
1420+ Py_DECREF (list );
1421+ Py_RETURN_NONE ;
1422+ }
1423+
1424+
13981425static struct PyMethodDef methods [] = {
13991426 {"test_object" , test_object , METH_NOARGS , _Py_NULL },
14001427 {"test_py_is" , test_py_is , METH_NOARGS , _Py_NULL },
@@ -1425,6 +1452,7 @@ static struct PyMethodDef methods[] = {
14251452 {"test_managed_dict" , test_managed_dict , METH_NOARGS , _Py_NULL },
14261453#endif
14271454 {"test_unicode" , test_unicode , METH_NOARGS , _Py_NULL },
1455+ {"test_list" , test_list , METH_NOARGS , _Py_NULL },
14281456 {_Py_NULL , _Py_NULL , 0 , _Py_NULL }
14291457};
14301458
0 commit comments