[Python-Dev] test_sre.py fails on Win64 because PyOS_CheckStack *never* fails

Trent Mick trentm@ActiveState.com
Wed, 4 Oct 2000 14:17:37 -0700


I did not follow the discussion a while back regarding the implementation and
use of PyOS_CheckStack on Windows. In any case, its use (USE_STACKCHECK)
instead of recursion limit checking (USE_RECURSION_LIMIT) in _sre.c results
in this test:
    test(r"""sre.match(r'(x)*', 50000*'x').span()""", (0, 50000), RuntimeError)
in test_sre.py failing on Win64.


This is because PyOS_CheckStack seem to *never* fail on Win64. Three
possibilites:
  (1) I don't understand the PyOS_CheckStack code or I am misintepreting the
      problem.
  (2) The semantics of _alloca() has changed for Win64 such that a stack
      overflow exception is no longer thrown if space cannot be allocated.
      NOTE: I changed the number of pointers allocated in PyOS_CheckStack
            from 2048 to over 1 *Tera*byte and it *still* did not fail.
  (3) I am stoopid.


In any case, I would like to *not* define USE_STACKCHECK on Win64 for the
time being (and for 2.0, unless a Win64 angel comes to me in the next couple
of days). Does anybody have a problem with me checking this in?

*** Include\pythonrun.h~     Wed Oct 04 14:18:00 2000
--- Include\pythonrun.h      Wed Oct 04 13:17:17 2000
***************
*** 88,94 ****
     to a 8k margin. */
  #define PYOS_STACK_MARGIN 2048

! #if defined(WIN32) && defined(_MSC_VER)
  /* Enable stack checking under Microsoft C */
  #define USE_STACKCHECK
  #endif
--- 88,94 ----
     to a 8k margin. */
  #define PYOS_STACK_MARGIN 2048

! #if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER)
  /* Enable stack checking under Microsoft C */
  #define USE_STACKCHECK
  #endif


Thanks,
Trent

-- 
Trent Mick
TrentM@ActiveState.com