adriank / ObjectPath

The agile query language for semi-structured data
http://objectpath.org
MIT License
380 stars 93 forks source link

sys.version should not be used for version checks #18

Closed svisser closed 9 years ago

svisser commented 9 years ago

In various places you're using sys.version to determine the Python version. This should use sys.version_info instead as there is no guarantee that the Python version is always at the beginning of sys.version.

adriank commented 9 years ago

I will change it in a moment, thanks.

Greetings, Adrian Kalbarczyk

http://about.me/akalbarczyk

2014-10-06 16:37 GMT+02:00 Simeon Visser notifications@github.com:

In various places you're using sys.version to determine the Python version. This should use sys.version_info instead as there is no guarantee that the Python version is always at the beginning of sys.version.

— Reply to this email directly or view it on GitHub https://github.com/adriank/ObjectPath/issues/18.

svisser commented 9 years ago

You need to make sure that you're now comparing with an integer, not a string. Even in Python 2 sys.version_info < "3" will be False because sys.version_info is a tuple of integers.

adriank commented 9 years ago

Now it's sys.version_info.major == 3 everywhere.

Greetings, Adrian Kalbarczyk

http://about.me/akalbarczyk

2014-10-06 22:45 GMT+02:00 Simeon Visser notifications@github.com:

You need to make sure that you're now comparing with integers, not string. Even in Python 2 sys.version_info < "3" will be False because sys.version_info is a tuple of integers.

— Reply to this email directly or view it on GitHub https://github.com/adriank/ObjectPath/issues/18#issuecomment-58094771.