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: symtable module crashes w/ coding declaration
Type: Stage:
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: nnorwitz Nosy List: astrand, benjamin.peterson, nnorwitz
Priority: normal Keywords:

Created on 2004-02-16 20:49 by astrand, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg20018 - (view) Author: Peter Åstrand (astrand) * (Python committer) Date: 2004-02-16 20:49
The symtable module doesn't work with source code
encodings, it seems. Sample code:

#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-

import sys
import symtable
filename = sys.argv[0]
tab = symtable.symtable(open(filename).read(),
filename, exec")
print tab.get_type()

When running this code, I get:

Traceback (most recent call last):
  File "./bar.py", line 8, in ?
    print tab.get_type()
  File "/usr/local/lib/python2.3/symtable.py", line 71,
in get_type
    assert self._table.type in (1, 2, 3), \
AssertionError: unexpected type: 0

If I remove the source code encoding declaration,
things work fine. I've verified this problem with 2.3.2
and 2.3.3. 2.2.0 and 2.2.2 works fine. 
msg20019 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2005-10-03 01:13
Logged In: YES 
user_id=33168

This is still a problem w/2.5.
msg71417 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-08-19 13:17
I'm pleased to say this is not an issue in 2.6.
History
Date User Action Args
2022-04-11 14:56:02adminsetgithub: 39943
2008-08-19 13:17:00benjamin.petersonsetstatus: open -> closed
resolution: fixed
messages: + msg71417
nosy: + benjamin.peterson
2008-01-20 19:32:36christian.heimessetversions: + Python 2.6, - Python 2.3
2004-02-16 20:49:26astrandcreate