Commit ec1927a8 authored by Xavier Thompson's avatar Xavier Thompson

Adapt cycplass code to breaking changes in C API

Since Python 3.9a4 , Py_REFCNT and Py_TYPE should no longer be used to
assign a value. Instead, Py_SET_REFCNT and Py_SET_TYPE should be used.

Since Python 3.10, Py_REFCNT can no longer be used to assign a value
at all.

See https://bugs.python.org/issue39573
parent 11043f41
...@@ -1394,8 +1394,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1394,8 +1394,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
objstruct_cname = wrapper_type.objstruct_cname objstruct_cname = wrapper_type.objstruct_cname
code.putln("if (self) {") code.putln("if (self) {")
code.putln("%s * wrapper = (%s *) self;" % (objstruct_cname, objstruct_cname)) code.putln("%s * wrapper = (%s *) self;" % (objstruct_cname, objstruct_cname))
code.putln("Py_REFCNT(wrapper) = 0;") code.putln("__Pyx_SET_REFCNT(wrapper, 0);")
code.putln("Py_TYPE(wrapper) = %s;" % wrapper_type.typeptr_cname) code.putln("__Pyx_SET_TYPE(wrapper, %s);" % wrapper_type.typeptr_cname)
code.putln("}") code.putln("}")
def generate_typedef(self, entry, code): def generate_typedef(self, entry, code):
......
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