Issue #749 resolved

Not compatible with python 2.4

Christian Ebert
created an issue

See #739, but that started out differently. Anyway, guess_lexer_for_filename causes a traceback in Python 2.4:

{{{ Python 2.4.3 (#1, Sep 21 2011, 19:55:41) [GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2 Type "help", "copyright", "credits" or "license" for more information.

from pygments.lexers import guess_lexer_for_filename text = open('setup.py').read()[:1024] guess_lexer_for_filename('setup.py', text) Traceback (most recent call last): File "<stdin>", line 1, in ? File "pygments/lexers/init.py", line 172, in guess_lexer_for_filename for lexer in _iter_lexerclasses(): File "pygments/lexers/init.py", line 147, in _iter_lexerclasses _load_lexers(module_name) File "pygments/lexers/init.py", line 32, in _load_lexers mod = import(module_name, None, None, ['all']) File "pygments/lexers/other.py", line 22, in ? from pygments.lexers.sql import SqlLexer, MySqlLexer, SqliteConsoleLexer File "pygments/lexers/sql.py", line 174, in ? class PlPgsqlLexer(PostgresBase, RegexLexer): File "pygments/lexers/sql.py", line 185, in PlPgsqlLexer tokens = deepcopy(PostgresLexer.tokens) File "/usr/lib64/python2.4/copy.py", line 174, in deepcopy y = copier(x, memo) File "/usr/lib64/python2.4/copy.py", line 268, in _deepcopy_dict y[deepcopy(key, memo)] = deepcopy(value, memo) File "/usr/lib64/python2.4/copy.py", line 174, in deepcopy y = copier(x, memo) File "/usr/lib64/python2.4/copy.py", line 241, in _deepcopy_list y.append(deepcopy(a, memo)) File "/usr/lib64/python2.4/copy.py", line 174, in deepcopy y = copier(x, memo) File "/usr/lib64/python2.4/copy.py", line 248, in _deepcopy_tuple y.append(deepcopy(a, memo)) File "/usr/lib64/python2.4/copy.py", line 204, in deepcopy y = _reconstruct(x, rv, 1, memo) File "/usr/lib64/python2.4/copy.py", line 336, in _reconstruct y = callable(args) File "/usr/lib64/python2.4/copy_reg.py", line 92, in newobj return cls.new(cls, args) TypeError: function() takes at least 2 arguments (0 given)

}}}

This also makes the mercurial highlight extension incompatible with Python 2.4: https://bitbucket.org/mirror/mercurial/src/63a1bed65fa3/hgext/highlight/highlight.py#cl-41

Comments (5)

  1. Log in to comment