cpython: e289b64f355d (original) (raw)

Mercurial > cpython

changeset 69075:e289b64f355d

Issue #11393: limit stack overflow test to 100 MB Stop if the stack overflow doesn't occur after allocating 100 MB on the stack. [#11393]

Victor Stinner victor.stinner@haypocalc.com
date Thu, 31 Mar 2011 11:34:08 +0200
parents a6d2c703586a
children aa2ac1581d23
files Lib/test/test_faulthandler.py Modules/faulthandler.c
diffstat 2 files changed, 37 insertions(+), 8 deletions(-)[+] [-] Lib/test/test_faulthandler.py 8 Modules/faulthandler.c 37

line wrap: on

line diff

--- a/Lib/test/test_faulthandler.py +++ b/Lib/test/test_faulthandler.py @@ -69,7 +69,7 @@ class FaultHandlerTests(unittest.TestCas return output.splitlines() def check_fatal_error(self, code, line_number, name_regex,

@@ -90,6 +90,8 @@ class FaultHandlerTests(unittest.TestCas lineno=line_number, name=name_regex, header=re.escape(header))

@@ -153,7 +155,6 @@ faulthandler._fatal_error(b'xyz') 2, 'xyz')

def test_gil_released(self): self.check_fatal_error("""

--- a/Modules/faulthandler.c +++ b/Modules/faulthandler.c @@ -16,6 +16,9 @@

define FAULTHANDLER_USER

#endif +/* Allocate at maximum 100 MB of the stack to raise the stack overflow / +#define STACK_OVERFLOW_MAX_SIZE (1001024*1024) + #define PUTS(fd, str) write(fd, str, strlen(str)) #ifdef HAVE_SIGACTION @@ -742,15 +745,39 @@ faulthandler_fatal_error_py(PyObject *se } #if defined(HAVE_SIGALTSTACK) && defined(HAVE_SIGACTION) -static PyObject * -faulthandler_stack_overflow(PyObject self) +void +stack_overflow(void *min_sp, void *max_sp, size_t depth) { / allocate 4096 bytes on the stack at each call */ unsigned char buffer[4096];

+} + +static PyObject * +faulthandler_stack_overflow(PyObject *self) +{

+

} #endif