[issue46306] Suspicios operation in `doctest.py`: `None - 1`

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

[issue46306] Suspicios operation in `doctest.py`: `None - 1`

2022-01-08 Thread Nikita Sobolev
New submission from Nikita Sobolev : This line `lineno = getattr(obj, 'co_firstlineno', None)-1` does not look good. Link: https://github.com/python/cpython/blame/45d44b950f1dab0ef90d0a8f4fa75ffaae71500b/Lib/doctest.py#L1116 Why? 1. `CodeType` is guaranteed to have `co_firstlineno`. Docs: ht