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 vstinner
Recipients BTaskaya, lukasz.langa, pablogsal, vstinner
Date 2021-08-31.14:05:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1630418756.59.0.674837335232.issue45063@roundup.psfhosted.org>
In-reply-to
Content
The PEP 657 introduced ^^^ in tracebacks. It is useful when the error happens on an sub-expression in a long line. Example:

  File "/home/vstinner/python/main/Lib/ftplib.py", line 462, in retrlines
    with self.transfercmd(cmd) as conn, \
         ^^^^^^^^^^^^^^^^^^^^^

But ^^^ makes the output more verbose and doesn't bring much value when the error concerns the whole line:

  File "/home/vstinner/python/main/Lib/socket.py", line 845, in create_connection
    raise err
    ^^^^^^^^^

Would it be possible to omit ^^^ when it concerns the whole line?

Full example (currently):

ERROR: test_retrlines (test.test_ftplib.TestFTPClass)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/python/main/Lib/test/test_ftplib.py", line 603, in test_retrlines
    self.client.retrlines('retr', received.append)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vstinner/python/main/Lib/ftplib.py", line 462, in retrlines
    with self.transfercmd(cmd) as conn, \
         ^^^^^^^^^^^^^^^^^^^^^
  File "/home/vstinner/python/main/Lib/ftplib.py", line 393, in transfercmd
    return self.ntransfercmd(cmd, rest)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vstinner/python/main/Lib/ftplib.py", line 354, in ntransfercmd
    conn = socket.create_connection((host, port), self.timeout,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vstinner/python/main/Lib/socket.py", line 845, in create_connection
    raise err
    ^^^^^^^^^
  File "/home/vstinner/python/main/Lib/socket.py", line 833, in create_connection
    sock.connect(sa)
    ^^^^^^^^^^^^^^^^
ConnectionRefusedError: [Errno 111] Connection refused

I would prefer:

ERROR: test_retrlines (test.test_ftplib.TestFTPClass)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/python/main/Lib/test/test_ftplib.py", line 603, in test_retrlines
    self.client.retrlines('retr', received.append)
  File "/home/vstinner/python/main/Lib/ftplib.py", line 462, in retrlines
    with self.transfercmd(cmd) as conn, \
         ^^^^^^^^^^^^^^^^^^^^^
  File "/home/vstinner/python/main/Lib/ftplib.py", line 393, in transfercmd
    return self.ntransfercmd(cmd, rest)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vstinner/python/main/Lib/ftplib.py", line 354, in ntransfercmd
    conn = socket.create_connection((host, port), self.timeout,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vstinner/python/main/Lib/socket.py", line 845, in create_connection
    raise err
  File "/home/vstinner/python/main/Lib/socket.py", line 833, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused


In term of release process, can we change the traceback after Python 3.10.0 final? Or can we only change it in Python 3.11? I mark the issue as a release blocker, but I let Pablo (author of the PEP and Python 3.10 release manager) decide.
History
Date User Action Args
2021-08-31 14:05:56vstinnersetrecipients: + vstinner, lukasz.langa, pablogsal, BTaskaya
2021-08-31 14:05:56vstinnersetmessageid: <1630418756.59.0.674837335232.issue45063@roundup.psfhosted.org>
2021-08-31 14:05:56vstinnerlinkissue45063 messages
2021-08-31 14:05:56vstinnercreate