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.

classification
Title: Get rid of trailing comma in the repr() of BaseException
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: serhiy.storchaka, terry.reedy
Priority: normal Keywords:

Created on 2017-05-18 15:32 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 1650 merged serhiy.storchaka, 2017-05-18 15:39
Messages (3)
msg293928 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-05-18 15:32
The repr() of BaseException (and all exceptions that don't override __repr__) with a single argument contains a redundant trailing comma:

>>> BaseException('spam')
BaseException('spam',)

This is just an artefact of the implementation.

Proposed patch removes this comma.
msg293977 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-05-19 21:28
I think the trailing comma is slightly worse than redundant, as someone who has forgotten the trailing comma rule for calls can mistakenly read it as making the arg a tuple.  So +1 on removing it.
msg306278 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-11-15 15:53
New changeset f8a4c03ede6048022f60a58d5a21b278b78a8a16 by Serhiy Storchaka in branch 'master':
bpo-30399: Get rid of trailing comma in the repr of BaseException. (#1650)
https://github.com/python/cpython/commit/f8a4c03ede6048022f60a58d5a21b278b78a8a16
History
Date User Action Args
2022-04-11 14:58:46adminsetgithub: 74584
2017-11-15 15:54:13serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-11-15 15:53:32serhiy.storchakasetmessages: + msg306278
2017-05-19 21:28:28terry.reedysetnosy: + terry.reedy
messages: + msg293977
2017-05-19 18:22:10serhiy.storchakasettitle: Get rid of trailing comma if the repr() of BaseException -> Get rid of trailing comma in the repr() of BaseException
2017-05-18 15:39:31serhiy.storchakasetpull_requests: + pull_request1745
2017-05-18 15:32:17serhiy.storchakacreate