gnuradio
gnuradio copied to clipboard
Windows builds don't accept large 32bit ints in `pmt.from_long`
What happened?
as found while writing a unit test, the windows CI fails with the following:
File "%SRC_DIR%\gr-blocks\python\blocks\qa_msg_pair_to_var.py", line 38, in test_calling
test_msg = pmt.cons(pmt.intern("foo"), pmt.from_long(canary))
^^^^^^^^^^^^^^^^^^^^^
TypeError: from_long(): incompatible function arguments. The following argument types are supported:
1. (x: int) -> pmt.pmt_python.pmt_base
Invoked with: 3736059631
uuuuuuuh, pretty sure 3736059631==0xdeadbeef is an integer value, and especially a valid python int
. sure, it's larger than 1<<31
, but why is this failing here… will have to dig up what the correct behaviour is and why we're failing it (and whether PMT is missing a kind of obvious test case).
System Information
OS: Windows Conda CI build GR Installation Method: cönda
GNU Radio Version
main
Specific Version
https://github.com/gnuradio/gnuradio/pull/6950/commits/20da7125373d4336a2024c8d868f2090c9d6c66c
(basically, main at 2dc4c433f023ff419b9c7db5d492d9dd87643122 )
Steps to Reproduce the Problem
run the CI when trying to canary = 0xdeadbeef; pmt.from_long(canary)
Relevant log output
test_msg = pmt.cons(pmt.intern("foo"), pmt.from_long(canary))
^^^^^^^^^^^^^^^^^^^^^
TypeError: from_long(): incompatible function arguments. The following argument types are supported:
1. (x: int) -> pmt.pmt_python.pmt_base
Invoked with: 3736059631
I bet it's pybind being smart about from_long
being the least sane API for integer conversion, but, who knows. @jsallay knows, maybe.
Off the top of my head, my guess is that it had to do with a long being 32 bits on Windows and 64 bits on 64 bit Linux.
My guess is that if you picked a smaller value that it would work just fine. If pybind has a range check, then I could see it failing.
On Sun, Nov 12, 2023, 6:33 PM Marcus Müller @.***> wrote:
I bet it's pybind being smart about from_long being the least sane API for integer conversion, but, who knows. @jsallay https://github.com/jsallay knows, maybe.
— Reply to this email directly, view it on GitHub https://github.com/gnuradio/gnuradio/issues/6951#issuecomment-1807281170, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHPWDXBHKOXF5W6YFO3GFPLYEFMEPAVCNFSM6AAAAAA7IK7QQKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBXGI4DCMJXGA . You are receiving this because you were mentioned.Message ID: @.***>