Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
@zzzeek

Description

@zzzeek
Issue body actions

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.