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 2016年04月14日 08:06 by serhiy.storchaka, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| PyUnicode_FSDecoder-no-list.patch | serhiy.storchaka, 2016年06月11日 14:38 | review | ||
| PyUnicode_FSDecoder-deprecate-buffer.patch | serhiy.storchaka, 2016年06月18日 11:45 | review | ||
| Messages (9) | |||
|---|---|---|---|
| msg263378 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2016年04月14日 08:06 | |
PyUnicode_FSDecoder() accepts not only str and bytes or bytes-like object, but arbitrary iterable, e.g. list.
Example:
>>> compile('', [116, 101, 115, 116], 'exec')
<code object <module> at 0xb6fb1340, file "test", line 1>
I think accepting arbitrary iterables is unintentional and weird behavior.
|
|||
| msg263388 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2016年04月14日 09:16 | |
I agree this doens't make sense. |
|||
| msg263394 - (view) | Author: Martin Panter (martin.panter) * (Python committer) | Date: 2016年04月14日 09:59 | |
I agree it is a bit strange. It looks like it is a victim of PyBytes_FromObject() doing more than it says; its documentation only mentions the buffer protocol, not accepting iterables. |
|||
| msg263396 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2016年04月14日 10:51 | |
PyUnicode_FSDecoder() is used in following functions in the stdlib: compile() symtable.symtable() parser.compile() parser.compilest() zipimporter.zipimporter() _imp.load_dynamic() (before 3.5) This is behavior of PyUnicode_FSDecoder() from the start (issue9542). All above functions accepted only str in 3.1, thus accepting bytes object and others was new feature. None tests are failed if reject non-str and non-bytes argument in PyUnicode_FSDecoder(). But none tests are failed even if disable support of bytes argument (there is a lack of tests for bytes path). What should we do? 1. Add a warning when the argument neither str nor supporting the buffer protocol. 2. Drop support of non-str and not supporting the buffer protocol arguments without a warning. 3. Drop support of non-str and not supporting the buffer protocol arguments without a warning, and add a warning when the argument neither str nor bytes. 4. Drop support of non-str and non-bytes arguments without a warning. |
|||
| msg263695 - (view) | Author: Philip Jenvey (pjenvey) * (Python committer) | Date: 2016年04月18日 21:36 | |
See issue26800 for reasoning to go with #4 |
|||
| msg268213 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2016年06月11日 14:38 | |
Proposed patch makes PyUnicode_FSDecoder() rejecting arbitrary iterables. |
|||
| msg268795 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2016年06月18日 10:56 | |
New changeset 2e48c2c4c733 by Serhiy Storchaka in branch '3.5': Issue #26754: PyUnicode_FSDecoder() accepted a filename argument encoded as https://hg.python.org/cpython/rev/2e48c2c4c733 New changeset e18ac7370113 by Serhiy Storchaka in branch 'default': Issue #26754: PyUnicode_FSDecoder() accepted a filename argument encoded as https://hg.python.org/cpython/rev/e18ac7370113 |
|||
| msg268798 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2016年06月18日 11:45 | |
Following patch deprecates the support of bytes-like objects (except bytes itself) in PyUnicode_FSDecoder() for consistency with issue26800. |
|||
| msg272107 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2016年08月06日 20:29 | |
New changeset 818f22f9ab02 by Serhiy Storchaka in branch 'default': Issue #26754: Undocumented support of general bytes-like objects https://hg.python.org/cpython/rev/818f22f9ab02 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:29 | admin | set | github: 70941 |
| 2016年08月14日 06:30:31 | serhiy.storchaka | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2016年08月06日 20:29:49 | python-dev | set | messages: + msg272107 |
| 2016年06月18日 11:45:35 | serhiy.storchaka | set | files:
+ PyUnicode_FSDecoder-deprecate-buffer.patch dependencies: + Don't accept bytearray as filenames part 2 messages: + msg268798 versions: - Python 3.5 |
| 2016年06月18日 10:56:41 | python-dev | set | nosy:
+ python-dev messages: + msg268795 |
| 2016年06月11日 14:38:32 | serhiy.storchaka | set | files:
+ PyUnicode_FSDecoder-no-list.patch versions: + Python 3.5 messages: + msg268213 assignee: serhiy.storchaka keywords: + patch stage: patch review |
| 2016年04月18日 21:36:11 | pjenvey | set | nosy:
+ pjenvey messages: + msg263695 |
| 2016年04月14日 10:51:13 | serhiy.storchaka | set | nosy:
+ vstinner messages: + msg263396 |
| 2016年04月14日 09:59:54 | martin.panter | set | nosy:
+ martin.panter messages: + msg263394 |
| 2016年04月14日 09:16:05 | pitrou | set | nosy:
+ pitrou messages: + msg263388 |
| 2016年04月14日 08:06:10 | serhiy.storchaka | create | |