Any GstMessageType above GST_MESSAGE_EXTENDED not usable with python3 on windows

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Any GstMessageType above GST_MESSAGE_EXTENDED not usable with python3 on windows

filnet
Hi,

The following python3 code:

    import gi
    gi.require_version("Gst", "1.0")
    from gi.repository import Gst
    print(Gst.MessageType.get_name(Gst.MessageType.DEVICE_ADDED))

fails on windows 32 and 64 with this error:

    OverflowError: Python int too large to convert to C long

    The above exception was the direct cause of the following exception:

    Traceback (most recent call last):
      File "bug.py", line 4, in <module>
        print(Gst.MessageType.get_name(Gst.MessageType.DEVICE_ADDED))
    SystemError: gi.FunctionInfo(get_name) returned a result with an error set

The same is true for any GstMessageType above or equal to GST_MESSAGE_EXTENDED.

My understanding of the issue is that, something, somewhere, is trying to map the Gst enum/flag to a C long.
On Windows, according to [1], a long is a signed 32 bit integer (range is –2147483648 through 2147483647).
But GST_MESSAGE_EXTENDED (and above enums) are too big to fit a Windows C long.
GST_MESSAGE_EXTENDED = (1 << 31) = 2147483648 > 2147483647.

I found a somewhat similar issue : https://bugzilla.gnome.org/show_bug.cgi?id=732633
But this issue is related to signed vs unsigned (and is fixed in 1.12.2).

Is that issue fixable ? If yes, where should I look : pyobject, gobject-introspection, ... ?

This issue appears with GStreamer 1.12.2, gobject-introspection 1.52.1 and pygobject 3.24.1 (which are all relatively recent) on a MSYS2 system.

Cheers,
Philippe.

[1] https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx

PS : gstmessage.h has this comment : /* FIXME: 2.0: Make it NOT flags, just a regular 1,2,3,4.. enumeration */
Would be great to do ;) but would break ABI I guess ...

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Any GstMessageType above GST_MESSAGE_EXTENDED not usable with python3 on windows

Sebastian Dröge-3
On Sat, 2017-08-26 at 21:18 +0000, philippe renon wrote:

> Hi,
>
> The following python3 code:
>
>     import gi
>     gi.require_version("Gst", "1.0")
>     from gi.repository import Gst
>     print(Gst.MessageType.get_name(Gst.MessageType.DEVICE_ADDED)) 
>
> fails on windows 32 and 64 with this error:
>
>     OverflowError: Python int too large to convert to C long
>
>     The above exception was the direct cause of the following
> exception:
>
>     Traceback (most recent call last):
>       File "bug.py", line 4, in <module>
>         print(Gst.MessageType.get_name(Gst.MessageType.DEVICE_ADDED))
>     SystemError: gi.FunctionInfo(get_name) returned a result with an
> error set
>
> The same is true for any GstMessageType above or equal to
> GST_MESSAGE_EXTENDED.
>
> My understanding of the issue is that, something, somewhere, is
> trying to map the Gst enum/flag to a C long.
> On Windows, according to [1], a long is a signed 32 bit integer
> (range is –2147483648 through 2147483647).
> But GST_MESSAGE_EXTENDED (and above enums) are too big to fit a
> Windows C long.
> GST_MESSAGE_EXTENDED = (1 << 31) = 2147483648 > 2147483647.
>
> I found a somewhat similar issue : https://bugzilla.gnome.org/show_bu
> g.cgi?id=732633
> But this issue is related to signed vs unsigned (and is fixed in
> 1.12.2).
>
> Is that issue fixable ? If yes, where should I look : pyobject,
> gobject-introspection, ... ?
Please file a bug about this. It's probably not fixable without changes
in the Python bindings (by using an unsigned int here instead of a
signed one) or ABI changes on the GStreamer side.

