Skip to content

Commit 48e97c3

Browse files
committed
WL14238: Deprecate Python 2.7 support
This worklog issue a DeprecationWarning about the deprecation of the Python 2.7 support, which will be removed in MySQL Connector/Python 8.0.24.
1 parent 939f268 commit 48e97c3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/mysql/connector/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@
4747
HAVE_DNSPYTHON = True
4848

4949
import random
50+
import warnings
5051

5152
from . import version
53+
from .catch23 import PY2
5254
from .connection import MySQLConnection
5355
from .constants import DEFAULT_CONFIGURATION
5456
from .errors import ( # pylint: disable=W0622
@@ -64,6 +66,11 @@
6466
apilevel, threadsafety, paramstyle)
6567
from .optionfiles import read_option_files
6668

69+
if PY2:
70+
warnings.warn("MySQL Connector/Python will drop support for Python 2.7 in "
71+
"release 8.0.24. Please upgrade your Python as Python 2.7 "
72+
"won't work after this release", category=DeprecationWarning)
73+
6774
_CONNECTION_POOLS = {}
6875

6976
ERROR_NO_CEXT = "MySQL Connector/Python C Extension not available"

0 commit comments

Comments
 (0)