Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

doctest fails to compare tracebacks with notes #111159

Closed
Assignees
sobolevn
Labels
stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error
@sobolevn

Description

@sobolevn

Bug report

Minimal reproducer:

"""Module doctest>>> raise_with_note()Traceback (most recent call last):  ...ValueError: TextNote"""defraise_with_note():err=ValueError('Text')err.add_note('Note')raiseerr

Now, run it, you will get a very strange error:

» ./python.exe -m doctest ex.py**********************************************************************File "/Users/sobolev/Desktop/cpython/ex.py", line 4, in exFailed example:    raise_with_note()Expected:    Traceback (most recent call last):      ...    ValueError: Text    NoteGot:    Traceback (most recent call last):      File "/Users/sobolev/Desktop/cpython/Lib/doctest.py", line 1374, in __run        exec(compile(example.source, filename, "single",      File "<doctest ex[0]>", line 1, in <module>        raise_with_note()      File "/Users/sobolev/Desktop/cpython/ex.py", line 14, in raise_with_note        raise err    ValueError: Text    Note**********************************************************************1 items had failures:   1 of   1 in ex***Test Failed*** 1 failures.

Things that do not help:

  • IGNORE_EXCEPTION_DETAIL
  • ELLIPSIS
  • Coping the whole traceback

Related to how exceptions with notes are represented in

exc_msg=traceback.format_exception_only(*exception[:2])[-1]

I am working on this issue right now :)

Refs#111157

Linked PRs

Metadata

Metadata

Assignees

Labels

stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp