+2013-11-20 Joel Brobecker <brobecker@adacore.com>
+
+ * python/py-value.c (is_intlike): Delete.
+ (valpy_int): Replace use of CHECK_TYPEDEF and is_intlike
+ by use of is_integral_type.
+ (valpy_long): Replace use of CHECK_TYPEDEF and is_intlike
+ by use of is_integral_type and check for TYPE_CODE_PTR.
+
2013-11-20 Tom Tromey <tromey@redhat.com>
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Remove
Py_RETURN_FALSE;
}
-/* Helper function to determine if a type is "int-like". */
-static int
-is_intlike (struct type *type, int ptr_ok)
-{
- return (TYPE_CODE (type) == TYPE_CODE_INT
- || TYPE_CODE (type) == TYPE_CODE_ENUM
- || TYPE_CODE (type) == TYPE_CODE_BOOL
- || TYPE_CODE (type) == TYPE_CODE_CHAR
- || TYPE_CODE (type) == TYPE_CODE_RANGE
- || (ptr_ok && TYPE_CODE (type) == TYPE_CODE_PTR));
-}
-
#ifndef IS_PY3K
/* Implements conversion to int. */
static PyObject *
TRY_CATCH (except, RETURN_MASK_ALL)
{
- CHECK_TYPEDEF (type);
- if (!is_intlike (type, 0))
+ if (!is_integral_type (type))
error (_("Cannot convert value to int."));
l = value_as_long (value);
{
CHECK_TYPEDEF (type);
- if (!is_intlike (type, 1))
+ if (!is_integral_type (type)
+ && TYPE_CODE (type) != TYPE_CODE_PTR)
error (_("Cannot convert value to long."));
l = value_as_long (value);