classification
Title: pyexpat.errors wrongly bound to message strings instead of message codes
Type: behavior Stage: needs patch
Components: Documentation Versions: Python 2.7
process
Status: open Resolution: wont fix
Dependencies: Superseder:
Assigned To: docs@python Nosy List: bkarge, docs@python, martin.panter, r.david.murray
Priority: normal Keywords: easy

Created on 2014-12-09 07:45 by bkarge, last changed 2017-06-06 01:45 by martin.panter.

Messages (6)
msg232348 - (view) Author: Björn Karge (bkarge) Date: 2014-12-09 07:45
expat.errors should expose the enum values and NOT the associated message strings, so they can be tested against ExpatError.code
msg232383 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-12-09 15:24
The API is what it is.  In the Python3 docs this is documented as a backward compatibility issue, and the workaround using the new errors.codes is provided.  For 2.7 we are stuck with what we have, since we don't add new features to 2.7.
msg232414 - (view) Author: Björn Karge (bkarge) Date: 2014-12-10 06:16
I strongly disagree. The constants are just useless as they are (so this bug can hardly be considered a feature). The behaviour is not matching the 2.7 docs, so fixing it certainly won't be adding a new feature, and the python 3 behaviour can easily be preserved even if these constants are numbers.
msg232426 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-12-10 14:27
For backward compatibility reasons this *can not be changed*.  We are stuck with it, even though we agree it is broken.  Please do not reopen the issue.
msg232427 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-12-10 14:36
Actually, I'm going to reopen it as a doc issue. This should be explained in the 2.7 docs.
msg295227 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2017-06-06 01:45
Also, even in the Py 3 docs, the ErrorCode parser attribute is said to be numeric, but there is a suggestion to compare it with “constants” defined in the “errors” (module) object. I guess it should be clarified that you can’t compare it directly; perhaps using ErrorString or Py 3’s “errors.codes” is more appropriate?
History
Date User Action Args
2017-06-06 01:45:57martin.pantersetnosy: + martin.panter
messages: + msg295227
2014-12-10 14:46:57berker.peksagsetkeywords: + easy
stage: resolved -> needs patch
2014-12-10 14:36:44r.david.murraysetstatus: closed -> open

nosy: + docs@python
messages: + msg232427

assignee: docs@python
components: + Documentation, - Library (Lib)
2014-12-10 14:27:48r.david.murraysetstatus: open -> closed

messages: + msg232426
2014-12-10 06:16:23bkargesetstatus: closed -> open

messages: + msg232414
2014-12-09 15:24:49r.david.murraysetstatus: open -> closed

nosy: + r.david.murray
messages: + msg232383

resolution: wont fix
stage: resolved
2014-12-09 07:45:27bkargecreate