--
Sebastian Dröge, Centricular Ltd · https://www.centricular.com

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (981 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Any GstMessageType above GST_MESSAGE_EXTENDED not usable with python3 on windows

filnet
Hi,

Will file a bug when it is possible. I currently get a 500 when hitting the "Submit Bug" button.

In the meantime, I have been researching the code.

The OverflowError emanates from PyLong_AsLong(PyObject *obj) method (https://github.com/python/cpython/blob/3.6/Objects/longobject.c#L471)

But I am having a hard time finding the call path that leads to this method being called...

I should be able to build all components involved (gstreamer, gst-python, gobject-instrospection, pyobject) from source so I can try things out given some pointers or guidance.

Philippe.


Le Lundi 28 août 2017 11h34, Sebastian Dröge <[hidden email]> a écrit :


On Sat, 2017-08-26 at 21:18 +0000, philippe renon wrote:

> Hi,
>
> The following python3 code:
>
>     import gi
>     gi.require_version("Gst", "1.0")
>     from gi.repository import Gst
>     print(Gst.MessageType.get_name(Gst.MessageType.DEVICE_ADDED)) 
>
> fails on windows 32 and 64 with this error:
>
>     OverflowError: Python int too large to convert to C long
>
>     The above exception was the direct cause of the following
> exception:
>
>     Traceback (most recent call last):
>       File "bug.py", line 4, in <module>
>         print(Gst.MessageType.get_name(Gst.MessageType.DEVICE_ADDED))
>     SystemError: gi.FunctionInfo(get_name) returned a result with an
> error set
>
> The same is true for any GstMessageType above or equal to
> GST_MESSAGE_EXTENDED.
>
> My understanding of the issue is that, something, somewhere, is
> trying to map the Gst enum/flag to a C long.
> On Windows, according to [1], a long is a signed 32 bit integer
> (range is –2147483648 through 2147483647).
> But GST_MESSAGE_EXTENDED (and above enums) are too big to fit a
> Windows C long.
> GST_MESSAGE_EXTENDED = (1 << 31) = 2147483648 > 2147483647.
>
> I found a somewhat similar issue : https://bugzilla.gnome.org/show_bu
> g.cgi?id=732633
> But this issue is related to signed vs unsigned (and is fixed in
> 1.12.2).
>
> Is that issue fixable ? If yes, where should I look : pyobject,
> gobject-introspection, ... ?

Please file a bug about this. It's probably not fixable without changes
in the Python bindings (by using an unsigned int here instead of a
signed one) or ABI changes on the GStreamer side.

--
Sebastian Dröge, Centricular Ltd · https://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel




_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Any GstMessageType above GST_MESSAGE_EXTENDED not usable with python3 on windows

filnet
Bug filed: Bug 786948 – GstMessageType above GST_MESSAGE_EXTENDED not usable with python3 on windows






Le Lundi 28 août 2017 14h45, philippe renon <[hidden email]> a écrit :


Hi,

Will file a bug when it is possible. I currently get a 500 when hitting the "Submit Bug" button.

In the meantime, I have been researching the code.

The OverflowError emanates from PyLong_AsLong(PyObject *obj) method (https://github.com/python/cpython/blob/3.6/Objects/longobject.c#L471)

But I am having a hard time finding the call path that leads to this method being called...

I should be able to build all components involved (gstreamer, gst-python, gobject-instrospection, pyobject) from source so I can try things out given some pointers or guidance.

Philippe.


Le Lundi 28 août 2017 11h34, Sebastian Dröge <[hidden email]> a écrit :


On Sat, 2017-08-26 at 21:18 +0000, philippe renon wrote:

> Hi,
>
> The following python3 code:
>
>     import gi
>     gi.require_version("Gst", "1.0")
>     from gi.repository import Gst
>     print(Gst.MessageType.get_name(Gst.MessageType.DEVICE_ADDED)) 
>
> fails on windows 32 and 64 with this error:
>
>     OverflowError: Python int too large to convert to C long
>
>     The above exception was the direct cause of the following
> exception:
>
>     Traceback (most recent call last):
>       File "bug.py", line 4, in <module>
>         print(Gst.MessageType.get_name(Gst.MessageType.DEVICE_ADDED))
>     SystemError: gi.FunctionInfo(get_name) returned a result with an
> error set
>
> The same is true for any GstMessageType above or equal to
> GST_MESSAGE_EXTENDED.
>
> My understanding of the issue is that, something, somewhere, is
> trying to map the Gst enum/flag to a C long.
> On Windows, according to [1], a long is a signed 32 bit integer
> (range is –2147483648 through 2147483647).
> But GST_MESSAGE_EXTENDED (and above enums) are too big to fit a
> Windows C long.
> GST_MESSAGE_EXTENDED = (1 << 31) = 2147483648 > 2147483647.
>
> I found a somewhat similar issue : https://bugzilla.gnome.org/show_bu
> g.cgi?id=732633
> But this issue is related to signed vs unsigned (and is fixed in
> 1.12.2).
>
> Is that issue fixable ? If yes, where should I look : pyobject,
> gobject-introspection, ... ?

Please file a bug about this. It's probably not fixable without changes
in the Python bindings (by using an unsigned int here instead of a
signed one) or ABI changes on the GStreamer side.

--
Sebastian Dröge, Centricular Ltd · https://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel






_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel