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 2015年06月29日 15:42 by jwilk, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| encode-declare.diff | terry.reedy, 2015年07月03日 23:40 | review | ||
| Messages (6) | |||
|---|---|---|---|
| msg245946 - (view) | Author: Jakub Wilk (jwilk) | Date: 2015年06月29日 15:42 | |
If the encoding is declared on the second line, the first line must not contain anything except comments. However, this fact is not documented. The Python Language reference says only that "the encoding declaration must appear on a line of its own"; and PEP 263 says only that "there must not be any Python statement on the line that contains the encoding declaration". For example, Python ignores this encoding declaration: spam = True # encoding=ISO-8859-2 despite the fact that it appears on a line of its own. |
|||
| msg245950 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2015年06月29日 16:25 | |
What docs are you looking at? https://docs.python.org/3/reference/lexical_analysis.html#encoding-declarations? I suspect the author thought that "If a comment in the first or second line..." implied both lines needed to be comments, but I agree that the wording is not clear. |
|||
| msg245960 - (view) | Author: Jakub Wilk (jwilk) | Date: 2015年06月29日 19:50 | |
Right, I meant <https://docs.python.org/3/reference/lexical_analysis.html#encoding-declarations>. |
|||
| msg246234 - (view) | Author: Terry J. Reedy (terry.reedy) * (Python committer) | Date: 2015年07月03日 23:40 | |
I moved the existing comment-only sentence to the first paragraph, where I strongly believe it belongs, and added a second about the first. (PS I opened #24563 to address the xxx visible in the patch.) |
|||
| msg248117 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2015年08月06日 09:15 | |
New changeset 08e03dfb7dab by Robert Collins in branch '2.7': Issue #24531: Document that encoding lines cannot follow non-comment lines. https://hg.python.org/cpython/rev/08e03dfb7dab New changeset ab75b7ff4dfe by Robert Collins in branch '3.4': Issue #24531: Document that encoding lines cannot follow non-comment lines. https://hg.python.org/cpython/rev/ab75b7ff4dfe New changeset caecc1869921 by Robert Collins in branch '3.5': Issue #24531: Document that encoding lines cannot follow non-comment lines. https://hg.python.org/cpython/rev/caecc1869921 New changeset 82c9ce30c0a0 by Robert Collins in branch 'default': Issue #24531: Document that encoding lines cannot follow non-comment lines. https://hg.python.org/cpython/rev/82c9ce30c0a0 |
|||
| msg248118 - (view) | Author: Robert Collins (rbcollins) * (Python committer) | Date: 2015年08月06日 09:15 | |
Thanks, applied across the board; I had to tweak it a little on 2.7. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:18 | admin | set | github: 68719 |
| 2015年08月06日 09:15:54 | rbcollins | set | status: open -> closed nosy: + rbcollins messages: + msg248118 resolution: fixed stage: commit review -> resolved |
| 2015年08月06日 09:15:17 | python-dev | set | nosy:
+ python-dev messages: + msg248117 |
| 2015年07月03日 23:40:36 | terry.reedy | set | files:
+ encode-declare.diff nosy: + terry.reedy messages: + msg246234 keywords: + patch stage: needs patch -> commit review |
| 2015年06月29日 19:50:17 | jwilk | set | messages: + msg245960 |
| 2015年06月29日 16:25:12 | r.david.murray | set | versions:
+ Python 2.7, Python 3.4, Python 3.5, Python 3.6 nosy: + r.david.murray messages: + msg245950 type: behavior stage: needs patch |
| 2015年06月29日 15:42:25 | jwilk | create | |