@@ -573,8 +573,7 @@ class cpp_function : public function {
573
573
// chain.
574
574
chain_start = rec;
575
575
rec->next = chain;
576
- auto rec_capsule
577
- = reinterpret_borrow<capsule>(((PyCFunctionObject *) m_ptr)->m_self );
576
+ auto rec_capsule = reinterpret_borrow<capsule>(PyCFunction_GetSelf (m_ptr));
578
577
rec_capsule.set_pointer (unique_rec.release ());
579
578
guarded_strdup.release ();
580
579
} else {
@@ -636,10 +635,16 @@ class cpp_function : public function {
636
635
637
636
/* Install docstring */
638
637
auto *func = (PyCFunctionObject *) m_ptr;
638
+ #ifndef GRAALVM_PYTHON
639
639
std::free (const_cast <char *>(func->m_ml ->ml_doc ));
640
640
// Install docstring if it's non-empty (when at least one option is enabled)
641
641
func->m_ml ->ml_doc
642
642
= signatures.empty () ? nullptr : PYBIND11_COMPAT_STRDUP (signatures.c_str ());
643
+ #else
644
+ std::free (const_cast <char *>(GraalPyCFunction_GetDoc (m_ptr)));
645
+ GraalPyCFunction_SetDoc (
646
+ m_ptr, signatures.empty () ? nullptr : PYBIND11_COMPAT_STRDUP (signatures.c_str ()));
647
+ #endif
643
648
644
649
if (rec->is_method ) {
645
650
m_ptr = PYBIND11_INSTANCE_METHOD_NEW (m_ptr, rec->scope .ptr ());
@@ -2780,8 +2785,8 @@ get_type_override(const void *this_ptr, const type_info *this_type, const char *
2780
2785
}
2781
2786
2782
2787
/* Don't call dispatch code if invoked from overridden function.
2783
- Unfortunately this doesn't work on PyPy. */
2784
- #if !defined(PYPY_VERSION)
2788
+ Unfortunately this doesn't work on PyPy and GraalPy . */
2789
+ #if !defined(PYPY_VERSION) && !defined(GRAALVM_PYTHON)
2785
2790
# if PY_VERSION_HEX >= 0x03090000
2786
2791
PyFrameObject *frame = PyThreadState_GetFrame (PyThreadState_Get ());
2787
2792
if (frame != nullptr ) {
0 commit comments