Issue 1872: Changed the struct module typecode from 't' to '?', for
compatibility with PEP3118.
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 4ef3947..ea7e40d 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -1242,7 +1242,7 @@
 
 */
 
-static char *SIMPLE_TYPE_CHARS = "cbBhHiIlLdfuzZqQPXOvtg";
+static char *SIMPLE_TYPE_CHARS = "cbBhHiIlLdfuzZqQPXOv?g";
 
 static PyObject *
 c_wchar_p_from_param(PyObject *type, PyObject *value)
diff --git a/Modules/_ctypes/_ctypes_test.c b/Modules/_ctypes/_ctypes_test.c
index d9e4964..3f13180 100644
--- a/Modules/_ctypes/_ctypes_test.c
+++ b/Modules/_ctypes/_ctypes_test.c
@@ -25,6 +25,15 @@
 
 /* some functions handy for testing */
 
+EXPORT(void)testfunc_array(int values[4])
+{
+	printf("testfunc_array %d %d %d %d\n",
+	       values[0],
+	       values[1],
+	       values[2],
+	       values[3]);
+}
+
 EXPORT(long double)testfunc_Ddd(double a, double b)
 {
 	long double result = (long double)(a * b);
diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c
index 155e75e..3fd7756 100644
--- a/Modules/_ctypes/cfield.c
+++ b/Modules/_ctypes/cfield.c
@@ -726,7 +726,7 @@
 #endif
 
 static PyObject *
-t_set(void *ptr, PyObject *value, Py_ssize_t size)
+bool_set(void *ptr, PyObject *value, Py_ssize_t size)
 {
 	switch (PyObject_IsTrue(value)) {
 	case -1:
@@ -741,7 +741,7 @@
 }
 
 static PyObject *
-t_get(void *ptr, Py_ssize_t size)
+bool_get(void *ptr, Py_ssize_t size)
 {
 	return PyBool_FromLong((long)*(BOOL_TYPE *)ptr);
 }
@@ -1645,15 +1645,15 @@
 	{ 'v', vBOOL_set, vBOOL_get, &ffi_type_sshort},
 #endif
 #if SIZEOF__BOOL == 1
-	{ 't', t_set, t_get, &ffi_type_uchar}, /* Also fallback for no native _Bool support */
+	{ '?', bool_set, bool_get, &ffi_type_uchar}, /* Also fallback for no native _Bool support */
 #elif SIZEOF__BOOL == SIZEOF_SHORT
-	{ 't', t_set, t_get, &ffi_type_ushort},
+	{ '?', bool_set, bool_get, &ffi_type_ushort},
 #elif SIZEOF__BOOL == SIZEOF_INT
-	{ 't', t_set, t_get, &ffi_type_uint, I_set_sw, I_get_sw},
+	{ '?', bool_set, bool_get, &ffi_type_uint, I_set_sw, I_get_sw},
 #elif SIZEOF__BOOL == SIZEOF_LONG
-	{ 't', t_set, t_get, &ffi_type_ulong, L_set_sw, L_get_sw},
+	{ '?', bool_set, bool_get, &ffi_type_ulong, L_set_sw, L_get_sw},
 #elif SIZEOF__BOOL == SIZEOF_LONG_LONG
-	{ 't', t_set, t_get, &ffi_type_ulong, Q_set_sw, Q_get_sw},
+	{ '?', bool_set, bool_get, &ffi_type_ulong, Q_set_sw, Q_get_sw},
 #endif /* SIZEOF__BOOL */
 	{ 'O', O_set, O_get, &ffi_type_pointer},
 	{ 0, NULL, NULL, NULL},
diff --git a/Modules/_struct.c b/Modules/_struct.c
index 8e5420c..e5fe211 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -799,7 +799,7 @@
 	{'q',	sizeof(PY_LONG_LONG), LONG_LONG_ALIGN, nu_longlong, np_longlong},
 	{'Q',	sizeof(PY_LONG_LONG), LONG_LONG_ALIGN, nu_ulonglong,np_ulonglong},
 #endif
-	{'t',	sizeof(BOOL_TYPE),	BOOL_ALIGN,	nu_bool,	np_bool},
+	{'?',	sizeof(BOOL_TYPE),	BOOL_ALIGN,	nu_bool,	np_bool},
 	{'f',	sizeof(float),	FLOAT_ALIGN,	nu_float,	np_float},
 	{'d',	sizeof(double),	DOUBLE_ALIGN,	nu_double,	np_double},
 	{'P',	sizeof(void *),	VOID_P_ALIGN,	nu_void_p,	np_void_p},
@@ -1036,7 +1036,7 @@
 	{'L',	4,		0,		bu_uint,	bp_uint},
 	{'q',	8,		0,		bu_longlong,	bp_longlong},
 	{'Q',	8,		0,		bu_ulonglong,	bp_ulonglong},
-	{'t',	1,		0,		bu_bool,	bp_bool},
+	{'?',	1,		0,		bu_bool,	bp_bool},
 	{'f',	4,		0,		bu_float,	bp_float},
 	{'d',	8,		0,		bu_double,	bp_double},
 	{0}
@@ -1255,7 +1255,7 @@
 	{'L',	4,		0,		lu_uint,	lp_uint},
 	{'q',	8,		0,		lu_longlong,	lp_longlong},
 	{'Q',	8,		0,		lu_ulonglong,	lp_ulonglong},
-	{'t',	1,		0,		bu_bool,	bp_bool}, /* Std rep not endian dep,
+	{'?',	1,		0,		bu_bool,	bp_bool}, /* Std rep not endian dep,
 		but potentially different from native rep -- reuse bx_bool funcs. */
 	{'f',	4,		0,		lu_float,	lp_float},
 	{'d',	8,		0,		lu_double,	lp_double},