Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
use c_tp_name even for heap types
Browse files Browse the repository at this point in the history
See https://bugs.python.org/issue22079 and the solution in cython from 2017
cython/cython#1927 (review)
If we, like CPython turn on CYTHON_USE_TYPE_SPECS then the cython hack goes away
  • Loading branch information
mattip committed Nov 1, 2022
1 parent d7374c5 commit c67e5c4
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions pypy/module/cpyext/typeobject.py
Expand Up @@ -576,11 +576,7 @@ def __init__(self, space, pto):
dict_w = {}

flag_heaptype = widen(pto.c_tp_flags) & Py_TPFLAGS_HEAPTYPE
if flag_heaptype:
hto = cts.cast('PyHeapTypeObject*', pto)
name = space.text_w(from_ref(space, hto.c_ht_name))
else:
name = rffi.constcharp2str(pto.c_tp_name)
name = rffi.constcharp2str(pto.c_tp_name)
add_operators(space, self, dict_w, pto, name)
convert_method_defs(space, dict_w, pto.c_tp_methods, self)
convert_getset_defs(space, dict_w, pto.c_tp_getset, self)
Expand Down Expand Up @@ -983,7 +979,7 @@ def PyType_FromSpecWithBases(space, spec, bases):
res.c_ht_name = make_ref(space, space.newtext(name))
res.c_ht_qualname = res.c_ht_name
incref(space, res.c_ht_qualname)
typ.c_tp_name = spec.c_name
typ.c_tp_name = cts.cast('const char*', rffi.str2charp(name))
slotdefs = rffi.cast(rffi.CArrayPtr(cts.gettype('PyType_Slot')), spec.c_slots)
if not bases:
w_base = space.w_object
Expand Down

0 comments on commit c67e5c4

Please sign in to comment.