diff options
Diffstat (limited to 'Include')
-rw-r--r-- | Include/abstract.h | 8 | ||||
-rw-r--r-- | Include/longobject.h | 5 | ||||
-rw-r--r-- | Include/object.h | 1 | ||||
-rw-r--r-- | Include/pyerrors.h | 1 | ||||
-rw-r--r-- | Include/pyport.h | 16 |
5 files changed, 30 insertions, 1 deletions
diff --git a/Include/abstract.h b/Include/abstract.h index 661c288..23bff6d 100644 --- a/Include/abstract.h +++ b/Include/abstract.h @@ -851,6 +851,14 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ expression: o1 |= o2. */ + PyAPI_FUNC(PyObject *) PyNumber_ToBase(PyObject *n, int base); + + /* + Returns the integer n converted to a string with a base, with a base + marker of 0b, 0o or 0x prefixed if applicable. + If n is not an int object, it is converted with PyNumber_Index first. + */ + /* Sequence protocol:*/ diff --git a/Include/longobject.h b/Include/longobject.h index 9ec1902..e8981eb 100644 --- a/Include/longobject.h +++ b/Include/longobject.h @@ -109,6 +109,11 @@ PyAPI_FUNC(int) _PyLong_AsByteArray(PyLongObject* v, unsigned char* bytes, size_t n, int little_endian, int is_signed); + +/* _PyLong_Format: Convert the long to a string object with given base, + appending a base prefix of 0[box] if base is 2, 8 or 16. */ +PyAPI_FUNC(PyObject *) _PyLong_Format(PyObject *aa, int base); + #ifdef __cplusplus } #endif diff --git a/Include/object.h b/Include/object.h index fbeb915..46f4ce6 100644 --- a/Include/object.h +++ b/Include/object.h @@ -171,6 +171,7 @@ typedef struct { unaryfunc nb_int; unaryfunc nb_long; unaryfunc nb_float; + /* NB: nb_oct and nb_hex are not used anymore. */ unaryfunc nb_oct; unaryfunc nb_hex; diff --git a/Include/pyerrors.h b/Include/pyerrors.h index 1f7b2ca..1eacbaf 100644 --- a/Include/pyerrors.h +++ b/Include/pyerrors.h @@ -105,7 +105,6 @@ PyAPI_DATA(PyObject *) PyExc_BaseException; PyAPI_DATA(PyObject *) PyExc_Exception; PyAPI_DATA(PyObject *) PyExc_StopIteration; PyAPI_DATA(PyObject *) PyExc_GeneratorExit; -PyAPI_DATA(PyObject *) PyExc_StandardError; PyAPI_DATA(PyObject *) PyExc_ArithmeticError; PyAPI_DATA(PyObject *) PyExc_LookupError; diff --git a/Include/pyport.h b/Include/pyport.h index 92ce3ae..febc21e 100644 --- a/Include/pyport.h +++ b/Include/pyport.h @@ -50,6 +50,22 @@ Used in: PY_LONG_LONG #ifdef HAVE_LONG_LONG #ifndef PY_LONG_LONG #define PY_LONG_LONG long long +#if defined(LLONG_MAX) +/* If LLONG_MAX is defined in limits.h, use that. */ +#define PY_LLONG_MIN LLONG_MIN +#define PY_LLONG_MAX LLONG_MAX +#define PY_ULLONG_MAX ULLONG_MAX +#elif defined(__LONG_LONG_MAX__) +/* Otherwise, if GCC has a builtin define, use that. */ +#define PY_LLONG_MAX __LONG_LONG_MAX__ +#define PY_LLONG_MIN (-PY_LLONG_MAX-1) +#define PY_ULLONG_MAX (__LONG_LONG_MAX__*2ULL + 1ULL) +#else +/* Otherwise, rely on two's complement. */ +#define PY_ULLONG_MAX (~0ULL) +#define PY_LLONG_MAX ((long long)(PY_ULLONG_MAX>>1)) +#define PY_LLONG_MIN (-PY_LLONG_MAX-1) +#endif /* LLONG_MAX */ #endif #endif /* HAVE_LONG_LONG */ |