@@ -4550,6 +4550,28 @@ new_hamt(PyObject *self, PyObject *args)
45504550}
45514551
45524552
4553+ /* def bad_get(self, obj, cls):
4554+ cls()
4555+ return repr(self)
4556+ */
4557+ static PyObject *
4558+ bad_get (PyObject * module , PyObject * const * args , Py_ssize_t nargs )
4559+ {
4560+ if (nargs != 3 ) {
4561+ PyErr_SetString (PyExc_TypeError , "bad_get requires exactly 3 arguments" );
4562+ return NULL ;
4563+ }
4564+
4565+ PyObject * res = PyObject_CallObject (args [2 ], NULL );
4566+ if (res == NULL ) {
4567+ return NULL ;
4568+ }
4569+ Py_DECREF (res );
4570+
4571+ return PyObject_Repr (args [0 ]);
4572+ }
4573+
4574+
45534575static PyMethodDef TestMethods [] = {
45544576 {"raise_exception" , raise_exception , METH_VARARGS },
45554577 {"raise_memoryerror" , raise_memoryerror , METH_NOARGS },
@@ -4771,6 +4793,7 @@ static PyMethodDef TestMethods[] = {
47714793 {"get_mapping_items" , get_mapping_items , METH_O },
47724794 {"test_pythread_tss_key_state" , test_pythread_tss_key_state , METH_VARARGS },
47734795 {"hamt" , new_hamt , METH_NOARGS },
4796+ {"bad_get" , bad_get , METH_FASTCALL },
47744797 {NULL , NULL } /* sentinel */
47754798};
47764799
0 commit comments