diff options
author | Lisandro Dalcin <dalcinl@gmail.com> | 2023-05-03 11:05:08 +0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-03 10:05:08 +0300 |
commit | df0df659747cf8d1b716c04ae9eef83f27d7bfe9 (patch) | |
tree | db9cf3400be637a23fdbe568b2bfe8583e07864c | |
parent | 236e705d644247415baacf0a6d38b6e85379cce1 (diff) | |
download | cython-df0df659747cf8d1b716c04ae9eef83f27d7bfe9.tar.gz |
Silence GCC -Wsign-conversion (GH-5421)
* Silence GCC -Wsign-conversion when using CYTHON_LIMITED_API
* Silence GCC -W[sign-]conversion with invocations to PyUnicode_FromOrdinal
-rw-r--r-- | Cython/Compiler/Builtin.py | 2 | ||||
-rw-r--r-- | Cython/Compiler/PyrexTypes.py | 4 | ||||
-rw-r--r-- | Cython/Plex/Machines.pxd | 4 | ||||
-rw-r--r-- | Cython/Plex/Machines.py | 2 | ||||
-rw-r--r-- | Cython/Utility/ModuleSetupCode.c | 4 | ||||
-rw-r--r-- | Cython/Utility/TypeConversion.c | 1 |
6 files changed, 9 insertions, 8 deletions
diff --git a/Cython/Compiler/Builtin.py b/Cython/Compiler/Builtin.py index 6b00e94f9..78b2638d5 100644 --- a/Cython/Compiler/Builtin.py +++ b/Cython/Compiler/Builtin.py @@ -233,7 +233,7 @@ builtin_function_table = [ #('sum', "", "", ""), #('sorted', "", "", ""), #('type', "O", "O", "PyObject_Type"), - BuiltinFunction('unichr', "l", "O", "PyUnicode_FromOrdinal", builtin_return_type='unicode'), + BuiltinFunction('unichr', "i", "O", "PyUnicode_FromOrdinal", builtin_return_type='unicode'), #('unicode', "", "", ""), #('vars', "", "", ""), #('zip', "", "", ""), diff --git a/Cython/Compiler/PyrexTypes.py b/Cython/Compiler/PyrexTypes.py index b20085048..741f0af66 100644 --- a/Cython/Compiler/PyrexTypes.py +++ b/Cython/Compiler/PyrexTypes.py @@ -2248,7 +2248,7 @@ class CPyUCS4IntType(CIntType): # is 0..1114111, which is checked when converting from an integer # value. - to_py_function = "PyUnicode_FromOrdinal" + to_py_function = "__Pyx_PyUnicode_FromOrdinal" from_py_function = "__Pyx_PyObject_AsPy_UCS4" def can_coerce_to_pystring(self, env, format_spec=None): @@ -2272,7 +2272,7 @@ class CPyUnicodeIntType(CIntType): # Py_UNICODE is 0..1114111, which is checked when converting from # an integer value. - to_py_function = "PyUnicode_FromOrdinal" + to_py_function = "__Pyx_PyUnicode_FromOrdinal" from_py_function = "__Pyx_PyObject_AsPy_UNICODE" def can_coerce_to_pystring(self, env, format_spec=None): diff --git a/Cython/Plex/Machines.pxd b/Cython/Plex/Machines.pxd index 8f785a07c..13b43a234 100644 --- a/Cython/Plex/Machines.pxd +++ b/Cython/Plex/Machines.pxd @@ -3,7 +3,7 @@ cimport cython from .Actions cimport Action from .Transitions cimport TransitionMap -cdef long maxint +cdef int maxint @cython.final @@ -22,7 +22,7 @@ cdef class Node: cdef readonly Action action cdef public dict epsilon_closure cdef readonly Py_ssize_t number - cdef readonly long action_priority + cdef readonly int action_priority @cython.final diff --git a/Cython/Plex/Machines.py b/Cython/Plex/Machines.py index baf3f1918..77b65c1a9 100644 --- a/Cython/Plex/Machines.py +++ b/Cython/Plex/Machines.py @@ -154,7 +154,7 @@ class FastMachine(object): def make_initial_state(self, name, state): self.initial_states[name] = state - @cython.locals(code0=cython.long, code1=cython.long, maxint=cython.long, state=dict) + @cython.locals(code0=cython.int, code1=cython.int, maxint=cython.int, state=dict) def add_transitions(self, state, event, new_state, maxint=maxint): if type(event) is tuple: code0, code1 = event diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c index c7e94c869..c1b2ed146 100644 --- a/Cython/Utility/ModuleSetupCode.c +++ b/Cython/Utility/ModuleSetupCode.c @@ -1018,7 +1018,7 @@ static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) // __Pyx_PyUnicode_DATA() and __Pyx_PyUnicode_READ() must go together, e.g. for iteration. #define __Pyx_PyUnicode_DATA(u) ((void*)u) @@ -1063,7 +1063,7 @@ static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) // (void)(k) => avoid unused variable warning due to macro: diff --git a/Cython/Utility/TypeConversion.c b/Cython/Utility/TypeConversion.c index 2ca03e05b..382bcbf27 100644 --- a/Cython/Utility/TypeConversion.c +++ b/Cython/Utility/TypeConversion.c @@ -96,6 +96,7 @@ static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) } #endif +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode |