summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2008-07-15 17:25:07 (GMT)
committerThomas Heller <theller@ctypes.org>2008-07-15 17:25:07 (GMT)
commit0261e1e73f14da7ce2c50ad2a93390a31cae2179 (patch)
treeb0aa393b3fab8775da31cf0c56a15da434bfcdf9 /Lib
parentd88ddfa94ae112957e49093550c096415ef0cd33 (diff)
downloadcpython-0261e1e73f14da7ce2c50ad2a93390a31cae2179.zip
cpython-0261e1e73f14da7ce2c50ad2a93390a31cae2179.tar.gz
cpython-0261e1e73f14da7ce2c50ad2a93390a31cae2179.tar.bz2
Merged revisions 64968,64971 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r64968 | thomas.heller | 2008-07-15 19:03:08 +0200 (Di, 15 Jul 2008) | 4 lines Issue #3258: Fix an assertion error (in debug build) and a crash (in release build) when the format string of a pointer to an incomplete structure is created. ........ r64971 | thomas.heller | 2008-07-15 19:19:50 +0200 (Di, 15 Jul 2008) | 2 lines NEWS entry for #issue 3258. ........
Diffstat (limited to 'Lib')
-rw-r--r--Lib/ctypes/test/test_pep3118.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/ctypes/test/test_pep3118.py b/Lib/ctypes/test/test_pep3118.py
index 42a124e..9a830e9 100644
--- a/Lib/ctypes/test/test_pep3118.py
+++ b/Lib/ctypes/test/test_pep3118.py
@@ -12,6 +12,8 @@ else:
def normalize(format):
# Remove current endian specifier and white space from a format
# string
+ if format is None:
+ return ""
format = format.replace(OTHER_ENDIAN, THIS_ENDIAN)
return re.sub(r"\s", "", format)
@@ -84,6 +86,14 @@ class EmptyStruct(Structure):
class aUnion(Union):
_fields_ = [("a", c_int)]
+class Incomplete(Structure):
+ pass
+
+class Complete(Structure):
+ pass
+PComplete = POINTER(Complete)
+Complete._fields_ = [("a", c_int)]
+
################################################################
#
# This table contains format strings as they look on little endian
@@ -141,6 +151,16 @@ native_types = [
# the pep does't support unions
(aUnion, "B", None, aUnion),
+ ## pointer to incomplete structure
+ (Incomplete, "B", None, Incomplete),
+ (POINTER(Incomplete), "&B", None, POINTER(Incomplete)),
+
+ # 'Complete' is a structure that starts incomplete, but is completed after the
+ # pointer type to it has been created.
+ (Complete, "T{<l:a:}", None, Complete),
+ # Unfortunately the pointer format string is not fixed...
+ (POINTER(Complete), "&B", None, POINTER(Complete)),
+
## other
# function signatures are not implemented