mirror of
https://github.com/AdaCore/cpython.git
synced 2026-02-12 12:57:15 -08:00
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:
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user