Commit 89dbd972 authored by Jack Jansen's avatar Jack Jansen

Some structures should be passed to Py_BuildValue by reference, not by value,

notably FSSpec and FSRef objects. First half of fix for #531291.

2.2.1 candidate.
parent bd3e771a
...@@ -233,6 +233,14 @@ class OpaqueByValueType(OpaqueType): ...@@ -233,6 +233,14 @@ class OpaqueByValueType(OpaqueType):
def mkvalueArgs(self, name): def mkvalueArgs(self, name):
return "%s, %s" % (self.new, name) return "%s, %s" % (self.new, name)
class OpaqueByValueStructType(OpaqueByValueType):
"""Similar to OpaqueByValueType, but we also pass this to mkvalue by
address, in stead of by value.
"""
def mkvalueArgs(self, name):
return "%s, &%s" % (self.new, name)
class OpaqueArrayType(OpaqueByValueType): class OpaqueArrayType(OpaqueByValueType):
......
...@@ -46,9 +46,9 @@ ConstStringPtr = StringPtr ...@@ -46,9 +46,9 @@ ConstStringPtr = StringPtr
# File System Specifications # File System Specifications
FSSpec_ptr = OpaqueType("FSSpec", "PyMac_BuildFSSpec", "PyMac_GetFSSpec") FSSpec_ptr = OpaqueType("FSSpec", "PyMac_BuildFSSpec", "PyMac_GetFSSpec")
FSSpec = OpaqueByValueType("FSSpec", "PyMac_BuildFSSpec", "PyMac_GetFSSpec") FSSpec = OpaqueByValueStructType("FSSpec", "PyMac_BuildFSSpec", "PyMac_GetFSSpec")
FSRef_ptr = OpaqueType("FSRef", "PyMac_BuildFSRef", "PyMac_GetFSRef") FSRef_ptr = OpaqueType("FSRef", "PyMac_BuildFSRef", "PyMac_GetFSRef")
FSRef = OpaqueByValueType("FSRef", "PyMac_BuildFSRef", "PyMac_GetFSRef") FSRef = OpaqueByValueStructType("FSRef", "PyMac_BuildFSRef", "PyMac_GetFSRef")
# OSType and ResType: 4-byte character strings # OSType and ResType: 4-byte character strings
def OSTypeType(typename): def OSTypeType(typename):
......
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