tanrj / pyodbc

Automatically exported from code.google.com/p/pyodbc
MIT No Attribution
0 stars 0 forks source link

Python 2.6 switch '-3' produces DeprecationWarning on import of pyodbc #7

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The '-3' switch was added to Python 2.6 in order to provide warnings for
deprecated usages in Py3k. Currently the only warning I have seen is the
following, upon import:
pyodbc.pyd:6: DeprecationWarning: the sha module is deprecated; use the
hashlib module instead

This will break compatibility with Python 3.0 (although I'm not sure this
is even in the immediate roadmap)

However, given that hashlib was introduced in 2.5, you will need to use
some sort of try/except import hack to maintain the current level of
backwards compatibility. Something along the lines of:
try:
    from hashlib import sha1 as sha
except ImportError:
    from sha import sha

Original issue reported on code.google.com by tarkatronic on 1 Dec 2008 at 8:47

GoogleCodeExporter commented 8 years ago
Thanks.  I actually have that in the C++ code, but I commented it out to make 
sure it
worked if hashlib wasn't found.  Unfortunately, I forgot and left it commented 
out. 
I'll check it in soon.

Original comment by mkleehammer on 1 Dec 2008 at 10:11

GoogleCodeExporter commented 8 years ago
Fixed in 2.1.2

Original comment by mkleehammer on 6 Dec 2008 at 3:40

GoogleCodeExporter commented 8 years ago

Original comment by mkleehammer on 21 Nov 2010 at 4:44