diff options
| author | Michael J Gruber <git@grubix.eu> | 2023-06-16 13:19:26 +0200 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2023-07-09 11:43:21 -0300 |
| commit | 3771832b013012e408696897215fd0edde7dce37 (patch) | |
| tree | ca1c97febac142dd84a46e2822be8cac642e365f /bindings/python | |
| parent | 95a4bf38173311597bcc4fa7f597d58bb11ed119 (diff) | |
python: adjust legacy bindings to py 3.12
Py 3.12 finally pulled the plug on the `SafeConfigParser` class which
has been deprecated since py 3.2.
We use it in the legacy bindings only, so take the easy route of
importing `ConfigParser` as `SafeConfigParser` and monkey-patching so
that the class has the expected interface.
Diffstat (limited to 'bindings/python')
| -rw-r--r-- | bindings/python/notmuch/compat.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bindings/python/notmuch/compat.py b/bindings/python/notmuch/compat.py index c931329e..4a94e05c 100644 --- a/bindings/python/notmuch/compat.py +++ b/bindings/python/notmuch/compat.py @@ -47,7 +47,10 @@ if sys.version_info[0] == 2: return value else: - from configparser import SafeConfigParser + from configparser import ConfigParser as SafeConfigParser + + if not hasattr(SafeConfigParser, 'readfp'): # py >= 3.12 + SafeConfigParser.readfp = SafeConfigParser.read_file class Python3StringMixIn(object): def __str__(self): |
