#263 python 3 support

open
Andy Dustman
MySQLdb (285)
5
2012-09-19
2008-09-22
No

MySQL-python-1.2.2]$ /v/linux24_i386/lang/python/3.0rc1/bin/python3.0 setup.py
File "setup.py", line 9
raise Error, "Python-2.3 or newer is required"
^
SyntaxError: invalid syntax

Discussion

  • We should be using sys.hexversion which appeared way back in python 1.5

    --- setup.py (revision 565)
    +++ setup.py (working copy)
    @@ -4,7 +4,7 @@
    import sys
    from setuptools import setup, Extension

    -if sys.version_info < (2, 3):
    +if not hasattr(sys, "hexversion") or sys.hexversion < 0x02030000:
    raise Error("Python-2.3 or newer is required")

     
  • kawai
    kawai
    2009-01-15

    No, this is from PEP3109. http://www.python.org/dev/peps/pep-3109/

    • raise Error, "Python-2.3 or newer is required"
    • raise Error("Python-2.3 or newer is required")

    There are more lines we should modify to adapt to python 3.

     
  • Andy has put this fix in 1.2.3 beta 1, and it's also now in trunk.