mirror of
https://github.com/python/cpython.git
synced 2025-11-11 22:55:08 +00: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:
parent
bd3e771a97
commit
89dbd97279
2 changed files with 10 additions and 2 deletions
|
|
@ -234,6 +234,14 @@ class OpaqueByValueType(OpaqueType):
|
||||||
def mkvalueArgs(self, name):
|
def mkvalueArgs(self, name):
|
||||||
return "%s, %s" % (self.new, 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):
|
class OpaqueArrayType(OpaqueByValueType):
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,9 +46,9 @@ ConstStringPtr = StringPtr
|
||||||
|
|
||||||
# File System Specifications
|
# File System Specifications
|
||||||
FSSpec_ptr = OpaqueType("FSSpec", "PyMac_BuildFSSpec", "PyMac_GetFSSpec")
|
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_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
|
# OSType and ResType: 4-byte character strings
|
||||||
def OSTypeType(typename):
|
def OSTypeType(typename):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue