From: Jack Jansen Date: Mon, 18 Mar 2002 15:24:22 +0000 (+0000) Subject: Some structures should be passed to Py_BuildValue by reference, not by value, X-Git-Tag: v2.3c1~6452 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=89dbd972799c9bcb060a2bb15cade1638da42c87;p=python 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. --- diff --git a/Tools/bgen/bgen/bgenType.py b/Tools/bgen/bgen/bgenType.py index fa316a724e..9b4f11f95d 100644 --- a/Tools/bgen/bgen/bgenType.py +++ b/Tools/bgen/bgen/bgenType.py @@ -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): diff --git a/Tools/bgen/bgen/macsupport.py b/Tools/bgen/bgen/macsupport.py index 2caac97397..bd38f023bb 100644 --- a/Tools/bgen/bgen/macsupport.py +++ b/Tools/bgen/bgen/macsupport.py @@ -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):