* [PATCH] python: adjust legacy bindings to py 3.12
@ 2023-06-16 11:19 michaeljgruber+grubix+git
2023-06-21 8:18 ` Tomi Ollila
2023-07-09 14:57 ` David Bremner
0 siblings, 2 replies; 4+ messages in thread
From: michaeljgruber+grubix+git @ 2023-06-16 11:19 UTC (permalink / raw)
To: notmuch; +Cc: Michael J Gruber
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.
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] python: adjust legacy bindings to py 3.12
2023-06-16 11:19 [PATCH] python: adjust legacy bindings to py 3.12 michaeljgruber+grubix+git
@ 2023-06-21 8:18 ` Tomi Ollila
2023-07-09 14:57 ` David Bremner
1 sibling, 0 replies; 4+ messages in thread
From: Tomi Ollila @ 2023-06-21 8:18 UTC (permalink / raw)
To: michaeljgruber+grubix+git, notmuch; +Cc: Michael J Gruber
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] python: adjust legacy bindings to py 3.12
2023-06-16 11:19 [PATCH] python: adjust legacy bindings to py 3.12 michaeljgruber+grubix+git
2023-06-21 8:18 ` Tomi Ollila
@ 2023-07-09 14:57 ` David Bremner
2023-07-09 15:04 ` Michael J Gruber
1 sibling, 1 reply; 4+ messages in thread
From: David Bremner @ 2023-07-09 14:57 UTC (permalink / raw)
To: michaeljgruber+grubix+git, notmuch; +Cc: Michael J Gruber
michaeljgruber+grubix+git@gmail.com writes:
> 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.
Applied to master.
Apropos, how many people are still using the legacy bindings?
d
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] python: adjust legacy bindings to py 3.12
2023-07-09 14:57 ` David Bremner
@ 2023-07-09 15:04 ` Michael J Gruber
0 siblings, 0 replies; 4+ messages in thread
From: Michael J Gruber @ 2023-07-09 15:04 UTC (permalink / raw)
To: David Bremner; +Cc: notmuch
Am So., 9. Juli 2023 um 16:57 Uhr schrieb David Bremner <david@tethera.net>:
>
> michaeljgruber+grubix+git@gmail.com writes:
>
> > 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.
>
> Applied to master.
>
> Apropos, how many people are still using the legacy bindings?
>
We are still shipping them in Fedora (but, simply put, we have no py2
any more), and that's how I noticed the issue.
Also, `afew` is not fully converted yet. It's WISP. S = slow ;-)
Cheers
Michael
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-07-09 15:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-16 11:19 [PATCH] python: adjust legacy bindings to py 3.12 michaeljgruber+grubix+git
2023-06-21 8:18 ` Tomi Ollila
2023-07-09 14:57 ` David Bremner
2023-07-09 15:04 ` Michael J Gruber
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).