jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/835153 )

Change subject: [cleanup] Require 0.9.3 for pymysql
......................................................................

[cleanup] Require 0.9.3 for pymysql

- toolforge has pymysql 0.9.3 preinstalled. This version is already
  required with setup.py and requirement.txt
- remove _OldConnection class 0.7.10 workarround
- update changelog

Bug: T216741
Change-Id: I7f549ee6ce07a04d36e8d9d2a0b15a27061b391a
---
M ROADMAP.rst
M pywikibot/data/mysql.py
2 files changed, 3 insertions(+), 43 deletions(-)

Approvals:
  JJMC89: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/ROADMAP.rst b/ROADMAP.rst
index fbda6e7..fd63a3e 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,7 +1,8 @@
 Current release 8.0.0
 ^^^^^^^^^^^^^^^^^^^^^

-*(no changes yet)*
+* pymysql >= 0.9.3 is required (:phab:`T216741`)
+* Python 3.5 support was dropped (:phab:`T301908`)

 Deprecations
 ^^^^^^^^^^^^
@@ -40,10 +41,7 @@
 Will be removed in Pywikibot 8
 ------------------------------

-* 7.3.0: Python 3.5 support will be dropped (:phab:`T301908`)
-* 7.1.0: win32_unicode.py will be removed
 * 7.0.0: The i18n identifier 'cosmetic_changes-append' will be removed in 
favour of 'pywikibot-cosmetic-changes'
-* 7.0.0: pymysql < 0.7.11 will be dropped; require pymysql >= 0.7.11 
(:phab:`T216741`)
 * 5.5.0: APISite.redirectRegex() will be removed in favour of 
APISite.redirect_regex()
 * 4.0.0: Revision.parent_id will be removed in favour of Revision.parentid
 * 4.0.0: Revision.content_model will be removed in favour of 
Revision.contentmodel
diff --git a/pywikibot/data/mysql.py b/pywikibot/data/mysql.py
index b458d26..7cbf1ab 100644
--- a/pywikibot/data/mysql.py
+++ b/pywikibot/data/mysql.py
@@ -4,7 +4,6 @@
 #
 # Distributed under the terms of the MIT license.
 #
-import struct
 from typing import Optional

 import pkg_resources
@@ -12,7 +11,6 @@
 import pywikibot
 from pywikibot import config
 from pywikibot.backports import removesuffix
-from pywikibot.tools import issue_deprecation_warning


 try:
@@ -21,35 +19,6 @@
     raise ImportError('MySQL python module not found. Please install PyMySQL.')


-COM_QUIT = 0x01
-
-
-class _OldConnection(pymysql.connections.Connection):
-
-    """Representation of a socket with a mysql server.
-
-    This class is used to patch close() method for pymysql<0.7.11 on
-    toolforge (:phab:`T216741`).
-
-    .. versionadded:: 7.0
-    .. deprecated:: 7.4
-       Update your pymysql package
-    """
-
-    def close(self) -> None:  # pragma: no cover
-        """Send the quit message and close the socket."""
-        if self._closed or self._sock is None:
-            super().close()
-
-        send_data = struct.pack('<iB', 1, COM_QUIT)
-        try:
-            self._write_bytes(send_data)
-        except Exception:
-            pass
-        finally:
-            self._force_close()
-
-
 def mysql_query(query: str, params=None,
                 dbname: Optional[str] = None,
                 verbose: Optional[bool] = None):
@@ -96,14 +65,7 @@
         'defer_connect': query == 'test',  # for tests
     }

-    if pymysql_version < pkg_resources.parse_version('0.7.11'):
-        issue_deprecation_warning(
-            f'pymysql package release {pymysql_version}',
-            instead='pymysql >= 0.7.11', since='7.4.0')
-        connection = _OldConnection(**args, **credentials)
-    else:
-        connection = pymysql.connect(**args, **credentials)
-
+    connection = pymysql.connect(**args, **credentials)
     if pymysql_version < pkg_resources.parse_version('1.0.0'):
         from contextlib import closing
         connection = closing(connection)

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/835153
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I7f549ee6ce07a04d36e8d9d2a0b15a27061b391a
Gerrit-Change-Number: 835153
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <i...@gno.de>
Gerrit-Reviewer: JJMC89 <jjmc89.wikime...@gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.w...@gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org

Reply via email to