A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2000-August/008949.html below:

[Python-Dev] stack check on Unix: any suggestions?

[Python-Dev] stack check on Unix: any suggestions?Fredrik Lundh Fredrik Lundh" <effbot@telia.com
Wed, 30 Aug 2000 12:27:12 +0200
mal wrote:
> See my comments in the patch manager... the patch looks fine
> except for two things: getrlimit() should be tested for
> usability in the configure script and the call frequency
> of PyOS_CheckStack() should be lowered to only use it for
> potentially recursive programs.

the latter would break windows and mac versions of Python,
where Python can run on very small stacks (not to mention
embedded systems...)

for those platforms, CheckStack is designed to work with an
8k safety margin (PYOS_STACK_MARGIN)

:::

one way to address this is to introduce a scale factor, so that
you can add checks based on the default 8k limit, but auto-
magically apply them less often platforms where the safety
margin is much larger...

/* checkstack, but with a "scale" factor */
#if windows or mac
/* default safety margin */
#define PYOS_CHECKSTACK(v, n)\
    (((v) % (n) == 0) && PyOS_CheckStack())
#elif linux
/* at least 10 times the default safety margin */
#define PYOS_CHECKSTACK(v, n)\
    (((v) % ((n)*10) == 0) && PyOS_CheckStack())
#endif

 if (PYOS_CHECKSTACK(tstate->recursion_depth, 10)
    ...

</F>




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4