From e954314fe52a6b3e40549b27f794aa00d0fd4375 Mon Sep 17 00:00:00 2001 From: Itamar Turner-Trauring Date: Tue, 28 Jul 2020 11:23:40 -0400 Subject: [PATCH] Don't expose Python 3 dicts to innocent, unsuspecting Python 2 code. --- src/allmydata/util/dictutil.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/allmydata/util/dictutil.py b/src/allmydata/util/dictutil.py index 9ed99d7c4..d5f0da29b 100644 --- a/src/allmydata/util/dictutil.py +++ b/src/allmydata/util/dictutil.py @@ -10,7 +10,10 @@ from __future__ import unicode_literals from future.utils import PY2 if PY2: - from builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, int, list, object, range, str, max, min # noqa: F401 + # IMPORTANT: We deliberately don't import dict. The issue is that we're + # subclassing dict, so we'd end up exposing Python 3 dict APIs to lots of + # code that doesn't support it. + from builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, int, list, object, range, str, max, min # noqa: F401 class DictOfSets(dict):