mirror of https://github.com/python/cpython
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:
parent
bd3e771a97
commit
89dbd97279
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue