@@ -1358,7 +1358,6 @@ static PyGetSetDef CharArray_getsets[] = {
13581358 { NULL , NULL }
13591359};
13601360
1361- #ifdef CTYPES_UNICODE
13621361static PyObject *
13631362WCharArray_get_value (CDataObject * self , void * Py_UNUSED (ignored ))
13641363{
@@ -1408,7 +1407,6 @@ static PyGetSetDef WCharArray_getsets[] = {
14081407 "string value" },
14091408 { NULL , NULL }
14101409};
1411- #endif
14121410
14131411/*
14141412 The next three functions copied from Python's typeobject.c.
@@ -1615,11 +1613,10 @@ PyCArrayType_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
16151613 if (itemdict -> getfunc == _ctypes_get_fielddesc ("c" )-> getfunc ) {
16161614 if (-1 == add_getset (result , CharArray_getsets ))
16171615 goto error ;
1618- #ifdef CTYPES_UNICODE
1619- } else if (itemdict -> getfunc == _ctypes_get_fielddesc ("u" )-> getfunc ) {
1616+ }
1617+ else if (itemdict -> getfunc == _ctypes_get_fielddesc ("u" )-> getfunc ) {
16201618 if (-1 == add_getset (result , WCharArray_getsets ))
16211619 goto error ;
1622- #endif
16231620 }
16241621
16251622 return (PyObject * )result ;
@@ -4654,7 +4651,6 @@ Array_subscript(PyObject *myself, PyObject *item)
46544651 PyMem_Free (dest );
46554652 return np ;
46564653 }
4657- #ifdef CTYPES_UNICODE
46584654 if (itemdict -> getfunc == _ctypes_get_fielddesc ("u" )-> getfunc ) {
46594655 wchar_t * ptr = (wchar_t * )self -> b_ptr ;
46604656 wchar_t * dest ;
@@ -4681,7 +4677,6 @@ Array_subscript(PyObject *myself, PyObject *item)
46814677 PyMem_Free (dest );
46824678 return np ;
46834679 }
4684- #endif
46854680
46864681 np = PyList_New (slicelen );
46874682 if (np == NULL )
@@ -5350,7 +5345,6 @@ Pointer_subscript(PyObject *myself, PyObject *item)
53505345 PyMem_Free (dest );
53515346 return np ;
53525347 }
5353- #ifdef CTYPES_UNICODE
53545348 if (itemdict -> getfunc == _ctypes_get_fielddesc ("u" )-> getfunc ) {
53555349 wchar_t * ptr = * (wchar_t * * )self -> b_ptr ;
53565350 wchar_t * dest ;
@@ -5371,7 +5365,6 @@ Pointer_subscript(PyObject *myself, PyObject *item)
53715365 PyMem_Free (dest );
53725366 return np ;
53735367 }
5374- #endif
53755368
53765369 np = PyList_New (len );
53775370 if (np == NULL )
@@ -5653,7 +5646,7 @@ cast(void *ptr, PyObject *src, PyObject *ctype)
56535646 return NULL ;
56545647}
56555648
5656- #ifdef CTYPES_UNICODE
5649+
56575650static PyObject *
56585651wstring_at (const wchar_t * ptr , int size )
56595652{
@@ -5665,7 +5658,6 @@ wstring_at(const wchar_t *ptr, int size)
56655658 ssize = wcslen (ptr );
56665659 return PyUnicode_FromWideChar (ptr , ssize );
56675660}
5668- #endif
56695661
56705662
56715663static struct PyModuleDef _ctypesmodule = {
@@ -5796,9 +5788,7 @@ _ctypes_add_objects(PyObject *mod)
57965788 MOD_ADD ("_memset_addr" , PyLong_FromVoidPtr (memset ));
57975789 MOD_ADD ("_string_at_addr" , PyLong_FromVoidPtr (string_at ));
57985790 MOD_ADD ("_cast_addr" , PyLong_FromVoidPtr (cast ));
5799- #ifdef CTYPES_UNICODE
58005791 MOD_ADD ("_wstring_at_addr" , PyLong_FromVoidPtr (wstring_at ));
5801- #endif
58025792
58035793/* If RTLD_LOCAL is not defined (Windows!), set it to zero. */
58045794#if !HAVE_DECL_RTLD_LOCAL
0 commit comments