self.assertEqual(cc, 1)
self.assertEqual(nc, 1)
+ def test_bad_descriptor(self):
+ # gh-132250
+ # cProfile should not crash when the profiler callback fails to locate
+ # the actual function of a method.
+ with self.profilerclass() as prof:
+ with self.assertRaises(TypeError):
+ bytes.find(str())
+
class TestCommandLine(unittest.TestCase):
def test_sort(self):
PyObject *meth = Py_TYPE(callable)->tp_descr_get(
callable, self_arg, (PyObject*)Py_TYPE(self_arg));
if (meth == NULL) {
+ PyErr_Clear();
return NULL;
}
if (PyCFunction_Check(meth)) {