Add 1-line comment for obj_class_name()

This commit is contained in:
Ralf W. Grosse-Kunstleve 2022-05-13 00:27:11 -07:00
parent e3ebb0dbca
commit 8dff51d12e

View File

@ -366,6 +366,7 @@ PYBIND11_NAMESPACE_BEGIN(detail)
std::string error_string();
std::string error_string(PyObject *&, PyObject *&, PyObject *&);
// Equivalent to obj.__class__.__name__ (or obj.__name__ if obj is a class).
inline const char *obj_class_name(PyObject *obj) {
if (Py_TYPE(obj) == &PyType_Type) {
return reinterpret_cast<PyTypeObject *>(obj)->tp_name;