[issue46531] Simplify exception handling in `doctest.py`

2022-01-26 Thread Irit Katriel
Irit Katriel added the comment: In the long term we will want to not have the triplet, but this is a process that will take a few python versions to complete (when 3.11 is the oldest supported version). And it is not going to be simple. In the meantime, where there is an advantage to removin

[issue46531] Simplify exception handling in `doctest.py`

2022-01-26 Thread Nikita Sobolev
Nikita Sobolev added the comment: Fair enough! The only improvement is that we don't call `sys.exc_info` twice here: https://github.com/python/cpython/blob/6e5a193816e1bdf11f5fb78d620995fd6987ccf8/Lib/doctest.py#L2641-L2644 But, I think it is a minor thing. Looks like I've misunderstood the

[issue46531] Simplify exception handling in `doctest.py`

2022-01-26 Thread Irit Katriel
Irit Katriel added the comment: In other words, I don't see why it's an improvement to replace exception = sys.exc_info() by exception = type(exc), exc, exc.__traceback__ when sys.exc_info() does exactly what your inlined version does. -- _

[issue46531] Simplify exception handling in `doctest.py`

2022-01-26 Thread Irit Katriel
Irit Katriel added the comment: I don't think this is worth doing in a module where we can't completely get rid of the exc_info triplet. -- ___ Python tracker ___ ___

[issue46531] Simplify exception handling in `doctest.py`

2022-01-26 Thread Nikita Sobolev
Change by Nikita Sobolev : -- keywords: +patch pull_requests: +29095 stage: -> patch review pull_request: https://github.com/python/cpython/pull/30916 ___ Python tracker ___ _

[issue46531] Simplify exception handling in `doctest.py`

2022-01-26 Thread Nikita Sobolev
New submission from Nikita Sobolev : Right now there are two places where `sys.exc_info()` calls are not required anymore: 1. https://github.com/python/cpython/blob/6e5a193816e1bdf11f5fb78d620995fd6987ccf8/Lib/doctest.py#L1352-L1353 2. https://github.com/python/cpython/blob/6e5a193816e1bdf11f