[pypy-svn] pypy default: More types in structmembers
amauryfa
commits-noreply at bitbucket.org
Fri Dec 17 19:00:12 CET 2010
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch:
Changeset: r40096:bd9480b2d1ea
Date: 2010-11-06 23:04 +0000
http://bitbucket.org/pypy/pypy/changeset/bd9480b2d1ea/
Log: More types in structmembers
(transplanted from f4f91d4af7c71d40ec5329ea3456ac0188c76022)
diff --git a/pypy/module/cpyext/include/structmember.h b/pypy/module/cpyext/include/structmember.h
--- a/pypy/module/cpyext/include/structmember.h
+++ b/pypy/module/cpyext/include/structmember.h
@@ -24,17 +24,23 @@
#define T_SHORT 0
#define T_INT 1
#define T_LONG 2
+#define T_FLOAT 3
+#define T_DOUBLE 4
#define T_STRING 5
#define T_OBJECT 6
#define T_CHAR 7 /* 1-character string */
#define T_BYTE 8 /* 8-bit signed int */
+#define T_UBYTE 9
#define T_USHORT 10
#define T_UINT 11
#define T_ULONG 12
-#define T_STRING_INPLACE 13 /* Strings contained in the structure */
+#define T_STRING_INPLACE 13 /* Strings contained in the structure */
+#define T_BOOL 14
#define T_OBJECT_EX 16 /* Like T_OBJECT, but raises AttributeError
when the value is NULL, instead of
converting to None. */
+#define T_LONGLONG 17
+#define T_ULONGLONG 18
/* Flags */
#define READONLY 1
diff --git a/pypy/module/cpyext/structmember.py b/pypy/module/cpyext/structmember.py
--- a/pypy/module/cpyext/structmember.py
+++ b/pypy/module/cpyext/structmember.py
@@ -6,8 +6,11 @@
from pypy.module.cpyext.intobject import PyInt_AsLong, PyInt_AsUnsignedLong
from pypy.module.cpyext.pyerrors import PyErr_Occurred
from pypy.module.cpyext.pyobject import PyObject, Py_DecRef, from_ref, make_ref
-from pypy.module.cpyext.stringobject import (PyString_FromString,
- PyString_FromStringAndSize)
+from pypy.module.cpyext.stringobject import (
+ PyString_FromString, PyString_FromStringAndSize)
+from pypy.module.cpyext.floatobject import PyFloat_AsDouble
+from pypy.module.cpyext.longobject import (
+ PyLong_AsLongLong, PyLong_AsUnsignedLongLong)
from pypy.module.cpyext.typeobjectdefs import PyMemberDef
from pypy.rlib.unroll import unrolling_iterable
@@ -19,6 +22,12 @@
(T_UINT, rffi.UINT, PyInt_AsUnsignedLong),
(T_ULONG, rffi.ULONG, PyInt_AsUnsignedLong),
(T_BYTE, rffi.UCHAR, PyInt_AsLong),
+ (T_UBYTE, rffi.UCHAR, PyInt_AsUnsignedLong),
+ (T_BOOL, rffi.UCHAR, PyInt_AsLong),
+ (T_FLOAT, rffi.FLOAT, PyFloat_AsDouble),
+ (T_DOUBLE, rffi.DOUBLE, PyFloat_AsDouble),
+ (T_LONGLONG, rffi.LONGLONG, PyLong_AsLongLong),
+ (T_ULONGLONG, rffi.ULONGLONG, PyLong_AsUnsignedLongLong),
])
diff --git a/pypy/module/cpyext/structmemberdefs.py b/pypy/module/cpyext/structmemberdefs.py
--- a/pypy/module/cpyext/structmemberdefs.py
+++ b/pypy/module/cpyext/structmemberdefs.py
@@ -1,14 +1,20 @@
T_SHORT = 0
T_INT = 1
T_LONG = 2
+T_FLOAT = 3
+T_DOUBLE = 4
T_STRING = 5
T_OBJECT = 6
T_CHAR = 7
T_BYTE = 8
+T_UBYTE = 9
T_USHORT = 10
T_UINT = 11
T_ULONG = 12
T_STRING_INPLACE = 13
+T_BOOL = 14
T_OBJECT_EX = 16
+T_LONGLONG = 17
+T_ULONGLONG = 18
READONLY = RO = 1
More information about the Pypy-commit
mailing list