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 terry.reedy
Recipients serhiy.storchaka, terry.reedy
Date 2020-11-22.03:15:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1606014957.69.0.667841008869.issue42426@roundup.psfhosted.org>
In-reply-to
Content
The confusion about error.args is this:

BaseException.args is documented as "The tuple of arguments given to the exception constructor."
https://docs.python.org/3/library/exceptions.html#base-classes
args[0] is usually and I would expect it to always be the formatted message, which is to say, the string normally printed at the end of tracebacks.
The signature of re.error is documented as "(msg, pattern=None, pos=None)"
https://docs.python.org/3/library/re.html#re.error
and this is what inspect.signature says (as reported in IDLE calltip).
So one might expect .args to be a 3-tuple.

With the value fetching fixed, the displayed message could be changed to something else (in another issue), such as
  Error: bad escape \z in pattern r'a\z' at offset 1

Thanks for the patch.
History
Date User Action Args
2020-11-22 03:15:57terry.reedysetrecipients: + terry.reedy, serhiy.storchaka
2020-11-22 03:15:57terry.reedysetmessageid: <1606014957.69.0.667841008869.issue42426@roundup.psfhosted.org>
2020-11-22 03:15:57terry.reedylinkissue42426 messages
2020-11-22 03:15:57terry.reedycreate