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 2010年05月29日 02:24 by vstinner, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| remove_w_format.patch | vstinner, 2010年06月06日 09:03 | |||
| remove_w_format-2.patch | vstinner, 2010年06月14日 21:37 | |||
| Messages (8) | |||
|---|---|---|---|
| msg106702 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2010年05月29日 02:24 | |
"w" format is dangerous because it doesn't give the size of the buffer: the caller may write outside the buffer (buffer overflow). "w*" and "w#" formats are fine. It looks like "w" format is not used in trunk nor py3k (only w# and w*). |
|||
| msg107193 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2010年06月06日 09:03 | |
Attached patch removes "w" format, cleanups the code for "w*" and "w#" formats, and update the documentation. |
|||
| msg107324 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2010年06月08日 15:09 | |
I'd point out that "w#" is mostly useless too. It's supposed to return a read-write buffer, but as the doc says it also doesn't support "mutable objects", since it isn't able to properly lock/pin the buffer; therefore it probably doesn't support anything useful. |
|||
| msg107367 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2010年06月09日 00:03 | |
See also #8592: 'y' does not check for embedded NUL bytes. |
|||
| msg107755 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2010年06月13日 21:36 | |
"w#" is not only useless but also not used in py3k source code. "w" is also not used. Only "w*" is used by fnctl and socket modules. The problem with w# is that the caller cannot "release" the buffer and so we cannot lock the buffer. I don't know exactly what happens if you get a pointer to a bytearray, release the GIL and then use it, whereas another thread modifies and/or destroys the bytearray object. (I suppose that something bad will happen, like a segfault) |
|||
| msg107812 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2010年06月14日 21:37 | |
New (improved) version of the patch: - Remove also "w#" format - Write tests for "w*" format |
|||
| msg107829 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2010年06月14日 22:39 | |
See also #8926. |
|||
| msg108572 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2010年06月25日 00:03 | |
Commited to 3.2 (r82208), blocked in 3.1 (r82209). |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:01 | admin | set | github: 53096 |
| 2010年06月25日 00:03:40 | vstinner | set | status: open -> closed resolution: fixed |
| 2010年06月25日 00:03:26 | vstinner | set | messages: + msg108572 |
| 2010年06月14日 22:39:15 | vstinner | set | messages: + msg107829 |
| 2010年06月14日 21:37:44 | vstinner | set | files:
+ remove_w_format-2.patch messages: + msg107812 |
| 2010年06月13日 21:36:19 | vstinner | set | messages: + msg107755 |
| 2010年06月09日 00:03:06 | vstinner | set | messages: + msg107367 |
| 2010年06月08日 15:09:56 | pitrou | set | nosy:
+ pitrou messages: + msg107324 |
| 2010年06月08日 15:08:22 | pitrou | set | nosy:
+ loewis |
| 2010年06月06日 09:03:27 | vstinner | set | files:
+ remove_w_format.patch keywords: + patch messages: + msg107193 |
| 2010年05月29日 02:24:18 | vstinner | create | |