mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-25 22:52:01 +00:00
Add 1-line comment for obj_class_name()
This commit is contained in:
parent
e3ebb0dbca
commit
8dff51d12e
@ -366,6 +366,7 @@ PYBIND11_NAMESPACE_BEGIN(detail)
|
|||||||
std::string error_string();
|
std::string error_string();
|
||||||
std::string error_string(PyObject *&, PyObject *&, PyObject *&);
|
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) {
|
inline const char *obj_class_name(PyObject *obj) {
|
||||||
if (Py_TYPE(obj) == &PyType_Type) {
|
if (Py_TYPE(obj) == &PyType_Type) {
|
||||||
return reinterpret_cast<PyTypeObject *>(obj)->tp_name;
|
return reinterpret_cast<PyTypeObject *>(obj)->tp_name;
|
||||||
|
Loading…
Reference in New Issue
Block a user