@@ -390,6 +390,19 @@ static PyTypeObject _HashInheritanceTester_Type = {
390390 PyType_GenericNew , /* tp_new */
391391};
392392
393+ static PyObject *
394+ pycompilestring (PyObject * self , PyObject * obj ) {
395+ if (PyBytes_CheckExact (obj ) == 0 ) {
396+ PyErr_SetString (PyExc_ValueError , "Argument must be a bytes object" );
397+ return NULL ;
398+ }
399+ const char * the_string = PyBytes_AsString (obj );
400+ if (the_string == NULL ) {
401+ return NULL ;
402+ }
403+ return Py_CompileString (the_string , "blech" , Py_file_input );
404+ }
405+
393406static PyObject *
394407test_lazy_hash_inheritance (PyObject * self , PyObject * Py_UNUSED (ignored ))
395408{
@@ -5826,6 +5839,7 @@ static PyMethodDef TestMethods[] = {
58265839 {"return_null_without_error" , return_null_without_error , METH_NOARGS },
58275840 {"return_result_with_error" , return_result_with_error , METH_NOARGS },
58285841 {"getitem_with_error" , getitem_with_error , METH_VARARGS },
5842+ {"Py_CompileString" , pycompilestring , METH_O },
58295843 {"PyTime_FromSeconds" , test_pytime_fromseconds , METH_VARARGS },
58305844 {"PyTime_FromSecondsObject" , test_pytime_fromsecondsobject , METH_VARARGS },
58315845 {"PyTime_AsSecondsDouble" , test_pytime_assecondsdouble , METH_VARARGS },
0 commit comments