From 89dbd972799c9bcb060a2bb15cade1638da42c87 Mon Sep 17 00:00:00 2001 From: Jack Jansen Date: Mon, 18 Mar 2002 15:24:22 +0000 Subject: [PATCH] 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. --- Tools/bgen/bgen/bgenType.py | 8 ++++++++ Tools/bgen/bgen/macsupport.py | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Tools/bgen/bgen/bgenType.py b/Tools/bgen/bgen/bgenType.py index fa316a724e1..9b4f11f95d5 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 2caac973971..bd38f023bb4 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):