Repository navigation
Closed
Description
Some ics constant are not correct exposed in the Python layer.
The following code is currently failing.
import ics
assert ics.SPY_STATUS2_ETHERNET_T1S_ETHERNET == 0x80000000
assert ics.SPY_STATUS2_LIN_NO_SLAVE_DATA == 0x80000000
assert ics.SPY_STATUS2_MOST_CHANGED_PAR == 0x80000000
assert ics.SPY_STATUS_EXTENDED == 0x80000000
assert ics.ETHERNET_SETTINGS10G_FLAG_COMM_IN_USE == 0x80000000Header file in source
python_ics/include/ics/cicsSpyStatusBits.h
Line 131 in 42e2fcd
| #define SPY_STATUS2_ETHERNET_T1S_ETHERNET 0x80000000 |
python_ics/include/ics/cicsSpyStatusBits.h
Line 167 in 42e2fcd
| #define SPY_STATUS2_LIN_NO_SLAVE_DATA 0x80000000 // LIN no slave data |
python_ics/include/ics/cicsSpyStatusBits.h
Line 194 in 42e2fcd
| #define SPY_STATUS2_MOST_CHANGED_PAR 0x80000000 // first byte in ack reflects what changed. |
| #define SPY_STATUS_EXTENDED 0x80000000 // Extended - if this bit is set than decode StatusBitField3 in AckBytes |
python_ics/include/ics/icsnVC40.h
Line 1334 in 42e2fcd
| #define ETHERNET_SETTINGS10G_FLAG_COMM_IN_USE 0x80000000 |
Potential source of the issue
In my opinion this line is the source of this issue:
python_ics/extract_icsneo40_defines.py
Line 160 in 42e2fcd
| print("\tresult += PyModule_AddIntMacro(module, %s);" % sline[1], file=f) |
This line could potentially change to
print('\tresult += PyModule_AddObjectRef(module, "{0}", PyLong_FromLongLong({0}));'.format(sline[1]), file=f)Metadata
Metadata
Assignees
Labels
No labels
Activity
pierreluctg commentedon Sep 23, 2025
FYI @drebbe-intrepid
drebbe-intrepid commentedon Sep 23, 2025
@pierreluctg Thanks for the report, I'll take a look at this soon. Looks like the latest release on PyPI doesn't have this issue so its something related to the new header inclusion.
pierreluctg commentedon Sep 23, 2025
The issue is present in 920.14.2 (the latest on PyPi) at least on Windows Python 3.12 (
python_ics-920.14.2-cp312-cp312-win_amd64.whl)pierreluctg commentedon Sep 23, 2025
Looks like the issue could be limited to Windows.
Issue is not reproducible using 920.14.2 on macOS. I have not tried on Linux.
drebbe-intrepid commentedon Sep 23, 2025
linux doesn't have the issue, this looks to be a windows only issue.
drebbe-intrepid commentedon Sep 23, 2025
I believe your prosed fix is the correct way. I'll investigate and provide an update soon.
Fix Wrong constant values #219
drebbe-intrepid commentedon Sep 24, 2025
@pierreluctg This should be fixed now, I'm just waiting for the builds to pass and do one final check since I'm updating the build system.
I added pytest moving forward so we shouldn't regress on things like this:
https://github.com/intrepidcs/python_ics/pull/220/files#diff-5ac325061663b1ccc52c165576955977a49145210ab74ee7b44fc9e887dd8700
update to v921 header (#220)
drebbe-intrepid commentedon Sep 26, 2025
@pierreluctg looks to be working in latest now. Will be uploaded to PyPI in a couple hours.
pierreluctg commentedon Sep 26, 2025
Thank you @drebbe-intrepid