Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue7260] SyntaxError with a not-existing offset for unicode code

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Nov 3, 2009, 11:04 PM

Post #1 of 3 (97 views)
Permalink
[issue7260] SyntaxError with a not-existing offset for unicode code

New submission from Noam Raphael <noamraph [at] gmail>:

Hello,

This is from the current svn:

> ./python
Python 3.2a0 (py3k:76104, Nov 4 2009, 08:49:44)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> try:
... eval("u'שלום'")
... except SyntaxError as e:
... e
...
SyntaxError('invalid syntax', ('<string>', 1, 11, "u'שלום'"))

As you can see, the offset (11) refers to a non-existing character, as
the code contains only 7 characters.

Thanks,
Noam

----------
components: Interpreter Core
messages: 94879
nosy: noam
severity: normal
status: open
title: SyntaxError with a not-existing offset for unicode code
versions: Python 3.2

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7260>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 3, 2009, 11:17 PM

Post #2 of 3 (96 views)
Permalink
[issue7260] SyntaxError with a not-existing offset for unicode code [In reply to]

Ezio Melotti <ezio.melotti [at] gmail> added the comment:

Apparently the position of the caret is based on the number of bytes in
the line, not on the characters:
>>> [aaa for x in]
File "<stdin>", line 1
[aaa for x in]
^
SyntaxError: invalid syntax
>>> [äää for x in]
File "<stdin>", line 1
[äää for x in]
^
SyntaxError: invalid syntax

In this example each ä takes two bytes so the caret is 3 extra chars on
the right.

----------
nosy: +ezio.melotti
priority: -> normal

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7260>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 3, 2009, 11:49 PM

Post #3 of 3 (97 views)
Permalink
[issue7260] SyntaxError with a not-existing offset for unicode code [In reply to]

Ezio Melotti <ezio.melotti [at] gmail> added the comment:

This is actually a duplicate of #2382, so I'm closing it.
#2382 also has some patch.

----------
resolution: -> duplicate
stage: -> committed/rejected
status: open -> closed

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7260>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.