mirror of https://github.com/python/cpython
bpo-45434: Move _Py_BEGIN_SUPPRESS_IPH to pycore_fileutils.h (GH-28922)
This commit is contained in:
parent
7cdc2a0f4b
commit
97308dfcdc
|
@ -80,6 +80,25 @@ extern int _Py_add_relfile(wchar_t *dirname,
|
||||||
const wchar_t *relfile,
|
const wchar_t *relfile,
|
||||||
size_t bufsize);
|
size_t bufsize);
|
||||||
|
|
||||||
|
// Macros to protect CRT calls against instant termination when passed an
|
||||||
|
// invalid parameter (bpo-23524). IPH stands for Invalid Parameter Handler.
|
||||||
|
// Usage:
|
||||||
|
//
|
||||||
|
// _Py_BEGIN_SUPPRESS_IPH
|
||||||
|
// ...
|
||||||
|
// _Py_END_SUPPRESS_IPH
|
||||||
|
#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 */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -712,26 +712,6 @@ extern char * _getpty(int *, int, mode_t, int);
|
||||||
# define PY_LITTLE_ENDIAN 1
|
# define PY_LITTLE_ENDIAN 1
|
||||||
#endif
|
#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 */
|
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
/* The Android langinfo.h header is not used. */
|
/* The Android langinfo.h header is not used. */
|
||||||
# undef HAVE_LANGINFO_H
|
# undef HAVE_LANGINFO_H
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
#define PY_SSIZE_T_CLEAN
|
#define PY_SSIZE_T_CLEAN
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
#include "pycore_object.h"
|
#include "pycore_fileutils.h" // _Py_BEGIN_SUPPRESS_IPH
|
||||||
|
#include "pycore_object.h" // _PyObject_GC_UNTRACK()
|
||||||
#include "structmember.h" // PyMemberDef
|
#include "structmember.h" // PyMemberDef
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
|
|
||||||
#define PY_SSIZE_T_CLEAN
|
#define PY_SSIZE_T_CLEAN
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
#include "pycore_object.h"
|
#include "pycore_fileutils.h" // _Py_BEGIN_SUPPRESS_IPH
|
||||||
|
#include "pycore_object.h" // _PyObject_GC_UNTRACK()
|
||||||
|
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "pycore_atomic.h" // _Py_atomic_int
|
#include "pycore_atomic.h" // _Py_atomic_int
|
||||||
#include "pycore_call.h" // _PyObject_Call()
|
#include "pycore_call.h" // _PyObject_Call()
|
||||||
#include "pycore_ceval.h" // _PyEval_SignalReceived()
|
#include "pycore_ceval.h" // _PyEval_SignalReceived()
|
||||||
|
#include "pycore_fileutils.h" // _Py_BEGIN_SUPPRESS_IPH
|
||||||
#include "pycore_frame.h" // InterpreterFrame
|
#include "pycore_frame.h" // InterpreterFrame
|
||||||
#include "pycore_moduleobject.h" // _PyModule_GetState()
|
#include "pycore_moduleobject.h" // _PyModule_GetState()
|
||||||
#include "pycore_pyerrors.h" // _PyErr_SetString()
|
#include "pycore_pyerrors.h" // _PyErr_SetString()
|
||||||
|
|
|
@ -1,33 +1,28 @@
|
||||||
/* Time module */
|
/* Time module */
|
||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
#include "pycore_fileutils.h" // _Py_BEGIN_SUPPRESS_IPH
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TIMES_H
|
#ifdef HAVE_SYS_TIMES_H
|
||||||
#include <sys/times.h>
|
# include <sys/times.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
#include <sys/types.h>
|
# include <sys/types.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_SYS_RESOURCE_H)
|
#if defined(HAVE_SYS_RESOURCE_H)
|
||||||
#include <sys/resource.h>
|
# include <sys/resource.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef QUICKWIN
|
#ifdef QUICKWIN
|
||||||
#include <io.h>
|
# include <io.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_PTHREAD_H)
|
#if defined(HAVE_PTHREAD_H)
|
||||||
# include <pthread.h>
|
# include <pthread.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_AIX)
|
#if defined(_AIX)
|
||||||
# include <sys/thread.h>
|
# include <sys/thread.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__WATCOMC__) && !defined(__QNX__)
|
#if defined(__WATCOMC__) && !defined(__QNX__)
|
||||||
# include <i86.h>
|
# include <i86.h>
|
||||||
#else
|
#else
|
||||||
|
@ -38,17 +33,17 @@
|
||||||
#endif /* !__WATCOMC__ || __QNX__ */
|
#endif /* !__WATCOMC__ || __QNX__ */
|
||||||
|
|
||||||
#ifdef _Py_MEMORY_SANITIZER
|
#ifdef _Py_MEMORY_SANITIZER
|
||||||
# include <sanitizer/msan_interface.h>
|
# include <sanitizer/msan_interface.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define _Py_timezone _timezone
|
# define _Py_timezone _timezone
|
||||||
#define _Py_daylight _daylight
|
# define _Py_daylight _daylight
|
||||||
#define _Py_tzname _tzname
|
# define _Py_tzname _tzname
|
||||||
#else
|
#else
|
||||||
#define _Py_timezone timezone
|
# define _Py_timezone timezone
|
||||||
#define _Py_daylight daylight
|
# define _Py_daylight daylight
|
||||||
#define _Py_tzname tzname
|
# define _Py_tzname tzname
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__APPLE__ ) && defined(__has_builtin)
|
#if defined(__APPLE__ ) && defined(__has_builtin)
|
||||||
|
@ -60,8 +55,10 @@
|
||||||
# define HAVE_CLOCK_GETTIME_RUNTIME 1
|
# define HAVE_CLOCK_GETTIME_RUNTIME 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define SEC_TO_NS (1000 * 1000 * 1000)
|
#define SEC_TO_NS (1000 * 1000 * 1000)
|
||||||
|
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
static int pysleep(_PyTime_t timeout);
|
static int pysleep(_PyTime_t timeout);
|
||||||
|
|
||||||
|
|
|
@ -80,9 +80,9 @@
|
||||||
|
|
||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
#include "pycore_fileutils.h" // _Py_add_relfile()
|
||||||
#include "pycore_initconfig.h" // PyStatus
|
#include "pycore_initconfig.h" // PyStatus
|
||||||
#include "pycore_pathconfig.h" // _PyPathConfig
|
#include "pycore_pathconfig.h" // _PyPathConfig
|
||||||
#include "pycore_fileutils.h" // _Py_add_relfile()
|
|
||||||
#include "osdefs.h" // SEP, ALTSEP
|
#include "osdefs.h" // SEP, ALTSEP
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
***********************************************************/
|
***********************************************************/
|
||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
#include "pycore_fileutils.h" // _Py_BEGIN_SUPPRESS_IPH
|
||||||
#include "malloc.h"
|
#include "malloc.h"
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <conio.h>
|
#include <conio.h>
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
#include "pycore_fileutils.h" // _Py_BEGIN_SUPPRESS_IPH
|
||||||
#include "pycore_pystate.h" // _PyThreadState_GET()
|
#include "pycore_pystate.h" // _PyThreadState_GET()
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
# define WIN32_LEAN_AND_MEAN
|
# define WIN32_LEAN_AND_MEAN
|
||||||
|
|
|
@ -4,11 +4,12 @@
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
|
||||||
#include "code.h" // PyCode_Addr2Line etc
|
#include "code.h" // PyCode_Addr2Line etc
|
||||||
#include "pycore_interp.h" // PyInterpreterState.gc
|
|
||||||
#include "frameobject.h" // PyFrame_GetBack()
|
#include "frameobject.h" // PyFrame_GetBack()
|
||||||
#include "pycore_ast.h" // asdl_seq_*
|
#include "pycore_ast.h" // asdl_seq_*
|
||||||
#include "pycore_compile.h" // _PyAST_Optimize
|
#include "pycore_compile.h" // _PyAST_Optimize
|
||||||
|
#include "pycore_fileutils.h" // _Py_BEGIN_SUPPRESS_IPH
|
||||||
#include "pycore_frame.h" // _PyFrame_GetCode()
|
#include "pycore_frame.h" // _PyFrame_GetCode()
|
||||||
|
#include "pycore_interp.h" // PyInterpreterState.gc
|
||||||
#include "pycore_parser.h" // _PyParser_ASTFromString
|
#include "pycore_parser.h" // _PyParser_ASTFromString
|
||||||
#include "pycore_pyarena.h" // _PyArena_Free()
|
#include "pycore_pyarena.h" // _PyArena_Free()
|
||||||
#include "pycore_pyerrors.h" // _PyErr_Fetch()
|
#include "pycore_pyerrors.h" // _PyErr_Fetch()
|
||||||
|
@ -17,7 +18,7 @@
|
||||||
#include "structmember.h" // PyMemberDef
|
#include "structmember.h" // PyMemberDef
|
||||||
#include "osdefs.h" // SEP
|
#include "osdefs.h" // SEP
|
||||||
#ifdef HAVE_FCNTL_H
|
#ifdef HAVE_FCNTL_H
|
||||||
#include <fcntl.h>
|
# include <fcntl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define OFF(x) offsetof(PyTracebackObject, x)
|
#define OFF(x) offsetof(PyTracebackObject, x)
|
||||||
|
|
Loading…
Reference in New Issue