summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2008-01-16 20:34:37 (GMT)
committerThomas Heller <theller@ctypes.org>2008-01-16 20:34:37 (GMT)
commit0f75f9847a178e93cde056a4d889260698cd9471 (patch)
treed336cccf26047bd555b779f31c1d1d2e2af0d016
parent2077131097c02e3b517b244958e4b94e37779780 (diff)
downloadcpython-0f75f9847a178e93cde056a4d889260698cd9471.zip
cpython-0f75f9847a178e93cde056a4d889260698cd9471.tar.gz
cpython-0f75f9847a178e93cde056a4d889260698cd9471.tar.bz2
Use 'g' instead of 'D' as the ctypes typecode for c_longdouble, for
compliance with PEP 3118.
-rw-r--r--Lib/ctypes/__init__.py2
-rw-r--r--Modules/_ctypes/_ctypes.c2
-rw-r--r--Modules/_ctypes/cfield.c6
3 files changed, 5 insertions, 5 deletions
diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py
index 1500896..897f51a 100644
--- a/Lib/ctypes/__init__.py
+++ b/Lib/ctypes/__init__.py
@@ -185,7 +185,7 @@ class c_double(_SimpleCData):
_check_size(c_double)
class c_longdouble(_SimpleCData):
- _type_ = "D"
+ _type_ = "g"
if sizeof(c_longdouble) == sizeof(c_double):
c_longdouble = c_double
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 24d3c2f..6dcba80 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -1113,7 +1113,7 @@ _type_ attribute.
*/
-static char *SIMPLE_TYPE_CHARS = "cbBhHiIlLdfuzZqQPXOvtD";
+static char *SIMPLE_TYPE_CHARS = "cbBhHiIlLdfuzZqQPXOvtg";
static PyObject *
c_wchar_p_from_param(PyObject *type, PyObject *value)
diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c
index 8857e44..03aacbd 100644
--- a/Modules/_ctypes/cfield.c
+++ b/Modules/_ctypes/cfield.c
@@ -995,7 +995,7 @@ Q_get_sw(void *ptr, Py_ssize_t size)
static PyObject *
-D_set(void *ptr, PyObject *value, Py_ssize_t size)
+g_set(void *ptr, PyObject *value, Py_ssize_t size)
{
long double x;
@@ -1011,7 +1011,7 @@ D_set(void *ptr, PyObject *value, Py_ssize_t size)
}
static PyObject *
-D_get(void *ptr, Py_ssize_t size)
+g_get(void *ptr, Py_ssize_t size)
{
long double val;
memcpy(&val, ptr, sizeof(long double));
@@ -1612,7 +1612,7 @@ static struct fielddesc formattable[] = {
{ 'B', B_set, B_get, &ffi_type_uchar},
{ 'c', c_set, c_get, &ffi_type_schar},
{ 'd', d_set, d_get, &ffi_type_double, d_set_sw, d_get_sw},
- { 'D', D_set, D_get, &ffi_type_longdouble},
+ { 'g', g_set, g_get, &ffi_type_longdouble},
{ 'f', f_set, f_get, &ffi_type_float, f_set_sw, f_get_sw},
{ 'h', h_set, h_get, &ffi_type_sshort, h_set_sw, h_get_sw},
{ 'H', H_set, H_get, &ffi_type_ushort, H_set_sw, H_get_sw},