Commit 32fbd35
authored
Fix unexpected 'decode' AttributeError when MySQLdb module is mapped by PyMySQL (#336)
* Skip if MySQLdb module is mapped by PyMySQL
In some use cases, `pymysql.install_as_MySQLdb()` will be used to initialize a 'fake' MySQLdb module,
which is actually mapped to pymysql module.
Then the sw_mysqlclient plugin will change the data type of `connection.db` from bytes into str,
cause the `AttributeError: 'str' object has no attribute 'decode'` exception in sw_pymysql.py line 45,
which regard it as bytes.1 parent f7b10db commit 32fbd35
2 files changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| |||
0 commit comments