Author: Manuel Jacob <[email protected]>
Branch: py3.3
Changeset: r78627:a6a689eac5da
Date: 2015-07-21 18:19 +0200
http://bitbucket.org/pypy/pypy/changeset/a6a689eac5da/
Log: Add 'n' and 'N' struct conversion codes.
diff --git a/pypy/module/struct/test/test_struct.py
b/pypy/module/struct/test/test_struct.py
--- a/pypy/module/struct/test/test_struct.py
+++ b/pypy/module/struct/test/test_struct.py
@@ -127,6 +127,7 @@
<= calcsize('l') == calcsize('L')
<= calcsize('q') == calcsize('Q'))
assert 4 <= calcsize('f') <= 8 <= calcsize('d')
+ assert calcsize('n') == calcsize('N') >= calcsize('P')
assert calcsize('13s') == 13
assert calcsize('500p') == 500
assert 4 <= calcsize('P') <= 8
diff --git a/rpython/rlib/rstruct/nativefmttable.py
b/rpython/rlib/rstruct/nativefmttable.py
--- a/rpython/rlib/rstruct/nativefmttable.py
+++ b/rpython/rlib/rstruct/nativefmttable.py
@@ -88,11 +88,13 @@
'i': 'signed int',
'l': 'signed long',
'q': 'signed long long',
+ 'n': 'ssize_t',
'B': 'unsigned char',
'H': 'unsigned short',
'I': 'unsigned int',
'L': 'unsigned long',
'Q': 'unsigned long long',
+ 'N': 'size_t',
'P': 'char *',
'f': 'float',
'd': 'double',
@@ -100,6 +102,7 @@
}
pre_include_bits = ["""
+ #include <sys/types.h>
#ifdef _MSC_VER
#define _Bool char
#endif"""]
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit