This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Mark.Shannon
Recipients Mark.Shannon, gregory.p.smith
Date 2022-03-04.16:54:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1646412859.37.0.291420290315.issue46923@roundup.psfhosted.org>
In-reply-to
Content
https://github.com/python/steering-council/issues/102 (definitely not PEP 651 ;))

We should implement efficient stack checks on those platforms that allow us to introspect stack extents.
Windows and posix systems allow us to do this.

C allows addresses of stack variables to be taken. This means that C stacks cannot be moved.
In theory they might be discontinuous, although I suspect that they are always contiguous.

My plan is to maintain a per-thread "safe region" of 32or 64k. We can check if the current stack pointer (or near enough) is in that region cheaply.
If we are not in that region, we can ask the O/S for a stack limit to determine a new "safe region". If we cannot find a safe region, then we raise a MemoryError.

Personally I'd prefer a new exception `StackOverflow` to `MemoryError` but, thanks to stackoverflow.com, it is now impossible for new programmers to do a web search to determine what a "stack overflow" is.
So, I guess MemoryError will have to do.
History
Date User Action Args
2022-03-04 16:54:19Mark.Shannonsetrecipients: + Mark.Shannon, gregory.p.smith
2022-03-04 16:54:19Mark.Shannonsetmessageid: <1646412859.37.0.291420290315.issue46923@roundup.psfhosted.org>
2022-03-04 16:54:19Mark.Shannonlinkissue46923 messages
2022-03-04 16:54:19Mark.Shannoncreate