File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1431,44 +1431,6 @@ Py_FdIsInteractive(FILE *fp, const char *filename)
14311431}
14321432
14331433
1434- #if defined(USE_STACKCHECK )
1435- #if defined(WIN32 ) && defined(_MSC_VER )
1436-
1437- /* Stack checking for Microsoft C */
1438-
1439- #include <malloc.h>
1440- #include <excpt.h>
1441-
1442- /*
1443- * Return non-zero when we run out of memory on the stack; zero otherwise.
1444- */
1445- int
1446- PyOS_CheckStack (void )
1447- {
1448- __try {
1449- /* alloca throws a stack overflow exception if there's
1450- not enough space left on the stack */
1451- alloca (PYOS_STACK_MARGIN * sizeof (void * ));
1452- return 0 ;
1453- } __except (GetExceptionCode () == STATUS_STACK_OVERFLOW ?
1454- EXCEPTION_EXECUTE_HANDLER :
1455- EXCEPTION_CONTINUE_SEARCH ) {
1456- int errcode = _resetstkoflw ();
1457- if (errcode == 0 )
1458- {
1459- Py_FatalError ("Could not reset the stack!" );
1460- }
1461- }
1462- return 1 ;
1463- }
1464-
1465- #endif /* WIN32 && _MSC_VER */
1466-
1467- /* Alternate implementations can be added here... */
1468-
1469- #endif /* USE_STACKCHECK */
1470-
1471-
14721434/* Wrappers around sigaction() or signal(). */
14731435
14741436PyOS_sighandler_t
Original file line number Diff line number Diff line change @@ -1376,6 +1376,43 @@ err_input(perrdetail *err)
13761376}
13771377
13781378
1379+ #if defined(USE_STACKCHECK )
1380+ #if defined(WIN32 ) && defined(_MSC_VER )
1381+
1382+ /* Stack checking for Microsoft C */
1383+
1384+ #include <malloc.h>
1385+ #include <excpt.h>
1386+
1387+ /*
1388+ * Return non-zero when we run out of memory on the stack; zero otherwise.
1389+ */
1390+ int
1391+ PyOS_CheckStack (void )
1392+ {
1393+ __try {
1394+ /* alloca throws a stack overflow exception if there's
1395+ not enough space left on the stack */
1396+ alloca (PYOS_STACK_MARGIN * sizeof (void * ));
1397+ return 0 ;
1398+ } __except (GetExceptionCode () == STATUS_STACK_OVERFLOW ?
1399+ EXCEPTION_EXECUTE_HANDLER :
1400+ EXCEPTION_CONTINUE_SEARCH ) {
1401+ int errcode = _resetstkoflw ();
1402+ if (errcode == 0 )
1403+ {
1404+ Py_FatalError ("Could not reset the stack!" );
1405+ }
1406+ }
1407+ return 1 ;
1408+ }
1409+
1410+ #endif /* WIN32 && _MSC_VER */
1411+
1412+ /* Alternate implementations can be added here... */
1413+
1414+ #endif /* USE_STACKCHECK */
1415+
13791416/* Deprecated C API functions still provided for binary compatiblity */
13801417
13811418#undef PyParser_SimpleParseFile
You can’t perform that action at this time.
0 commit comments