<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello,<br>
<br>
Using PyQt 5.4.1 and python 3.4.3 on an amd64 Ubuntu 15,04, I have
run into a bug in <a
href="http://bazaar.launchpad.net/%7Edlynch3/rapid/zeromq_pyqt/view/head:/rapid/rapid.py#L125">my
code</a> where an int value being sent out in a signal is being
erroneously received as a negative value when it is greater than the
<a
href="http://stackoverflow.com/questions/13795758/what-is-sys-maxint-in-python-3">maximum
int value in C/C++</a> on the same platform.<br>
<br>
For instance, the max int value in C/C++ on my machine is
2147483647. When my python code emits a signal with an int value
less than that, it's received fine. More than that, and the received
value is wrong, e.g. emit 2153451441 and it is received as
-2141515855.<br>
<br>
Needless to say when writing my code I had never considered the
possibility of this bug because in python 3 there is no maximum
integer size.<br>
<br>
What is the most pythonic, elegant and efficient way to work around
this problem? Off the top of my head I could convert the int to
bytes, and convert it back again once received, but perhaps there is
a better way to emit the signal? The <a
href="http://pyqt.sourceforge.net/Docs/PyQt5/signals_slots.html">docs</a>
say 'If an argument doesn’t have a corresponding C++ type then it is
wrapped in a special C++ type that allows it to be passed around
Qt’s meta-type system while ensuring that its reference count is
properly maintained.' Should I instead simply bundle the signal's
values into a Python class and emit that?<br>
<br>
Thanks!<br>
Damon <br>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.damonlynch.net">http://www.damonlynch.net</a>
</pre>
</body>
</html>