CroatiaControlLtd / asterix

Asterix is utility used to read and parse EUROCONTROL ASTERIX protocol data from stdin, file or network multicast stream and print it to standard output in text, XML or JSON format. Source can be used to generate Wireshark dissector for ASTERIX protocol. All ASTERIX categories are defined through XML definition file.
GNU General Public License v2.0
166 stars 89 forks source link

PY_SSIZE_T_CLEAN macro must be defined #205

Closed dsalantic closed 2 years ago

dsalantic commented 2 years ago

This error occurs in Python 3.10. Library must be updated to support python 3.10.

aquananu commented 2 years ago

Hi appreciate that you have written this lib

Please advise if the same has been ported to py 3.10, also is there any other known py 3.10 compatibility issue, i might look at the code to get this error fixed

aquananu commented 2 years ago

Py_ssize_t added to following files but still error is there after executing setup

./python_parser.cpp:82:PyObject python_parse(const unsigned char pBuf, (Py_ssize_t)len, int verbose) { ./python_parser.cpp:100:python_parse_with_offset(const unsigned char pBuf, (Py_ssize_t)len, unsigned int offset, unsigned int blocks_count, ./python_wrapper.c:78: Py_ssize_t TupleSize = PyTuple_Size(args); ./python_wrapper.c:108: Py_ssize_t len; ./python_wrapper.c:135: Py_ssize_t len; ./python_parser.h:36:PyObject python_parse(const unsigned char pBuf, (Py_ssize_t)len, int verbose); ./python_parser.h:38:python_parse_with_offset(const unsigned char pBuf, (Py_ssize_t)len, unsigned int offset, unsigned int blocks_count,

also had one warning

./src/asterix/DataItemFormatExplicit.cpp: In member function ‘virtual PyObject DataItemFormatExplicit::getObject(unsigned char, long int, int)’: ./src/asterix/DataItemFormatExplicit.cpp:220:74: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Wformat=]

220 snprintf(errorText, 255, "Not enough data in Explicit. There is %d byte.", nLength); ~^ ~~~
int long int
%ld

added below line to asterix.c before include python.h

define PY_SSIZE_T_CLEAN

asterix_nk_modified.zip

Please see if i have missed something

dsalantic commented 2 years ago

It should be fixed in latest release.