Xqt has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1147148?usp=email )
Change subject: IMPR: use the new compression module which introduced with
Python 3.14
......................................................................
IMPR: use the new compression module which introduced with Python 3.14
Change-Id: I34f39fcdd402f7adeb9606c47bb54f2c2e7870f6
---
M pywikibot/tools/__init__.py
1 file changed, 9 insertions(+), 4 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index 3a9ed6c..2a49960 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -1,18 +1,15 @@
"""Miscellaneous helper functions (not wiki-dependent)."""
#
-# (C) Pywikibot team, 2008-2024
+# (C) Pywikibot team, 2008-2025
#
# Distributed under the terms of the MIT license.
#
from __future__ import annotations
import abc
-import bz2
-import gzip
import hashlib
import importlib.metadata
import ipaddress
-import lzma
import os
import re
import stat
@@ -44,6 +41,14 @@
from pywikibot.tools._unidata import _first_upper_exception
+try: # Python 3.14+
+ from compression import bz2, gzip, lzma
+except ModuleNotFoundError:
+ import bz2
+ import gzip
+ import lzma
+
+
__all__ = (
# deprecating functions
'ModuleDeprecationWrapper',
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1147148?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I34f39fcdd402f7adeb9606c47bb54f2c2e7870f6
Gerrit-Change-Number: 1147148
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]