From a7c14e2f29831f4bc5eb18e23e55eb6f7a4e3431 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 8 Apr 2024 17:12:12 +0200 Subject: Merging upstream version 115.8.0esr. Signed-off-by: Daniel Baumann --- testing/mozbase/mozprofile/mozprofile/prefs.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'testing/mozbase/mozprofile') diff --git a/testing/mozbase/mozprofile/mozprofile/prefs.py b/testing/mozbase/mozprofile/mozprofile/prefs.py index 6c3b1173c8..b84d531f23 100644 --- a/testing/mozbase/mozprofile/mozprofile/prefs.py +++ b/testing/mozbase/mozprofile/mozprofile/prefs.py @@ -12,7 +12,15 @@ import tokenize import mozfile import six from six import StringIO, string_types -from six.moves.configparser import SafeConfigParser as ConfigParser + +try: + from six.moves.configparser import SafeConfigParser as ConfigParser +except ImportError: # SafeConfigParser was removed in 3.12 + from configparser import ConfigParser +try: + ConfigParser.read_file +except AttributeError: # read_file was added in 3.2, readfp removed in 3.12 + ConfigParser.read_file = ConfigParser.readfp if six.PY3: @@ -24,7 +32,7 @@ __all__ = ("PreferencesReadError", "Preferences") class PreferencesReadError(Exception): - """read error for prefrences files""" + """read error for preferences files""" class Preferences(object): @@ -124,7 +132,7 @@ class Preferences(object): parser = ConfigParser() parser.optionxform = str - parser.readfp(mozfile.load(path)) + parser.read_file(mozfile.load(path)) if section: if section not in parser.sections(): -- cgit v1.2.3