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.
This commit is contained in:
Jack Jansen 2002-03-18 15:24:22 +00:00
parent bd3e771a97
commit 89dbd97279
2 changed files with 10 additions and 2 deletions

View File

@ -233,6 +233,14 @@ class OpaqueByValueType(OpaqueType):
def mkvalueArgs(self, 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):

View File

@ -46,9 +46,9 @@ ConstStringPtr = StringPtr
# File System Specifications
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 = OpaqueByValueType("FSRef", "PyMac_BuildFSRef", "PyMac_GetFSRef")
FSRef = OpaqueByValueStructType("FSRef", "PyMac_BuildFSRef", "PyMac_GetFSRef")
# OSType and ResType: 4-byte character strings
def OSTypeType(typename):