Mailing List Archive

pygrub is broken in Python 3.8
Hey,

I am packaging xen for Arch Linux. Are are on Python 3.8 and it looks
like with it some issues in xen.lowlevel.xc get highlighted and the
module doesn't work.

When invoking pygrub:

$ pygrub
Traceback (most recent call last):
File "/usr/bin/pygrub", line 21, in <module>
import xen.lowlevel.xc
SystemError: bad call flags

It looks like that in Python 3.8 the descriptor flags of methods
in native modules are checked when the module is imported, as opposed
to when the method is called (see [1], and it might be causing this
error.

I had a look at the code yesterday to see if I could spot the bad
method(s) but I didn't really find anything. I did not have that much
time to spend on it and I am not familiar with the code so I probably
missed it.

Is this a known issue? If so, is there any patch scheduled? I couldn't
find anything in the repo.

[1] https://bugs.python.org/msg348804

Thank you,
Filipe LaĆ­ns
Re: pygrub is broken in Python 3.8 [ In reply to ]
Felipe,

thanks for posting your analysis and the link to the python bug.
The bug came up recently for me on Focal 20.04 with xen-4.12.2 when
Ubuntu went to python3.8.

I've come up with an attached patch that works in python3.8 on Ubuntu 20.04.

patch is also pasted here:
https://paste.debian.net/plain/1134847

now object imports work in pygrub:
import xen.lowlevel.xc

cheers,
PryMar56
##xen-packaging on Freenode IRC
Re: pygrub is broken in Python 3.8 [ In reply to ]
On Fri, Mar 13, 2020 at 01:52:32PM -0700, Pry Mar wrote:
> Felipe,
>
> thanks for posting your analysis and the link to the python bug.
> The bug came up recently for me on Focal 20.04 with xen-4.12.2 when
> Ubuntu went to python3.8.
>
> I've come up with an attached patch that works in python3.8 on Ubuntu 20.04.
>
> patch is also pasted here:
> https://paste.debian.net/plain/1134847
>
> now object imports work in pygrub:
> import xen.lowlevel.xc
>
> cheers,
> PryMar56
> ##xen-packaging on Freenode IRC

> From 0d2791b007436f83cc8cb922acb1849a3ff31f3a Mon Sep 17 00:00:00 2001
> From: Anthony PERARD <anthony.perard@citrix.com>
> Date: Fri, 15 Nov 2019 16:15:32 +0000
> Subject: [PATCH] lowlevel/xc: Fix function calls for python 3.8
>
> https://bugs.python.org/msg348804
>
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

I am NOT the author of this patch.

Please change the author, and fix the signed-off-by tag. Thank you.

Pry Mar, may I suggest that you read this wiki page
https://wiki.xenproject.org/wiki/Submitting_Xen_Project_Patches
and then fix the patch and send it upstream? The community will
appreciate.

--
Anthony PERARD

_______________________________________________
Xen-users mailing list
Xen-users@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-users