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.

classification
Title: digraphs on komment lines / xlib
Type: Stage:
Components: Interpreter Core Versions:
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: daddio_2, georg.brandl, terry.reedy
Priority: normal Keywords:

Created on 2003-07-16 09:24 by daddio_2, last changed 2022-04-10 16:09 by admin. This issue is now closed.

Messages (4)
msg17072 - (view) Author: Gregory Eckersley (daddio_2) Date: 2003-07-16 09:24
Python 2.3 falls over if it encounters non-ascii
characters on comment lines. These occur with digraphs
and non English names.
e.g.

This simple program

#!/usr/bin/python
print 'This program does nothing'
# Aber eine Kommentarzeile lýuft nicht!
# The " ý  " causes trouble
# This causes Xlib to stop working

causes the following output

sys:1: DeprecationWarning: Non-ASCII character '\xe4'
in file /nglob/g/bat/digraph.py on line 6, but no
encoding declared; see
http://www.python.org/peps/pep-0263.html for details
This program does nothing

Some libraries (such as python-xlib 2.2 ) cause this
problem. The line
parser ought ignore all comment content whether ascii
or not.
msg17073 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2003-07-20 20:46
Logged In: YES 
user_id=593130

1. Python 2.3 has not been released yet.  Please indicate 
exact versions on bug reports.  Including the system and OS 
often helps too.

2. The reported behavior is intentional and not a bug.  See 
Reference Manual 2. Lexical analysis: "Python uses the 7-bit 
ASCII character set" and the referenced PEP 0263.  Please 
close this report.

3. If a standard library module were to generate this 
warning, that would be a bug that should be reported here.  
If a third-party library does so, get a version updated for 2.3 
or request that the authors make one.

4. If you want to discuss intended behavior, post to 
comp.lang.python.  While your request about ignoring 
comments is superficially reasonable, the PEP seems to 
indicate that encoding is dealt with, and the warning issued, 
*before* any actual parsing, which is to say, before the 
parser knows what is a comment and what is not.  Detecting 
comments is not trivial since '#' within a string does not 
start a comment.
msg17074 - (view) Author: Gregory Eckersley (daddio_2) Date: 2003-07-21 00:37
Logged In: YES 
user_id=823572

I understand & agree with your comments. I did not include
the exact version
since it , as you say, seems to be an undesirable (in this
case) consequence of the PEP. Please consider this bug
report closed, and I'll follow it up in the short term with
xlib, and in the longer term with the PEP after looking at
whether there is a simple and systematic way of handling this.
msg17075 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-05-31 11:41
Logged In: YES 
user_id=1188172

This should already have been closed. As it is related to
python-xlib, marking as "3rd Party".
History
Date User Action Args
2022-04-10 16:09:59adminsetgithub: 38860
2003-07-16 09:24:12daddio_2create