Fix segfault when repr() with pybind11 type with metaclass (#571)

* Fixed a regression that was introduced in the PyPy patch: use ht_qualname_meta instead of ht_qualname to fix PyHeapTypeObject->ht_qualname field.

* Added a qualname/repr test that works in both Python 3.3+ and previous versions
This commit is contained in:
Yung-Yu Chen
2016-12-26 18:25:42 +08:00
committed by Wenzel Jakob
parent 87f893b766
commit c40d8c617f
2 changed files with 7 additions and 1 deletions

View File

@@ -701,7 +701,7 @@ protected:
#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 3
/* Qualified names for Python >= 3.3 */
type->ht_qualname = ht_qualname.release().ptr();
type->ht_qualname = ht_qualname_meta.release().ptr();
#endif
type->ht_type.tp_name = strdup(meta_name_.c_str());
type->ht_type.tp_base = &PyType_Type;