From: Tomi Ollila <tomi.ollila@iki.fi>
To: michaeljgruber+grubix+git@gmail.com, notmuch@notmuchmail.org
Cc: Michael J Gruber <git@grubix.eu>
Subject: Re: [PATCH] python: adjust legacy bindings to py 3.12
Date: Wed, 21 Jun 2023 11:18:08 +0300 [thread overview]
Message-ID: <y2uk89l.k7s4tu-too@iki.fi> (raw)
In-Reply-To: <d86aa787c32b44a39ac1e3dc7b84b77534f511ca.1686909798.git.git@grubix.eu>
On Fri, Jun 16 2023, michaeljgruber wrote:
> From: Michael J Gruber <git@grubix.eu>
>
> 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.
IMO LGTM in this particular case.
Tomi
> ---
> bindings/python/notmuch/compat.py | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> 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):
> --
> 2.41.0.169.g493b9e920c
>
> _______________________________________________
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-leave@notmuchmail.org
next prev parent reply other threads:[~2023-06-21 8:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-16 11:19 [PATCH] python: adjust legacy bindings to py 3.12 michaeljgruber+grubix+git
2023-06-21 8:18 ` Tomi Ollila [this message]
2023-07-09 14:57 ` David Bremner
2023-07-09 15:04 ` Michael J Gruber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=y2uk89l.k7s4tu-too@iki.fi \
--to=tomi.ollila@iki.fi \
--cc=git@grubix.eu \
--cc=michaeljgruber+grubix+git@gmail.com \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).