Commit 17a4208e authored by Stefan Behnel's avatar Stefan Behnel

prevent direct usage of PyWrapperDescrObject struct when not building in CPython

--HG--
extra : rebase_source : 1ada6cc5efa5fa3100aa0be920245afe0b37c163
parent 0ab6907c
...@@ -2208,6 +2208,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -2208,6 +2208,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
# a significant performance hit. (See trac #561.) # a significant performance hit. (See trac #561.)
for func in entry.type.scope.pyfunc_entries: for func in entry.type.scope.pyfunc_entries:
if func.is_special and Options.docstrings and func.wrapperbase_cname: if func.is_special and Options.docstrings and func.wrapperbase_cname:
code.putln('#if CYTHON_COMPILING_IN_CPYTHON')
code.putln("{") code.putln("{")
code.putln( code.putln(
'PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&%s, "%s"); %s' % ( 'PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&%s, "%s"); %s' % (
...@@ -2226,6 +2227,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -2226,6 +2227,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
func.wrapperbase_cname)) func.wrapperbase_cname))
code.putln("}") code.putln("}")
code.putln("}") code.putln("}")
code.putln('#endif')
if type.vtable_cname: if type.vtable_cname:
code.putln( code.putln(
"if (__Pyx_SetVtable(%s.tp_dict, %s) < 0) %s" % ( "if (__Pyx_SetVtable(%s.tp_dict, %s) < 0) %s" % (
......
...@@ -3429,8 +3429,10 @@ class DefNodeWrapper(FuncDefNode): ...@@ -3429,8 +3429,10 @@ class DefNodeWrapper(FuncDefNode):
split_string_literal(escape_byte_string(docstr)))) split_string_literal(escape_byte_string(docstr))))
if entry.is_special: if entry.is_special:
code.putln('#if CYTHON_COMPILING_IN_CPYTHON')
code.putln( code.putln(
"struct wrapperbase %s;" % entry.wrapperbase_cname) "struct wrapperbase %s;" % entry.wrapperbase_cname)
code.putln('#endif')
if with_pymethdef or self.target.fused_py_func: if with_pymethdef or self.target.fused_py_func:
code.put( code.put(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment