Hi Diane,
On Sun, Jun 12, 2022 at 01:24:31PM -0700, Diane Trout wrote:
> On Sun, 2022-06-12 at 21:52 +0200, Guido Günther wrote:
> > > After looking the problem it up there's a line where it's trying to
> > > do a
> > > union type between _GenericAlias and NoneType, but that's a feature
> > > that
> > > was added in 3.10.
> > > https://peps.python.org/pep-0604/
> > > 
> > > Some of us on testing still have 3.9 as the default because numba
> > > doesn't work with 3.10. I think it's pretty reasonable to inidicate
> > > that
> > > gpb 0.9.27 does requires 3.10.
> > 
> > I'm also happy to apply a patch that makes it compatible with python
> > 3.9
> > again. The gain from the type annotations is pretty low atm.
> >  -- Guido
> 
> 
> This looks like a good solution for 3.9 & 3.10 compatibility
> it works on both 3.9 and 3.10 and expresses the same meaning.
> https://docs.python.org/3/library/typing.html#typing.Optional
> 
> Diane
> 
> diff --git a/usr/lib/python3/dist-packages/gbp/pkg/pkgpolicy.py~
> b/usr/lib/python3/dist-packages/gbp/pkg/pkgpolicy.py
> index c5427ee..9016828 100644
> --- a/usr/lib/python3/dist-packages/gbp/pkg/pkgpolicy.py~
> +++ b/usr/lib/python3/dist-packages/gbp/pkg/pkgpolicy.py
> @@ -34,8 +34,8 @@ class PkgPolicy(object):
>                           r'%(?P<R>([^%]|\\%))+'
>                           r'\)s')
> -    packagename_re: typing.Pattern[str] | None = None
> -    packagename_msg: str | None = None
> -    upstreamversion_re: typing.Pattern[str] | None = None
> -    upstreamversion_msg: str | None = None
> +    packagename_re: typing.Optional[typing.Pattern[str]] = None
> +    packagename_msg: typing.Optional[str] = None
> +    upstreamversion_re: typing.Optional[typing.Pattern[str]] = None
> +    upstreamversion_msg: typing.Optional[str] = None
>  
>      @classmethod

That works, thanks!
 -- Guido

Reply via email to