summarylogtreecommitdiffstats
path: root/0003-Use-collections.abc.patch
diff options
context:
space:
mode:
Diffstat (limited to '0003-Use-collections.abc.patch')
-rw-r--r--0003-Use-collections.abc.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/0003-Use-collections.abc.patch b/0003-Use-collections.abc.patch
new file mode 100644
index 000000000000..bf24167f7362
--- /dev/null
+++ b/0003-Use-collections.abc.patch
@@ -0,0 +1,46 @@
+From 25684c38ae82390ac5801a681cd459f882b093f2 Mon Sep 17 00:00:00 2001
+From: Freek Dijkstra <freek@macfreek.nl>
+Date: Tue, 26 Oct 2021 00:42:37 +0200
+Subject: [PATCH 3/3] Use collections.abc. With fall-back for outdated Pyton
+ 2.7 versions.
+
+---
+ nbt/nbt.py | 5 ++++-
+ nbt/region.py | 5 ++++-
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/nbt/nbt.py b/nbt/nbt.py
+index feb6d00..861a385 100644
+--- a/nbt/nbt.py
++++ b/nbt/nbt.py
+@@ -7,7 +7,10 @@ https://minecraft.gamepedia.com/NBT_format
+
+ from struct import Struct, error as StructError
+ from gzip import GzipFile
+-from typing import MutableMapping, MutableSequence, Sequence
++try:
++ from collections.abc import MutableMapping, MutableSequence, Sequence
++except ImportError: # for Python 2.7
++ from collections import MutableMapping, MutableSequence, Sequence
+ import sys
+
+ _PY3 = sys.version_info >= (3,)
+diff --git a/nbt/region.py b/nbt/region.py
+index d52b861..224099b 100644
+--- a/nbt/region.py
++++ b/nbt/region.py
+@@ -7,7 +7,10 @@ https://minecraft.gamepedia.com/Region_file_format
+
+ from .nbt import NBTFile, MalformedFileError
+ from struct import pack, unpack
+-from typing import Mapping
++try:
++ from collections.abc import Mapping
++except ImportError: # for Python 2.7
++ from collections import Mapping
+ import zlib
+ import gzip
+ from io import BytesIO
+--
+2.34.1
+