[PATCH] Support older Pythons in oauth_server.py

From: Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: [PATCH] Support older Pythons in oauth_server.py
Date: 2025-04-22 19:25:09
Message-ID: CAOYmi+mvTFNmkH=Tym7dzqSJUr2DcewdJ0hGQ9VyA6nOMEYHHg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Apr 22, 2025 at 8:29 AM Jacob Champion
<jacob(dot)champion(at)enterprisedb(dot)com> wrote:
> On Tue, Apr 22, 2025 at 8:05 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > The first problem is that this Python version seems not to
> > like assignments embedded in if statements: [...]
> >
> > I was able to work around that with the attached quick hack.
> > But then I get [...]
>
> Thanks, I'll put a patch together. Sorry -- IIRC, both of those
> features are probably too new for me to have used, regardless of what
> we decide is the minimum version for 18.

Splitting this off into its own $SUBJECT.

I coupled oauth_server to new Python stuff without realizing it, sorry:
- urllib's reclassification of `~` as a safe URL character (3.7)
- walrus operator `:=` (3.8)
- dict[type, type] annotations (3.9)
- str.removeprefix/suffix() (3.9)

Attached patch gets rid of all that.

This is tested against Python 3.6.15 (3.6 went EOL at the end of
2021). I'm working on getting Rocky 8 installed locally to test
against. If it's decided we want to support downwards to 3.5, I will
test there too (but I hope we don't; see parent thread).

Thanks,
--Jacob

Attachment Content-Type Size
0001-oauth-Support-Python-3.6-in-tests.patch application/octet-stream 3.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2025-04-22 19:32:41 Re: What's our minimum supported Python version?
Previous Message Renan Alves Fonseca 2025-04-22 19:09:28 Re: What's our minimum supported Python version?