@@ -238,14 +238,9 @@ cdef CefRefPtr[CefListValue] PyListToCefListValue(
238238 ret.get().SetNull(index)
239239 elif valueType == bool :
240240 ret.get().SetBool(index, bool (value))
241- elif valueType == int :
242- ret.get().SetInt(index, int (value))
243- elif valueType == long :
244- # Int32 range is -2147483648..2147483647, we've increased the
245- # minimum size by one as Cython was throwing a warning:
246- # "unary minus operator applied to unsigned type, result still
247- # unsigned".
248- if - 2147483647 <= value <= 2147483647 :
241+ elif valueType == int or valueType == long : # In Py3 int and long types are the same type.
242+ # Int32 range is -2147483648..2147483647
243+ if INT_MIN <= value <= INT_MAX:
249244 ret.get().SetInt(index, int (value))
250245 else :
251246 # Long values become strings.
@@ -297,14 +292,9 @@ cdef void PyListToExistingCefListValue(
297292 cefListValue.get().SetNull(index)
298293 elif valueType == bool :
299294 cefListValue.get().SetBool(index, bool (value))
300- elif valueType == int :
301- cefListValue.get().SetInt(index, int (value))
302- elif valueType == long :
303- # Int32 range is -2147483648..2147483647, we've increased the
304- # minimum size by one as Cython was throwing a warning:
305- # "unary minus operator applied to unsigned type, result still
306- # unsigned".
307- if - 2147483647 <= value <= 2147483647 :
295+ elif valueType == int or valueType == long : # In Py3 int and long types are the same type.
296+ # Int32 range is -2147483648..2147483647
297+ if INT_MIN <= value <= INT_MAX:
308298 cefListValue.get().SetInt(index, int (value))
309299 else :
310300 # Long values become strings.
@@ -357,14 +347,9 @@ cdef CefRefPtr[CefDictionaryValue] PyDictToCefDictionaryValue(
357347 ret.get().SetNull(cefKey)
358348 elif valueType == bool :
359349 ret.get().SetBool(cefKey, bool (value))
360- elif valueType == int :
361- ret.get().SetInt(cefKey, int (value))
362- elif valueType == long :
363- # Int32 range is -2147483648..2147483647, we've increased the
364- # minimum size by one as Cython was throwing a warning:
365- # "unary minus operator applied to unsigned type, result still
366- # unsigned".
367- if - 2147483647 <= value <= 2147483647 :
350+ elif valueType == int or valueType == long : # In Py3 int and long types are the same type.
351+ # Int32 range is -2147483648..2147483647
352+ if INT_MIN <= value <= INT_MAX:
368353 ret.get().SetInt(cefKey, int (value))
369354 else :
370355 # Long values become strings.
0 commit comments