python-cheetah/import-from-the-new-abc-module.patch

30 lines
815 B
Diff
Raw Normal View History

2022-04-12 10:38:33 +08:00
From 488f246543f8a18ee8ecf8748edec72ade508288 Mon Sep 17 00:00:00 2001
From: xigaoxinyan <xigaoxinyan@huawei.com>
Date: Thu, 7 Apr 2022 19:25:39 +0800
Subject: [PATCH] ImportError-py3.10
---
NameMapper.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/NameMapper.py b/NameMapper.py
index 68ded17..f5207e0 100644
--- a/Cheetah/NameMapper.py
+++ b/Cheetah/NameMapper.py
@@ -139,8 +139,10 @@ difference in realistic usage scenarios.
Cheetah uses the optimized C version (_namemapper.c) if it has
been compiled or falls back to the Python version if not.
"""
-
-from collections import Mapping
+try:
+ from collections.abc import Mapping
+except ImportError:
+ from collections import Mapping
import inspect
from pprint import pformat
from Cheetah.compat import PY2
--
2.27.0