@@ -2376,16 +2376,22 @@ test_long_numbits(PyObject *self, PyObject *Py_UNUSED(ignored))
2376
2376
Py_RETURN_NONE ;
2377
2377
}
2378
2378
2379
- /* Example passing NULLs to PyObject_Str(NULL). */
2379
+ static PyObject *
2380
+ pyobject_repr_from_null (PyObject * self , PyObject * Py_UNUSED (ignored ))
2381
+ {
2382
+ return PyObject_Repr (NULL );
2383
+ }
2380
2384
2381
2385
static PyObject *
2382
- test_null_strings (PyObject * self , PyObject * Py_UNUSED (ignored ))
2386
+ pyobject_str_from_null (PyObject * self , PyObject * Py_UNUSED (ignored ))
2383
2387
{
2384
- PyObject * o1 = PyObject_Str (NULL ), * o2 = PyObject_Str (NULL );
2385
- PyObject * tuple = PyTuple_Pack (2 , o1 , o2 );
2386
- Py_XDECREF (o1 );
2387
- Py_XDECREF (o2 );
2388
- return tuple ;
2388
+ return PyObject_Str (NULL );
2389
+ }
2390
+
2391
+ static PyObject *
2392
+ pyobject_bytes_from_null (PyObject * self , PyObject * Py_UNUSED (ignored ))
2393
+ {
2394
+ return PyObject_Bytes (NULL );
2389
2395
}
2390
2396
2391
2397
static PyObject *
@@ -5702,7 +5708,9 @@ static PyMethodDef TestMethods[] = {
5702
5708
{"test_k_code" , test_k_code , METH_NOARGS },
5703
5709
{"test_empty_argparse" , test_empty_argparse , METH_NOARGS },
5704
5710
{"parse_tuple_and_keywords" , parse_tuple_and_keywords , METH_VARARGS },
5705
- {"test_null_strings" , test_null_strings , METH_NOARGS },
5711
+ {"pyobject_repr_from_null" , pyobject_repr_from_null , METH_NOARGS },
5712
+ {"pyobject_str_from_null" , pyobject_str_from_null , METH_NOARGS },
5713
+ {"pyobject_bytes_from_null" , pyobject_bytes_from_null , METH_NOARGS },
5706
5714
{"test_string_from_format" , (PyCFunction )test_string_from_format , METH_NOARGS },
5707
5715
{"test_with_docstring" , test_with_docstring , METH_NOARGS ,
5708
5716
PyDoc_STR ("This is a pretty normal docstring." )},
0 commit comments