Not compatible with python 2.4

Christian Ebert avatarChristian 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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.