fix(tpv): vpi 注入不再注册空类(FieldCount=0)——避免阻塞源模块真实定义
- vpi 存根不含类字段(只序列化 class 名 + def 签名),_inject_class_struct_declare 的 field_count 恒为 0 → 注册空类 - 空类在源模块编译时被 find_struct_by_module 命中 → "结构体已注册但字段数为0" InternalCompilerError(win32base.SECURITY_ATTRIBUTES 根因) - field_count==0 时不注册:依赖已编译命中真实类(L1604-1608),未编译走 _deps_pending 多遍收敛
This commit is contained in:
1 parent
6540e27844
commit
7b81e3c7cf
1 file changed
+10
-1
@@ -1640,7 +1640,16 @@ def _inject_class_struct_declare(pool: memhub.MemBuddy | t.CPtr,
|
||||
field_names_buf[field_count] = t.CSizeT(m_tgt_c.id)
|
||||
field_types_buf[field_count] = t.CSizeT(field_ty_c)
|
||||
field_count += 1
|
||||
# 3. 构建 ParamNode 链表
|
||||
# 3. vpi 存根不含类字段(只序列化 class 名 + def 签名,见 _cache_vpi_return_
|
||||
# annots_text 的 class/def 行解析)→ field_count 恒为 0。
|
||||
# 注册空类(FieldCount=0)会让源模块编译时 find_struct_by_module 命中空类 →
|
||||
# "结构体已注册但字段数为0" InternalCompilerError(win32base.SECURITY_ATTRIBUTES
|
||||
# 根因:fileio/subprocess 先编译时注入空类,win32base 后编译命中)。
|
||||
# 改为不注册:依赖模块已编译时命中真实类(上方 L1604-1608 已处理),未编译时
|
||||
# 由 _deps_pending 多遍收敛(依赖编译后真实类注册,字段访问/裸类名引用走 pending)。
|
||||
if field_count == 0:
|
||||
return 0
|
||||
# 4. 构建 ParamNode 链表
|
||||
first_node_c: llvmlite.ParamNode | t.CPtr = None
|
||||
prev_node_c: llvmlite.ParamNode | t.CPtr = None
|
||||
for fi_c in range(field_count):
|
||||
|
||||
Reference in new issue
Block a user