Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Spam #135067

Closed as not planned
Closed as not planned
Spam#135067
@johnaAr555

Description

@johnaAr555

python/steering-council#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.

Originally posted by @markshannon in #91079

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions