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.
Created on 2013年04月25日 07:40 by ncoghlan, last changed 2022年04月11日 14:57 by admin.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| issue17840.patch | alex.henderson, 2013年07月06日 12:49 | Removes error-mode assertions from encodings/*_codec.py | review | |
| issue17840.patch | alex.henderson, 2013年07月12日 16:02 | New patch raising ValueError | review | |
| Messages (11) | |||
|---|---|---|---|
| msg187762 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2013年04月25日 07:40 | |
encodings.base64_codec currently uses "assert errors=='strict'" in a few places, since it doesn't actually support any of the Unicode specific error handling modes. This should either be discarded entirely (and document that the error handling mode is irrelevant for this codec), or else turned into a real check that raises ValueError if an unsupported error mode is passed in. I have a slight preference for just ignoring the error mode as irrelevant (since this isn't a text encoding in the normal Unicode serialisation-as-bytes sense). |
|||
| msg192434 - (view) | Author: Alex Henderson (alex.henderson) * | Date: 2013年07月06日 12:49 | |
I see that there is identical usage of "assert errors=='strict'" in a number of similar encodings modules: base64_codec.py bz2_codec.py hex_codec.py quopri_codec.py uu_codec.py zlib_codec.py The error handling mode is irrelevant for all these codecs, so the attached patch addresses them all (choosing to ignore the error mode and documenting this). |
|||
| msg192561 - (view) | Author: Alex Henderson (alex.henderson) * | Date: 2013年07月07日 14:31 | |
Having discussed this with Ezio, I think the better option might be to raise ValueError instead - if someone is expecting to be able to silently recover from errors they won't be able to, and should find out about this sooner rather than later. I'll upload an updated patch shortly. |
|||
| msg192638 - (view) | Author: Marc-Andre Lemburg (lemburg) * (Python committer) | Date: 2013年07月08日 11:55 | |
On 07.07.2013 16:31, Alex Henderson wrote: > Having discussed this with Ezio, I think the better option might be to raise ValueError instead - if someone is expecting to be able to silently recover from errors they won't be able to, and should find out about this sooner rather than later. > I'll upload an updated patch shortly. +1 |
|||
| msg192710 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2013年07月09日 02:22 | |
ValueError works for me. |
|||
| msg192951 - (view) | Author: Alex Henderson (alex.henderson) * | Date: 2013年07月12日 16:02 | |
OK, now raises ValueError on passing anything other than 'strict'. Note that for the incremental classes I've put checking in __init__ so that ValueError is raised when non-'strict' values are passed to the constructor, not when the incremental encode/decode methods are subsequently called. |
|||
| msg234303 - (view) | Author: Martin Panter (martin.panter) * (Python committer) | Date: 2015年01月19日 06:19 | |
Is this patch likely to go ahead? It has been sitting around a while and would conflict with patches I am working on. If so, I reckon it would be good to factor out some of the new bits of code (_check_strict, _StrictErrors) into a common place, like the "codecs" module. |
|||
| msg234306 - (view) | Author: Berker Peksag (berker.peksag) * (Python committer) | Date: 2015年01月19日 07:24 | |
Thanks for the patch. I left a couple of comments on Rietveld. |
|||
| msg234307 - (view) | Author: Martin Panter (martin.panter) * (Python committer) | Date: 2015年01月19日 07:35 | |
Would also be good to document that errors='ignored' is not allowed. Currently the documentation says The following string values are defined and implemented by all standard Python codecs: * 'strict' * 'ignore' |
|||
| msg234613 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2015年01月24日 13:06 | |
I'd be slightly more inclined to file the fact that "ignore" isn't supported by the base64 codec as a potential bug, with changing the docs as one possible resolution. It shouldn't hold up switching from the assertions to proper runtime checks. |
|||
| msg348628 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2019年07月29日 11:43 | |
This issue is 6 years old and has patches: it is no newcomer friendly, I remove the "easy" keyword. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:44 | admin | set | github: 62040 |
| 2021年12月12日 00:45:46 | iritkatriel | set | versions: + Python 3.11, - Python 3.5 |
| 2019年07月29日 11:43:52 | vstinner | set | keywords:
- easy nosy: + vstinner messages: + msg348628 |
| 2015年03月21日 18:03:22 | serhiy.storchaka | set | stage: patch review -> needs patch |
| 2015年01月24日 13:06:02 | ncoghlan | set | messages: + msg234613 |
| 2015年01月19日 07:35:52 | martin.panter | set | messages: + msg234307 |
| 2015年01月19日 07:24:06 | berker.peksag | set | messages: + msg234306 |
| 2015年01月19日 07:16:19 | berker.peksag | set | nosy:
+ berker.peksag stage: test needed -> patch review versions: + Python 3.5, - Python 3.4 |
| 2015年01月19日 06:19:21 | martin.panter | set | nosy:
+ martin.panter messages: + msg234303 |
| 2013年07月12日 16:02:07 | alex.henderson | set | files:
+ issue17840.patch messages: + msg192951 |
| 2013年07月09日 02:22:50 | ncoghlan | set | messages: + msg192710 |
| 2013年07月08日 11:55:50 | lemburg | set | nosy:
+ lemburg messages: + msg192638 |
| 2013年07月07日 14:31:02 | alex.henderson | set | messages: + msg192561 |
| 2013年07月06日 12:49:55 | alex.henderson | set | files:
+ issue17840.patch nosy: + alex.henderson messages: + msg192434 keywords: + patch |
| 2013年04月27日 16:58:47 | ezio.melotti | set | keywords:
+ easy nosy: + ezio.melotti |
| 2013年04月25日 07:40:50 | ncoghlan | create | |