* [Xen-devel] [XEN PATCH] mismatch between pyxc_methods flags and PyObject definitions
@ 2020-03-17 23:01 YOUNG, MICHAEL A.
2020-03-23 11:48 ` Wei Liu
2020-03-24 2:32 ` Marek Marczykowski-Górecki
0 siblings, 2 replies; 5+ messages in thread
From: YOUNG, MICHAEL A. @ 2020-03-17 23:01 UTC (permalink / raw)
To: xen-devel
Cc: Ian Jackson, Marek Marczykowski-Górecki, Wei Liu, YOUNG, MICHAEL A.
pygrub in xen-4.13.0 with python 3.8.2 fails with the error
Traceback (most recent call last):
File "/usr/libexec/xen/bin/pygrub", line 21, in <module>
import xen.lowlevel.xc
SystemError: bad call flags
This patch fixes mismatches in tools/python/xen/lowlevel/xc/xc.c
between the flag bits defined in pyxc_methods and the parameters passed
to the corresponding PyObject definitions.
With this patch applied pygrub works as expected.
Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
---
tools/python/xen/lowlevel/xc/xc.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index ac0e26a742..8fde5f311f 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -2028,7 +2028,7 @@ static PyMethodDef pyxc_methods[] = {
{ "gnttab_hvm_seed",
(PyCFunction)pyxc_gnttab_hvm_seed,
- METH_KEYWORDS, "\n"
+ METH_VARARGS | METH_KEYWORDS, "\n"
"Initialise HVM guest grant table.\n"
" dom [int]: Identifier of domain to build into.\n"
" console_gmfn [int]: \n"
@@ -2097,7 +2097,7 @@ static PyMethodDef pyxc_methods[] = {
{ "sched_credit_domain_set",
(PyCFunction)pyxc_sched_credit_domain_set,
- METH_KEYWORDS, "\n"
+ METH_VARARGS | METH_KEYWORDS, "\n"
"Set the scheduling parameters for a domain when running with the\n"
"SMP credit scheduler.\n"
" domid [int]: domain id to set\n"
@@ -2115,7 +2115,7 @@ static PyMethodDef pyxc_methods[] = {
{ "sched_credit2_domain_set",
(PyCFunction)pyxc_sched_credit2_domain_set,
- METH_KEYWORDS, "\n"
+ METH_VARARGS | METH_KEYWORDS, "\n"
"Set the scheduling parameters for a domain when running with the\n"
"SMP credit2 scheduler.\n"
" domid [int]: domain id to set\n"
@@ -2393,21 +2393,21 @@ static PyMethodDef pyxc_methods[] = {
{ "flask_context_to_sid",
(PyCFunction)pyflask_context_to_sid,
- METH_KEYWORDS, "\n"
+ METH_VARARGS | METH_KEYWORDS, "\n"
"Convert a context string to a dynamic SID.\n"
" context [str]: String specifying context to be converted\n"
"Returns: [int]: Numeric SID on success; -1 on error.\n" },
{ "flask_sid_to_context",
(PyCFunction)pyflask_sid_to_context,
- METH_KEYWORDS, "\n"
+ METH_VARARGS | METH_KEYWORDS, "\n"
"Convert a dynamic SID to context string.\n"
" context [int]: SID to be converted\n"
"Returns: [str]: Numeric SID on success; -1 on error.\n" },
{ "flask_load",
(PyCFunction)pyflask_load,
- METH_KEYWORDS, "\n"
+ METH_VARARGS | METH_KEYWORDS, "\n"
"Loads a policy into the hypervisor.\n"
" policy [str]: policy to be load\n"
"Returns: [int]: 0 on success; -1 on failure.\n" },
@@ -2420,14 +2420,14 @@ static PyMethodDef pyxc_methods[] = {
{ "flask_setenforce",
(PyCFunction)pyflask_setenforce,
- METH_KEYWORDS, "\n"
+ METH_VARARGS | METH_KEYWORDS, "\n"
"Modifies the current mode for the Flask XSM module.\n"
" mode [int]: mode to change to\n"
"Returns: [int]: 0 on success; -1 on failure.\n" },
{ "flask_access",
(PyCFunction)pyflask_access,
- METH_KEYWORDS, "\n"
+ METH_VARARGS | METH_KEYWORDS, "\n"
"Returns whether a source context has access to target context based on \
class and permissions requested.\n"
" scon [str]: source context\n"
--
2.21.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Xen-devel] [XEN PATCH] mismatch between pyxc_methods flags and PyObject definitions
2020-03-17 23:01 [Xen-devel] [XEN PATCH] mismatch between pyxc_methods flags and PyObject definitions YOUNG, MICHAEL A.
@ 2020-03-23 11:48 ` Wei Liu
2020-03-24 2:32 ` Marek Marczykowski-Górecki
1 sibling, 0 replies; 5+ messages in thread
From: Wei Liu @ 2020-03-23 11:48 UTC (permalink / raw)
To: YOUNG, MICHAEL A.
Cc: xen-devel, Ian Jackson, Marek Marczykowski-Górecki, Wei Liu
On Tue, Mar 17, 2020 at 11:01:43PM +0000, YOUNG, MICHAEL A. wrote:
> pygrub in xen-4.13.0 with python 3.8.2 fails with the error
>
> Traceback (most recent call last):
> File "/usr/libexec/xen/bin/pygrub", line 21, in <module>
> import xen.lowlevel.xc
> SystemError: bad call flags
>
> This patch fixes mismatches in tools/python/xen/lowlevel/xc/xc.c
> between the flag bits defined in pyxc_methods and the parameters passed
> to the corresponding PyObject definitions.
>
> With this patch applied pygrub works as expected.
>
> Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
I briefly checked Python's documentation. This patch looks correctly to
me. FWIW:
Reviewed-by: Wei Liu <wl@xen.org>
I will wait for Marek's opinion.
Wei.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xen-devel] [XEN PATCH] mismatch between pyxc_methods flags and PyObject definitions
2020-03-17 23:01 [Xen-devel] [XEN PATCH] mismatch between pyxc_methods flags and PyObject definitions YOUNG, MICHAEL A.
2020-03-23 11:48 ` Wei Liu
@ 2020-03-24 2:32 ` Marek Marczykowski-Górecki
2020-03-28 11:19 ` Wei Liu
1 sibling, 1 reply; 5+ messages in thread
From: Marek Marczykowski-Górecki @ 2020-03-24 2:32 UTC (permalink / raw)
To: YOUNG, MICHAEL A.; +Cc: xen-devel, Ian Jackson, Wei Liu
[-- Attachment #1: Type: text/plain, Size: 4436 bytes --]
On Tue, Mar 17, 2020 at 11:01:43PM +0000, YOUNG, MICHAEL A. wrote:
> pygrub in xen-4.13.0 with python 3.8.2 fails with the error
>
> Traceback (most recent call last):
> File "/usr/libexec/xen/bin/pygrub", line 21, in <module>
> import xen.lowlevel.xc
> SystemError: bad call flags
>
> This patch fixes mismatches in tools/python/xen/lowlevel/xc/xc.c
> between the flag bits defined in pyxc_methods and the parameters passed
> to the corresponding PyObject definitions.
>
> With this patch applied pygrub works as expected.
>
> Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
This looks like a change in Python 3.7 (according to the documentation,
might not be enforced there yet). Python <= 3.6 allowed METH_KEYWORDS
used alone. Fortunately, all the versions supports METH_VARARGS |
METH_KEYWORDS, which looks to be equivalent to old METH_KEYWORDS alone.
Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> ---
> tools/python/xen/lowlevel/xc/xc.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
> index ac0e26a742..8fde5f311f 100644
> --- a/tools/python/xen/lowlevel/xc/xc.c
> +++ b/tools/python/xen/lowlevel/xc/xc.c
> @@ -2028,7 +2028,7 @@ static PyMethodDef pyxc_methods[] = {
>
> { "gnttab_hvm_seed",
> (PyCFunction)pyxc_gnttab_hvm_seed,
> - METH_KEYWORDS, "\n"
> + METH_VARARGS | METH_KEYWORDS, "\n"
> "Initialise HVM guest grant table.\n"
> " dom [int]: Identifier of domain to build into.\n"
> " console_gmfn [int]: \n"
> @@ -2097,7 +2097,7 @@ static PyMethodDef pyxc_methods[] = {
>
> { "sched_credit_domain_set",
> (PyCFunction)pyxc_sched_credit_domain_set,
> - METH_KEYWORDS, "\n"
> + METH_VARARGS | METH_KEYWORDS, "\n"
> "Set the scheduling parameters for a domain when running with the\n"
> "SMP credit scheduler.\n"
> " domid [int]: domain id to set\n"
> @@ -2115,7 +2115,7 @@ static PyMethodDef pyxc_methods[] = {
>
> { "sched_credit2_domain_set",
> (PyCFunction)pyxc_sched_credit2_domain_set,
> - METH_KEYWORDS, "\n"
> + METH_VARARGS | METH_KEYWORDS, "\n"
> "Set the scheduling parameters for a domain when running with the\n"
> "SMP credit2 scheduler.\n"
> " domid [int]: domain id to set\n"
> @@ -2393,21 +2393,21 @@ static PyMethodDef pyxc_methods[] = {
>
> { "flask_context_to_sid",
> (PyCFunction)pyflask_context_to_sid,
> - METH_KEYWORDS, "\n"
> + METH_VARARGS | METH_KEYWORDS, "\n"
> "Convert a context string to a dynamic SID.\n"
> " context [str]: String specifying context to be converted\n"
> "Returns: [int]: Numeric SID on success; -1 on error.\n" },
>
> { "flask_sid_to_context",
> (PyCFunction)pyflask_sid_to_context,
> - METH_KEYWORDS, "\n"
> + METH_VARARGS | METH_KEYWORDS, "\n"
> "Convert a dynamic SID to context string.\n"
> " context [int]: SID to be converted\n"
> "Returns: [str]: Numeric SID on success; -1 on error.\n" },
>
> { "flask_load",
> (PyCFunction)pyflask_load,
> - METH_KEYWORDS, "\n"
> + METH_VARARGS | METH_KEYWORDS, "\n"
> "Loads a policy into the hypervisor.\n"
> " policy [str]: policy to be load\n"
> "Returns: [int]: 0 on success; -1 on failure.\n" },
> @@ -2420,14 +2420,14 @@ static PyMethodDef pyxc_methods[] = {
>
> { "flask_setenforce",
> (PyCFunction)pyflask_setenforce,
> - METH_KEYWORDS, "\n"
> + METH_VARARGS | METH_KEYWORDS, "\n"
> "Modifies the current mode for the Flask XSM module.\n"
> " mode [int]: mode to change to\n"
> "Returns: [int]: 0 on success; -1 on failure.\n" },
>
> { "flask_access",
> (PyCFunction)pyflask_access,
> - METH_KEYWORDS, "\n"
> + METH_VARARGS | METH_KEYWORDS, "\n"
> "Returns whether a source context has access to target context based on \
> class and permissions requested.\n"
> " scon [str]: source context\n"
--
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xen-devel] [XEN PATCH] mismatch between pyxc_methods flags and PyObject definitions
2020-03-24 2:32 ` Marek Marczykowski-Górecki
@ 2020-03-28 11:19 ` Wei Liu
2020-03-30 14:05 ` Ian Jackson
0 siblings, 1 reply; 5+ messages in thread
From: Wei Liu @ 2020-03-28 11:19 UTC (permalink / raw)
To: Marek Marczykowski-Górecki
Cc: xen-devel, Ian Jackson, Wei Liu, YOUNG, MICHAEL A.
On Tue, Mar 24, 2020 at 03:32:26AM +0100, Marek Marczykowski-Górecki wrote:
> On Tue, Mar 17, 2020 at 11:01:43PM +0000, YOUNG, MICHAEL A. wrote:
> > pygrub in xen-4.13.0 with python 3.8.2 fails with the error
> >
> > Traceback (most recent call last):
> > File "/usr/libexec/xen/bin/pygrub", line 21, in <module>
> > import xen.lowlevel.xc
> > SystemError: bad call flags
> >
> > This patch fixes mismatches in tools/python/xen/lowlevel/xc/xc.c
> > between the flag bits defined in pyxc_methods and the parameters passed
> > to the corresponding PyObject definitions.
> >
> > With this patch applied pygrub works as expected.
> >
> > Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
>
> This looks like a change in Python 3.7 (according to the documentation,
> might not be enforced there yet). Python <= 3.6 allowed METH_KEYWORDS
> used alone. Fortunately, all the versions supports METH_VARARGS |
> METH_KEYWORDS, which looks to be equivalent to old METH_KEYWORDS alone.
>
> Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Thanks. I added "tools/python" to the subject line and committed this
patch.
Ian, this needs to be backported to at least 4.13 since we started
supported Python 3 in that version.
Backport: 4.13
Wei.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xen-devel] [XEN PATCH] mismatch between pyxc_methods flags and PyObject definitions
2020-03-28 11:19 ` Wei Liu
@ 2020-03-30 14:05 ` Ian Jackson
0 siblings, 0 replies; 5+ messages in thread
From: Ian Jackson @ 2020-03-30 14:05 UTC (permalink / raw)
To: Wei Liu; +Cc: xen-devel, Marek Marczykowski-Górecki, YOUNG, MICHAEL A.
Wei Liu writes ("Re: [XEN PATCH] mismatch between pyxc_methods flags and PyObject definitions"):
> Ian, this needs to be backported to at least 4.13 since we started
> supported Python 3 in that version.
>
> Backport: 4.13
Noted.
Ian.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-03-30 14:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-17 23:01 [Xen-devel] [XEN PATCH] mismatch between pyxc_methods flags and PyObject definitions YOUNG, MICHAEL A.
2020-03-23 11:48 ` Wei Liu
2020-03-24 2:32 ` Marek Marczykowski-Górecki
2020-03-28 11:19 ` Wei Liu
2020-03-30 14:05 ` Ian Jackson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.