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.

Author ocean-city
Recipients ocean-city
Date 2008-03-18.07:28:37
SpamBayes Score 0.15831342
Marked as misclassified No
Message-id <1205825319.07.0.115749100037.issue2384@psf.upfronthosting.co.za>
In-reply-to
Content
# This issue inherits from issue2301.

If there is "# coding: ????" is in source code and
coding is neigher utf-8 nor iso-8859-1, line number (tok->lineno)
becomes wrong.

Please look into Parser/tokenizer.c. In this case, 
tok->decoding_state becomes STATE_NORMAL, so fp_setreadl
newly opens file but *doesn't* seek to current position.
(Or maybe can we reuse already opened file?)

So

# coding: ascii
# 1
# 2
# 3
raise RuntimeError("a")
# 4
# 5
# 6

outputs 

C:\Documents and Settings\WhiteRabbit>py3k ascii.py

Traceback (most recent call last):
  File "ascii.py", line 6, in <module>
    # 4
RuntimeError: a
[22821 refs]

One line shifted because line number wrongly +1

And

# dummy
# coding: ascii
# 1
# 2
# 3
raise RuntimeError("a")
# 4
# 5
# 6

outputs

C:\Documents and Settings\WhiteRabbit>py3k ascii.py

Traceback (most recent call last):
  File "ascii.py", line 8, in <module>
    # 5
RuntimeError: a
[22821 refs]

Two lines shifted because line number wrongly +2
History
Date User Action Args
2008-03-18 07:28:39ocean-citysetspambayes_score: 0.158313 -> 0.15831342
recipients: + ocean-city
2008-03-18 07:28:39ocean-citysetspambayes_score: 0.158313 -> 0.158313
messageid: <1205825319.07.0.115749100037.issue2384@psf.upfronthosting.co.za>
2008-03-18 07:28:38ocean-citylinkissue2384 messages
2008-03-18 07:28:37ocean-citycreate