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 <>
The confusion about error.args is this:

BaseException.args is documented as "The tuple of arguments given to the exception constructor."
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)"
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.
Date User Action Args
2020-11-22 03:15:57terry.reedysetrecipients: + terry.reedy, serhiy.storchaka
2020-11-22 03:15:57terry.reedysetmessageid: <>
2020-11-22 03:15:57terry.reedylinkissue42426 messages
2020-11-22 03:15:57terry.reedycreate