[Python-Dev] Re: PEP 651 -- Robust Overflow Handling

2021年1月20日 00:35:06 -0800

> On 19 Jan 2021, at 17:15, Antoine Pitrou <[email protected]> wrote:
> 
> On 2021年1月19日 15:54:39 +0000
> Mark Shannon <[email protected] <mailto:[email protected]>> wrote:
>> On 19/01/2021 3:40 pm, Antoine Pitrou wrote:
>>> On 2021年1月19日 13:31:45 +0000
>>> Mark Shannon <[email protected]> wrote: 
>>>> Hi everyone,
>>>> 
>>>> It's time for yet another PEP :)
>>>> 
>>>> Fortunately, this one is a small one that doesn't change much.
>>>> It's aim is to make the VM more robust. 
>>> 
>>> On the principle, no objection.
>>> 
>>> In practice, can you show how an implementation of Py_CheckStackDepth()
>>> would look like? 
>> 
>> It would depend on the platform, but a portable-ish implementation is here:
>> 
>> https://github.com/markshannon/cpython/blob/pep-overflow-implementation/Include/internal/pycore_ceval.h#L71
> 
> This doesn't tell me how `stack_limit_pointer` is computed or estimated
> :-)
There already is an implementation of this for Windows (``PyOS_CheckStack``). 
For other platforms there will 
have to be a different implementation of this function. I’ve looked into this 
in the past for macOS, and that platform
has an API to retrieve the size of the stack as well as a pointer to the start 
of the stack (AFAIK stacks aren’t auto-growing
on macOS)
Ronald
—
Twitter / micro.blog: @ronaldoussoren
Blog: https://blog.ronaldoussoren.net/
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/F62XDAI3NF5YXMQXWEIIIDKY3M6KZ64O/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to