pitrou commented on a change in pull request #8312:
URL: https://github.com/apache/arrow/pull/8312#discussion_r499605997
##########
File path: cpp/src/arrow/python/extension_type.cc
##########
@@ -71,6 +72,14 @@ PyObject* DeserializeExtInstance(PyObject* type_class,
static const char* kExtensionName = "arrow.py_extension_type";
+std::string PyExtensionType::ToString() const {
+ std::stringstream ss;
+ OwnedRef instance(GetInstance());
+ ss << "extension<" << this->extension_name() << "<" <<
Py_TYPE(instance.obj())->tp_name
+ << ">>";
+ return ss.str();
+}
Review comment:
This works fine, but there is one thing missing. Since `ToString` can be
called from arbitrary C++ code, the GIL needs to be taken. This is achieved by
adding:
```c++
PyAcquireGIL lock;
```
at the beginning of this method definition.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]