This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author andrei.avk
Recipients andrei.avk, kj, pablogsal
Date 2021-09-20.16:30:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1632155458.61.0.570546761746.issue45249@roundup.psfhosted.org>
In-reply-to
Content
It seems like fine grained error locations do not work in failed doctest traceback output:

version 3.11.0a0

file contents:
------------------
def a(x):
    """
    >>> 1 1
    1
    """
import doctest
doctest.testmod()

OUTPUT
-------

Failed example:
    1 1
Exception raised:
    Traceback (most recent call last):
      File "/Users/ak/opensource/cpython/Lib/doctest.py", line 1348, in __run
        exec(compile(example.source, filename, "single",
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "<doctest __main__.a[0]>", line 1
        1 1
        ^
    SyntaxError: invalid syntax. Perhaps you forgot a comma?


The location in doctests that causes this:

https://github.com/python/cpython/blob/5846c9b71ee9277fe866b1bdee4cc6702323fe7e/Lib/doctest.py#L1348
History
Date User Action Args
2021-09-20 16:30:58andrei.avksetrecipients: + andrei.avk, pablogsal, kj
2021-09-20 16:30:58andrei.avksetmessageid: <1632155458.61.0.570546761746.issue45249@roundup.psfhosted.org>
2021-09-20 16:30:58andrei.avklinkissue45249 messages
2021-09-20 16:30:58andrei.avkcreate