|
|
#ifndef Py_PYPORT_H |
|
|
#define Py_PYPORT_H |
|
|
|
|
|
#include "pyconfig.h" |
|
|
|
|
|
#include <inttypes.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(Py_BUILD_CORE_BUILTIN) && !defined(Py_BUILD_CORE) |
|
|
# define Py_BUILD_CORE |
|
|
#endif |
|
|
#if defined(Py_BUILD_CORE_MODULE) && !defined(Py_BUILD_CORE) |
|
|
# define Py_BUILD_CORE |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef HAVE_LONG_LONG |
|
|
#define HAVE_LONG_LONG 1 |
|
|
#endif |
|
|
#ifndef PY_LONG_LONG |
|
|
#define PY_LONG_LONG long long |
|
|
|
|
|
#define PY_LLONG_MIN LLONG_MIN |
|
|
#define PY_LLONG_MAX LLONG_MAX |
|
|
#define PY_ULLONG_MAX ULLONG_MAX |
|
|
#endif |
|
|
|
|
|
#define PY_UINT32_T uint32_t |
|
|
#define PY_UINT64_T uint64_t |
|
|
|
|
|
|
|
|
#define PY_INT32_T int32_t |
|
|
#define PY_INT64_T int64_t |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef PYLONG_BITS_IN_DIGIT |
|
|
#if SIZEOF_VOID_P >= 8 |
|
|
#define PYLONG_BITS_IN_DIGIT 30 |
|
|
#else |
|
|
#define PYLONG_BITS_IN_DIGIT 15 |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef uintptr_t Py_uintptr_t; |
|
|
typedef intptr_t Py_intptr_t; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_PY_SSIZE_T |
|
|
|
|
|
#elif HAVE_SSIZE_T |
|
|
typedef ssize_t Py_ssize_t; |
|
|
#elif SIZEOF_VOID_P == SIZEOF_SIZE_T |
|
|
typedef Py_intptr_t Py_ssize_t; |
|
|
#else |
|
|
# error "Python needs a typedef for Py_ssize_t in pyport.h." |
|
|
#endif |
|
|
|
|
|
|
|
|
#define SIZEOF_PY_HASH_T SIZEOF_SIZE_T |
|
|
typedef Py_ssize_t Py_hash_t; |
|
|
|
|
|
#define SIZEOF_PY_UHASH_T SIZEOF_SIZE_T |
|
|
typedef size_t Py_uhash_t; |
|
|
|
|
|
|
|
|
#ifdef PY_SSIZE_T_CLEAN |
|
|
typedef Py_ssize_t Py_ssize_clean_t; |
|
|
#else |
|
|
typedef int Py_ssize_clean_t; |
|
|
#endif |
|
|
|
|
|
|
|
|
#define PY_SIZE_MAX SIZE_MAX |
|
|
|
|
|
|
|
|
#define PY_SSIZE_T_MAX ((Py_ssize_t)(((size_t)-1)>>1)) |
|
|
|
|
|
#define PY_SSIZE_T_MIN (-PY_SSIZE_T_MAX-1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef PY_FORMAT_SIZE_T |
|
|
# define PY_FORMAT_SIZE_T "z" |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(_MSC_VER) |
|
|
# if defined(PY_LOCAL_AGGRESSIVE) |
|
|
|
|
|
|
|
|
# pragma optimize("gt", on) |
|
|
#endif |
|
|
|
|
|
# pragma warning(disable: 4710) |
|
|
|
|
|
# define Py_LOCAL(type) static type __fastcall |
|
|
# define Py_LOCAL_INLINE(type) static __inline type __fastcall |
|
|
#else |
|
|
# define Py_LOCAL(type) static type |
|
|
# define Py_LOCAL_INLINE(type) static inline type |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#define Py_MEMCPY memcpy |
|
|
|
|
|
#include <stdlib.h> |
|
|
|
|
|
#ifdef HAVE_IEEEFP_H |
|
|
#include <ieeefp.h> |
|
|
#endif |
|
|
|
|
|
#include <math.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef TIME_WITH_SYS_TIME |
|
|
#include <sys/time.h> |
|
|
#include <time.h> |
|
|
#else |
|
|
#ifdef HAVE_SYS_TIME_H |
|
|
#include <sys/time.h> |
|
|
#else |
|
|
#include <time.h> |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_SELECT_H |
|
|
#include <sys/select.h> |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_STAT_H |
|
|
#include <sys/stat.h> |
|
|
#elif defined(HAVE_STAT_H) |
|
|
#include <stat.h> |
|
|
#endif |
|
|
|
|
|
#ifndef S_IFMT |
|
|
|
|
|
#define S_IFMT 0170000 |
|
|
#endif |
|
|
|
|
|
#ifndef S_IFLNK |
|
|
|
|
|
|
|
|
# define S_IFLNK 0120000 |
|
|
#endif |
|
|
|
|
|
#ifndef S_ISREG |
|
|
#define S_ISREG(x) (((x) & S_IFMT) == S_IFREG) |
|
|
#endif |
|
|
|
|
|
#ifndef S_ISDIR |
|
|
#define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR) |
|
|
#endif |
|
|
|
|
|
#ifndef S_ISCHR |
|
|
#define S_ISCHR(x) (((x) & S_IFMT) == S_IFCHR) |
|
|
#endif |
|
|
|
|
|
#ifdef __cplusplus |
|
|
|
|
|
|
|
|
extern "C" { |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef SIGNED_RIGHT_SHIFT_ZERO_FILLS |
|
|
#define Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) \ |
|
|
((I) < 0 ? -1-((-1-(I)) >> (J)) : (I) >> (J)) |
|
|
#else |
|
|
#define Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) ((I) >> (J)) |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define Py_FORCE_EXPANSION(X) X |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef Py_DEBUG |
|
|
#define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) \ |
|
|
(assert((WIDE)(NARROW)(VALUE) == (VALUE)), (NARROW)(VALUE)) |
|
|
#else |
|
|
#define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) (NARROW)(VALUE) |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(__FreeBSD__) || defined(__OpenBSD__) || (defined(__hpux) && defined(__ia64)) |
|
|
#define _Py_SET_EDOM_FOR_NAN(X) if (isnan(X)) errno = EDOM; |
|
|
#else |
|
|
#define _Py_SET_EDOM_FOR_NAN(X) ; |
|
|
#endif |
|
|
#define Py_SET_ERRNO_ON_MATH_ERROR(X) \ |
|
|
do { \ |
|
|
if (errno == 0) { \ |
|
|
if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \ |
|
|
errno = ERANGE; \ |
|
|
else _Py_SET_EDOM_FOR_NAN(X) \ |
|
|
} \ |
|
|
} while(0) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define Py_SET_ERANGE_IF_OVERFLOW(X) Py_SET_ERRNO_ON_MATH_ERROR(X) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define Py_ADJUST_ERANGE1(X) \ |
|
|
do { \ |
|
|
if (errno == 0) { \ |
|
|
if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \ |
|
|
errno = ERANGE; \ |
|
|
} \ |
|
|
else if (errno == ERANGE && (X) == 0.0) \ |
|
|
errno = 0; \ |
|
|
} while(0) |
|
|
|
|
|
#define Py_ADJUST_ERANGE2(X, Y) \ |
|
|
do { \ |
|
|
if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL || \ |
|
|
(Y) == Py_HUGE_VAL || (Y) == -Py_HUGE_VAL) { \ |
|
|
if (errno == 0) \ |
|
|
errno = ERANGE; \ |
|
|
} \ |
|
|
else if (errno == ERANGE) \ |
|
|
errno = 0; \ |
|
|
} while(0) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_GCC_ASM_FOR_X87 |
|
|
#define HAVE_PY_SET_53BIT_PRECISION 1 |
|
|
|
|
|
#define _Py_SET_53BIT_PRECISION_HEADER \ |
|
|
unsigned short old_387controlword, new_387controlword |
|
|
#define _Py_SET_53BIT_PRECISION_START \ |
|
|
do { \ |
|
|
old_387controlword = _Py_get_387controlword(); \ |
|
|
new_387controlword = (old_387controlword & ~0x0f00) | 0x0200; \ |
|
|
if (new_387controlword != old_387controlword) \ |
|
|
_Py_set_387controlword(new_387controlword); \ |
|
|
} while (0) |
|
|
#define _Py_SET_53BIT_PRECISION_END \ |
|
|
if (new_387controlword != old_387controlword) \ |
|
|
_Py_set_387controlword(old_387controlword) |
|
|
#endif |
|
|
|
|
|
|
|
|
#if defined(_MSC_VER) && !defined(_WIN64) && !defined(_M_ARM) |
|
|
#define HAVE_PY_SET_53BIT_PRECISION 1 |
|
|
#define _Py_SET_53BIT_PRECISION_HEADER \ |
|
|
unsigned int old_387controlword, new_387controlword, out_387controlword |
|
|
|
|
|
|
|
|
#define _Py_SET_53BIT_PRECISION_START \ |
|
|
do { \ |
|
|
__control87_2(0, 0, &old_387controlword, NULL); \ |
|
|
new_387controlword = \ |
|
|
(old_387controlword & ~(_MCW_PC | _MCW_RC)) | (_PC_53 | _RC_NEAR); \ |
|
|
if (new_387controlword != old_387controlword) \ |
|
|
__control87_2(new_387controlword, _MCW_PC | _MCW_RC, \ |
|
|
&out_387controlword, NULL); \ |
|
|
} while (0) |
|
|
#define _Py_SET_53BIT_PRECISION_END \ |
|
|
do { \ |
|
|
if (new_387controlword != old_387controlword) \ |
|
|
__control87_2(old_387controlword, _MCW_PC | _MCW_RC, \ |
|
|
&out_387controlword, NULL); \ |
|
|
} while (0) |
|
|
#endif |
|
|
|
|
|
#ifdef HAVE_GCC_ASM_FOR_MC68881 |
|
|
#define HAVE_PY_SET_53BIT_PRECISION 1 |
|
|
#define _Py_SET_53BIT_PRECISION_HEADER \ |
|
|
unsigned int old_fpcr, new_fpcr |
|
|
#define _Py_SET_53BIT_PRECISION_START \ |
|
|
do { \ |
|
|
__asm__ ("fmove.l %%fpcr,%0" : "=g" (old_fpcr)); \ |
|
|
\ |
|
|
new_fpcr = (old_fpcr & ~0xf0) | 0x80; \ |
|
|
if (new_fpcr != old_fpcr) \ |
|
|
__asm__ volatile ("fmove.l %0,%%fpcr" : : "g" (new_fpcr)); \ |
|
|
} while (0) |
|
|
#define _Py_SET_53BIT_PRECISION_END \ |
|
|
do { \ |
|
|
if (new_fpcr != old_fpcr) \ |
|
|
__asm__ volatile ("fmove.l %0,%%fpcr" : : "g" (old_fpcr)); \ |
|
|
} while (0) |
|
|
#endif |
|
|
|
|
|
|
|
|
#ifndef HAVE_PY_SET_53BIT_PRECISION |
|
|
#define _Py_SET_53BIT_PRECISION_HEADER |
|
|
#define _Py_SET_53BIT_PRECISION_START |
|
|
#define _Py_SET_53BIT_PRECISION_END |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if !defined(DOUBLE_IS_LITTLE_ENDIAN_IEEE754) && \ |
|
|
!defined(DOUBLE_IS_BIG_ENDIAN_IEEE754) && \ |
|
|
!defined(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754) |
|
|
#define PY_NO_SHORT_FLOAT_REPR |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(X87_DOUBLE_ROUNDING) && !defined(HAVE_PY_SET_53BIT_PRECISION) |
|
|
#define PY_NO_SHORT_FLOAT_REPR |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(__GNUC__) \ |
|
|
&& ((__GNUC__ >= 4) || (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)) |
|
|
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__)) |
|
|
#elif defined(_MSC_VER) |
|
|
#define Py_DEPRECATED(VERSION) __declspec(deprecated( \ |
|
|
"deprecated in " #VERSION)) |
|
|
#else |
|
|
#define Py_DEPRECATED(VERSION_UNUSED) |
|
|
#endif |
|
|
|
|
|
#if defined(__clang__) |
|
|
#define _Py_COMP_DIAG_PUSH _Pragma("clang diagnostic push") |
|
|
#define _Py_COMP_DIAG_IGNORE_DEPR_DECLS \ |
|
|
_Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") |
|
|
#define _Py_COMP_DIAG_POP _Pragma("clang diagnostic pop") |
|
|
#elif defined(__GNUC__) \ |
|
|
&& ((__GNUC__ >= 5) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) |
|
|
#define _Py_COMP_DIAG_PUSH _Pragma("GCC diagnostic push") |
|
|
#define _Py_COMP_DIAG_IGNORE_DEPR_DECLS \ |
|
|
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") |
|
|
#define _Py_COMP_DIAG_POP _Pragma("GCC diagnostic pop") |
|
|
#elif defined(_MSC_VER) |
|
|
#define _Py_COMP_DIAG_PUSH __pragma(warning(push)) |
|
|
#define _Py_COMP_DIAG_IGNORE_DEPR_DECLS __pragma(warning(disable: 4996)) |
|
|
#define _Py_COMP_DIAG_POP __pragma(warning(pop)) |
|
|
#else |
|
|
#define _Py_COMP_DIAG_PUSH |
|
|
#define _Py_COMP_DIAG_IGNORE_DEPR_DECLS |
|
|
#define _Py_COMP_DIAG_POP |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(__GNUC__) \ |
|
|
&& ((__GNUC__ >= 5) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) |
|
|
#define _Py_HOT_FUNCTION __attribute__((hot)) |
|
|
#else |
|
|
#define _Py_HOT_FUNCTION |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(_MSC_VER) |
|
|
# define _Py_NO_INLINE __declspec(noinline) |
|
|
#elif defined(__GNUC__) || defined(__clang__) |
|
|
# define _Py_NO_INLINE __attribute__ ((noinline)) |
|
|
#else |
|
|
# define _Py_NO_INLINE |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef SOLARIS |
|
|
|
|
|
extern int gethostname(char *, int); |
|
|
#endif |
|
|
|
|
|
#ifdef HAVE__GETPTY |
|
|
#include <sys/types.h> |
|
|
extern char * _getpty(int *, int, mode_t, int); |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(HAVE_SYS_TERMIO_H) && !defined(__hpux) |
|
|
#include <sys/termio.h> |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(__APPLE__) |
|
|
# define _PY_PORT_CTYPE_UTF8_ISSUE |
|
|
#endif |
|
|
|
|
|
#ifdef _PY_PORT_CTYPE_UTF8_ISSUE |
|
|
#ifndef __cplusplus |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <ctype.h> |
|
|
#include <wctype.h> |
|
|
#undef isalnum |
|
|
#define isalnum(c) iswalnum(btowc(c)) |
|
|
#undef isalpha |
|
|
#define isalpha(c) iswalpha(btowc(c)) |
|
|
#undef islower |
|
|
#define islower(c) iswlower(btowc(c)) |
|
|
#undef isspace |
|
|
#define isspace(c) iswspace(btowc(c)) |
|
|
#undef isupper |
|
|
#define isupper(c) iswupper(btowc(c)) |
|
|
#undef tolower |
|
|
#define tolower(c) towlower(btowc(c)) |
|
|
#undef toupper |
|
|
#define toupper(c) towupper(btowc(c)) |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(__CYGWIN__) |
|
|
# define HAVE_DECLSPEC_DLL |
|
|
#endif |
|
|
|
|
|
#include "exports.h" |
|
|
|
|
|
|
|
|
#if defined(Py_ENABLE_SHARED) || defined(__CYGWIN__) |
|
|
# if defined(HAVE_DECLSPEC_DLL) |
|
|
# if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
|
|
# define PyAPI_FUNC(RTYPE) Py_EXPORTED_SYMBOL RTYPE |
|
|
# define PyAPI_DATA(RTYPE) extern Py_EXPORTED_SYMBOL RTYPE |
|
|
|
|
|
|
|
|
# if defined(__CYGWIN__) |
|
|
# define PyMODINIT_FUNC Py_EXPORTED_SYMBOL PyObject* |
|
|
# else |
|
|
# define PyMODINIT_FUNC PyObject* |
|
|
# endif |
|
|
# else |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# if !defined(__CYGWIN__) |
|
|
# define PyAPI_FUNC(RTYPE) Py_IMPORTED_SYMBOL RTYPE |
|
|
# endif |
|
|
# define PyAPI_DATA(RTYPE) extern Py_IMPORTED_SYMBOL RTYPE |
|
|
|
|
|
# if defined(__cplusplus) |
|
|
# define PyMODINIT_FUNC extern "C" Py_EXPORTED_SYMBOL PyObject* |
|
|
# else |
|
|
# define PyMODINIT_FUNC Py_EXPORTED_SYMBOL PyObject* |
|
|
# endif |
|
|
# endif |
|
|
# endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#ifndef PyAPI_FUNC |
|
|
# define PyAPI_FUNC(RTYPE) Py_EXPORTED_SYMBOL RTYPE |
|
|
#endif |
|
|
#ifndef PyAPI_DATA |
|
|
# define PyAPI_DATA(RTYPE) extern Py_EXPORTED_SYMBOL RTYPE |
|
|
#endif |
|
|
#ifndef PyMODINIT_FUNC |
|
|
# if defined(__cplusplus) |
|
|
# define PyMODINIT_FUNC extern "C" Py_EXPORTED_SYMBOL PyObject* |
|
|
# else |
|
|
# define PyMODINIT_FUNC Py_EXPORTED_SYMBOL PyObject* |
|
|
# endif |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#ifndef INT_MAX |
|
|
#define INT_MAX 2147483647 |
|
|
#endif |
|
|
|
|
|
#ifndef LONG_MAX |
|
|
#if SIZEOF_LONG == 4 |
|
|
#define LONG_MAX 0X7FFFFFFFL |
|
|
#elif SIZEOF_LONG == 8 |
|
|
#define LONG_MAX 0X7FFFFFFFFFFFFFFFL |
|
|
#else |
|
|
#error "could not set LONG_MAX in pyport.h" |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
#ifndef LONG_MIN |
|
|
#define LONG_MIN (-LONG_MAX-1) |
|
|
#endif |
|
|
|
|
|
#ifndef LONG_BIT |
|
|
#define LONG_BIT (8 * SIZEOF_LONG) |
|
|
#endif |
|
|
|
|
|
#if LONG_BIT != 8 * SIZEOF_LONG |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)." |
|
|
#endif |
|
|
|
|
|
#ifdef __cplusplus |
|
|
} |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if (!defined(__GNUC__) || __GNUC__ < 2 || \ |
|
|
(__GNUC__ == 2 && __GNUC_MINOR__ < 7) ) |
|
|
#define Py_GCC_ATTRIBUTE(x) |
|
|
#else |
|
|
#define Py_GCC_ATTRIBUTE(x) __attribute__(x) |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(__GNUC__) && __GNUC__ >= 3 |
|
|
#define Py_ALIGNED(x) __attribute__((aligned(x))) |
|
|
#else |
|
|
#define Py_ALIGNED(x) |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __SUNPRO_C |
|
|
#pragma error_messages (off,E_END_OF_LOOP_CODE_NOT_REACHED) |
|
|
#endif |
|
|
|
|
|
#ifndef Py_LL |
|
|
#define Py_LL(x) x##LL |
|
|
#endif |
|
|
|
|
|
#ifndef Py_ULL |
|
|
#define Py_ULL(x) Py_LL(x##U) |
|
|
#endif |
|
|
|
|
|
#define Py_VA_COPY va_copy |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef WORDS_BIGENDIAN |
|
|
# define PY_BIG_ENDIAN 1 |
|
|
# define PY_LITTLE_ENDIAN 0 |
|
|
#else |
|
|
# define PY_BIG_ENDIAN 0 |
|
|
# define PY_LITTLE_ENDIAN 1 |
|
|
#endif |
|
|
|
|
|
#ifdef Py_BUILD_CORE |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined _MSC_VER && _MSC_VER >= 1900 |
|
|
|
|
|
extern _invalid_parameter_handler _Py_silent_invalid_parameter_handler; |
|
|
#define _Py_BEGIN_SUPPRESS_IPH { _invalid_parameter_handler _Py_old_handler = \ |
|
|
_set_thread_local_invalid_parameter_handler(_Py_silent_invalid_parameter_handler); |
|
|
#define _Py_END_SUPPRESS_IPH _set_thread_local_invalid_parameter_handler(_Py_old_handler); } |
|
|
|
|
|
#else |
|
|
|
|
|
#define _Py_BEGIN_SUPPRESS_IPH |
|
|
#define _Py_END_SUPPRESS_IPH |
|
|
|
|
|
#endif |
|
|
#endif |
|
|
|
|
|
#ifdef __ANDROID__ |
|
|
|
|
|
# undef HAVE_LANGINFO_H |
|
|
# undef CODESET |
|
|
#endif |
|
|
|
|
|
|
|
|
#define PY_DWORD_MAX 4294967295U |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef WITH_THREAD |
|
|
# define WITH_THREAD |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#if defined(ALT_SOABI) && defined(Py_TRACE_REFS) |
|
|
# error "Py_TRACE_REFS ABI is not compatible with release and debug ABI" |
|
|
#endif |
|
|
|
|
|
#if defined(__ANDROID__) || defined(__VXWORKS__) |
|
|
|
|
|
|
|
|
|
|
|
# define _Py_FORCE_UTF8_LOCALE |
|
|
#endif |
|
|
|
|
|
#if defined(_Py_FORCE_UTF8_LOCALE) || defined(__APPLE__) |
|
|
|
|
|
|
|
|
|
|
|
# define _Py_FORCE_UTF8_FS_ENCODING |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _Py_NO_RETURN |
|
|
#if defined(__clang__) || \ |
|
|
(defined(__GNUC__) && \ |
|
|
((__GNUC__ >= 3) || \ |
|
|
(__GNUC__ == 2) && (__GNUC_MINOR__ >= 5))) |
|
|
# define _Py_NO_RETURN __attribute__((__noreturn__)) |
|
|
#elif defined(_MSC_VER) |
|
|
# define _Py_NO_RETURN __declspec(noreturn) |
|
|
#else |
|
|
# define _Py_NO_RETURN |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __has_builtin |
|
|
# define _Py__has_builtin(x) __has_builtin(x) |
|
|
#else |
|
|
# define _Py__has_builtin(x) 0 |
|
|
#endif |
|
|
|
|
|
|
|
|
#endif |
|
|
|