diff options
author | Martin Panter <vadmium+py@gmail.com> | 2015-10-10 10:15:21 +0000 |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2015-10-10 10:15:21 +0000 |
commit | b4c49a7b40ae96dbdc079b40b6c317bd2cbdeb55 (patch) | |
tree | 450aeb71ba9d9118732554bb4a7a4a22edc3734d /Include/pyport.h | |
parent | e013b9445b6f9caab1eb30b7785e3690d1bab4df (diff) | |
parent | b98a5f90775e5f59662e452b3b31e0c07efa3d2c (diff) | |
download | cpython-b4c49a7b40ae96dbdc079b40b6c317bd2cbdeb55.tar.gz |
Issue #22413: Merge StringIO doc from 3.4 into 3.5
Diffstat (limited to 'Include/pyport.h')
-rw-r--r-- | Include/pyport.h | 61 |
1 files changed, 39 insertions, 22 deletions
diff --git a/Include/pyport.h b/Include/pyport.h index b29f9bd929..66e00d4e6d 100644 --- a/Include/pyport.h +++ b/Include/pyport.h @@ -357,28 +357,6 @@ typedef int Py_ssize_clean_t; * stat() and fstat() fiddling * *******************************/ -/* We expect that stat and fstat exist on most systems. - * It's confirmed on Unix, Mac and Windows. - * If you don't have them, add - * #define DONT_HAVE_STAT - * and/or - * #define DONT_HAVE_FSTAT - * to your pyconfig.h. Python code beyond this should check HAVE_STAT and - * HAVE_FSTAT instead. - * Also - * #define HAVE_SYS_STAT_H - * if <sys/stat.h> exists on your platform, and - * #define HAVE_STAT_H - * if <stat.h> does. - */ -#ifndef DONT_HAVE_STAT -#define HAVE_STAT -#endif - -#ifndef DONT_HAVE_FSTAT -#define HAVE_FSTAT -#endif - #ifdef HAVE_SYS_STAT_H #include <sys/stat.h> #elif defined(HAVE_STAT_H) @@ -588,6 +566,25 @@ extern "C" { } 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)); \ + /* Set double precision / round to nearest. */ \ + 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 + /* default definitions are empty */ #ifndef HAVE_PY_SET_53BIT_PRECISION #define _Py_SET_53BIT_PRECISION_HEADER @@ -880,4 +877,24 @@ extern pid_t forkpty(int *, char *, struct termios *, struct winsize *); #define PY_LITTLE_ENDIAN 1 #endif +#ifdef Py_BUILD_CORE +/* + * Macros to protect CRT calls against instant termination when passed an + * invalid parameter (issue23524). + */ +#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 /* _MSC_VER >= 1900 */ +#endif /* Py_BUILD_CORE */ + #endif /* Py_PYPORT_H */ |