[Python-modules-team] Bug#968600: prompt-toolkit: does deprecated import, causing warning

ralphb at gmx.ph ralphb at gmx.ph
Tue Aug 18 12:18:07 BST 2020


Source: prompt-toolkit
Version: 1.0.15-1
Severity: normal

Dear Python maintainers,

The version of prompt-toolkit in Debian buster contains:

    from collections import Mapping

in the file prompt_toolkit/styles/from_dict.py.  That is deprecated
in Python 3 and causes a warning that it should be changed to:

    from collections.abc import Mapping

The warning appears upon every startup of xonsh, for example.

Below is a patch that makes the recommended change.  I hope it will
be possible to include it in a future stable update.

Thank you,
Ralph.


-- System Information:
Debian Release: 10.5
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: armhf (armv7l)

Kernel: Linux 5.7.0-0.bpo.2-armmp (SMP w/4 CPU cores)
Locale: LANG=en_PH.UTF-8, LC_CTYPE=en_PH.UTF-8 (charmap=UTF-8), LANGUAGE=en_PH:en (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled



Index: prompt-toolkit-1.0.15/prompt_toolkit/styles/from_dict.py
===================================================================
--- prompt-toolkit-1.0.15.orig/prompt_toolkit/styles/from_dict.py
+++ prompt-toolkit-1.0.15/prompt_toolkit/styles/from_dict.py
@@ -6,7 +6,7 @@ This is very similar to the Pygments sty
 - Support for ANSI color names. (These will map directly to the 16 terminal
   colors.)
 """
-from collections import Mapping
+from collections.abc import Mapping

 from .base import Style, DEFAULT_ATTRS, ANSI_COLOR_NAMES
 from .defaults import DEFAULT_STYLE_EXTENSIONS



More information about the Python-modules-team mailing list