Author remi.lapeyre
Recipients Saim Raza, remi.lapeyre, vinay.sajip, xtreak
Date 2019-03-13.11:19:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1552476000.03.0.185578777561.issue36272@roundup.psfhosted.org>
In-reply-to
Content
I'm not sure issue35542. I think this happens because while logging the recursion limit is hit which calls https://github.com/python/cpython/blob/master/Python/ceval.c#L535-L539.

The RecursionError is then handled by https://github.com/python/cpython/blob/master/Lib/logging/__init__.py#L1000 and cleared.

On subsequent calls the exception is not set anymore because `tstate->overflowed` equals 1 so we exit early before setting the exception again at https://github.com/python/cpython/blob/master/Python/ceval.c#L531.

This goes on until the condition on https://github.com/python/cpython/blob/master/Python/ceval.c#L531 pass which abort the interpreter.

I think there is two ways to solve the issue, either handle RecursionError explicitly in the logging module so we don't clear it inadvertently as there is no way to recover from it anyway or check if the exception has been cleared at https://github.com/python/cpython/blob/master/Python/ceval.c#L531 and set it again.

Handling it explictly in the logging module would not help for code doing this elsewhere:

def rec():
    try:
        rec()
    except:
        rec()
rec()


I can submit a patch if you want.
History
Date User Action Args
2019-03-13 11:20:00remi.lapeyresetrecipients: + remi.lapeyre, vinay.sajip, xtreak, Saim Raza
2019-03-13 11:20:00remi.lapeyresetmessageid: <1552476000.03.0.185578777561.issue36272@roundup.psfhosted.org>
2019-03-13 11:20:00remi.lapeyrelinkissue36272 messages
2019-03-13 11:19:59remi.lapeyrecreate