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年12月09日 05:20 by woo yoo, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| py3-octal.patch | martin.panter, 2016年12月10日 03:12 | review | ||
| alt-zero.py2.patch | martin.panter, 2016年12月10日 06:02 | review | ||
| Messages (6) | |||
|---|---|---|---|
| msg282762 - (view) | Author: woo yoo (woo yoo) | Date: 2016年12月09日 05:20 | |
Mismatch occurs within the "Notes" section,row 1.Here is the link:https://docs.python.org/3/library/stdtypes.html#old-string-formatting The course of coding shows below: >>>'%#07o' % 1223 Result value is '0o02307',which is not in line with the description. Description is "The alternate form causes a leading zero ('0') to be inserted between left-hand padding and the formatting of the number if the leading character of the result is not already a zero." |
|||
| msg282767 - (view) | Author: Martin Panter (martin.panter) * (Python committer) | Date: 2016年12月09日 07:31 | |
Looks like a leftover relic from Python 2. In Python 3, the prefix is "0o", not just "0". This matches to change in Python 2 to 3 octal literal syntax. And there is no special handling of zero in 3: >>> "%#o" % 0 '0o0' |
|||
| msg282821 - (view) | Author: Martin Panter (martin.panter) * (Python committer) | Date: 2016年12月10日 03:12 | |
The documentation for %x etc also had the same problem, and it applies to Python 2 for %x. Here is a patch for Python 3. The behaviour is already tested, but there were some quirks due to porting from Py 2 tests, and duplicate tests which I removed. |
|||
| msg282829 - (view) | Author: Martin Panter (martin.panter) * (Python committer) | Date: 2016年12月10日 06:02 | |
Patch for %x in Py 2. |
|||
| msg282834 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2016年12月10日 07:33 | |
Both patches LGTM. |
|||
| msg282901 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2016年12月11日 04:10 | |
New changeset 35e66eb101da by Martin Panter in branch '3.5': Issue #28916: Correct description of %o and %x alternative forms https://hg.python.org/cpython/rev/35e66eb101da New changeset bc7fc85beed1 by Martin Panter in branch '3.6': Issues #28916, #26483: Merge stdtypes.rst from 3.5 https://hg.python.org/cpython/rev/bc7fc85beed1 New changeset b11850871300 by Martin Panter in branch 'default': Issues #28916, #26483: Merge stdtypes.rst from 3.6 https://hg.python.org/cpython/rev/b11850871300 New changeset 8359ee62dde3 by Martin Panter in branch '2.7': Issue #28916: No special case for leading zeros with %x alternative form https://hg.python.org/cpython/rev/8359ee62dde3 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:40 | admin | set | github: 73102 |
| 2016年12月11日 04:44:35 | martin.panter | set | status: open -> closed resolution: fixed stage: commit review -> resolved |
| 2016年12月11日 04:10:48 | python-dev | set | nosy:
+ python-dev messages: + msg282901 |
| 2016年12月10日 07:33:35 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages: + msg282834 assignee: docs@python -> martin.panter stage: patch review -> commit review |
| 2016年12月10日 06:02:49 | martin.panter | set | files:
+ alt-zero.py2.patch messages: + msg282829 |
| 2016年12月10日 03:12:34 | martin.panter | set | files:
+ py3-octal.patch versions: + Python 2.7 messages: + msg282821 keywords: + patch stage: needs patch -> patch review |
| 2016年12月09日 07:31:26 | martin.panter | set | versions:
+ Python 3.6, Python 3.7 nosy: + martin.panter messages: + msg282767 stage: needs patch |
| 2016年12月09日 05:20:41 | woo yoo | create | |