Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysqldb crashes or otherwise misbehaves on python 3.8.0b1 if warnings as errors are enabled #359

Closed
zzzeek opened this issue Jun 7, 2019 · 1 comment · Fixed by #360
Closed

Comments

@zzzeek
Copy link

zzzeek commented Jun 7, 2019

I'm getting lots of different varieties of this failure but the general idea seems to be that if deprecation warnings raise errors, MySQLdb can't run queries, Python 3.8.0b1:

import warnings
import MySQLdb

# remove this to eliminate errors
warnings.filterwarnings("error", category=DeprecationWarning)


conn = MySQLdb.connect(user="scott", password="tiger", host="localhost", db="test")
cursor = conn.cursor()
cursor.execute("select 1")

output:

Traceback (most recent call last):
  File "test3.py", line 9, in <module>
    cursor.execute("select 1")
  File "/home/classic/dev/sqlalchemy/.tox/py38-mysql/lib/python3.8/site-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/home/classic/dev/sqlalchemy/.tox/py38-mysql/lib/python3.8/site-packages/MySQLdb/cursors.py", line 312, in _query
    db.query(q)
  File "/home/classic/dev/sqlalchemy/.tox/py38-mysql/lib/python3.8/site-packages/MySQLdb/connections.py", line 224, in query
    _mysql.connection.query(self, query)
MySQLdb._exceptions.ProgrammingError: (1064, <NULL>)

If I try to use charset, I get something different (likely because it is tripping over a deprecation warning -> error somewhere else):

import warnings
import MySQLdb

warnings.filterwarnings("error", category=DeprecationWarning)


conn = MySQLdb.connect(user="scott", password="tiger", host="localhost", db="test", charset="utf8mb4")
cursor = conn.cursor()
cursor.execute("select 1")

raises:

MySQLdb._exceptions.ProgrammingError: (1064, 'You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near \'H??t\'H??t"1?f\x0f\x1f?\' at line 1')

but what's weird is that it's not raising for a deprecation warning, so it looks like something is happening in the C code

methane added a commit that referenced this issue Jun 8, 2019
@zzzeek
Copy link
Author

zzzeek commented Jun 8, 2019

similar issue observed in cx_Oracle at oracle/python-cx_Oracle#317

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant