summaryrefslogtreecommitdiffstats
path: root/Tools/bgen
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2002-03-18 15:24:22 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2002-03-18 15:24:22 (GMT)
commit89dbd972799c9bcb060a2bb15cade1638da42c87 (patch)
tree825c73a9605bfe3214708e66f7539a545e245143 /Tools/bgen
parentbd3e771a979de04e273f735e69fb8842006137be (diff)
downloadcpython-89dbd972799c9bcb060a2bb15cade1638da42c87.zip
cpython-89dbd972799c9bcb060a2bb15cade1638da42c87.tar.gz
cpython-89dbd972799c9bcb060a2bb15cade1638da42c87.tar.bz2
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.
Diffstat (limited to 'Tools/bgen')
-rw-r--r--Tools/bgen/bgen/bgenType.py8
-rw-r--r--Tools/bgen/bgen/macsupport.py4
2 files changed, 10 insertions, 2 deletions
diff --git a/Tools/bgen/bgen/bgenType.py b/Tools/bgen/bgen/bgenType.py
index fa316a7..9b4f11f 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 2caac97..bd38f02 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):