[issue46923] Implement stack overflow protection for supported platforms

2022-03-14 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

issue33955 is an older issue about implementing the current functionality for 
this on macOS, which has an API for querying stack limits.

--
nosy: +ronaldoussoren

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46923] Implement stack overflow protection for supported platforms

2022-03-04 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

> Personally I'd prefer a new exception `StackOverflow` to `MemoryError`

+1 on a new exception (presumably a subclass of MemoryError).

How about using OverflowedStack instead?

The situation is not quite as bad as you suggest. Googling for "stack overflow" 
alone (with a space and no other qualifications):

* on Bing, scroll halfway down the first page of results to find the "People 
also ask..." 

  How do you get a stack overflow?
  How to prevent a stack overflow error?

* also on Bing at the bottom of the first page of results is a question on 
stackoverflow.com asking what causes memory stack overflows;

* on DuckDuckGo, the first page of search results fails to suggest anything 
useful;

* on Google itself, on the first page is the People Also Ask

  What causes stack overflows?

* as well as a link to Wikipedia's page on stack overflows.

I expect that going forward, "python stack overflow exception" will be 
sufficient to hit the Python docs somewhere on the first page.

Besides, presumably this OverflowedStack exception is likely to be rare, so I 
expect that few people will need to google it.

--
nosy: +steven.daprano

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46923] Implement stack overflow protection for supported platforms

2022-03-04 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46923] Implement stack overflow protection for supported platforms

2022-03-04 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46923] Implement stack overflow protection for supported platforms

2022-03-04 Thread Mark Shannon


New submission from Mark Shannon :

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.

--
assignee: Mark.Shannon
messages: 414538
nosy: Mark.Shannon, gregory.p.smith
priority: normal
severity: normal
status: open
title: Implement stack overflow protection for supported platforms

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com