Skip to content

Commit

Permalink
Issue #207
Browse files Browse the repository at this point in the history
Python 3.10
  • Loading branch information
dsalantic committed Jul 20, 2022
1 parent cd4dd8b commit 1cd32bb
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 10 deletions.
5 changes: 4 additions & 1 deletion HISTORY
Original file line number Diff line number Diff line change
Expand Up @@ -255,4 +255,7 @@ Issue #182 convert timestamp to double, improves precision
Issue #183 Potential Heap-based Buffer Overflow

2.8.3 (python_v0.7.3)
Issue #202 Segmentation fault in python when explicit item is wrong
Issue #202 Segmentation fault in python when explicit item is wrong

2.8.4 (python_v0.7.4)
Issue #207 Timestamp not created correctly
2 changes: 1 addition & 1 deletion asterix/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.7.3'
__version__ = '0.7.4'
2 changes: 1 addition & 1 deletion src/asterix/DataItemFormatExplicit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ PyObject* DataItemFormatExplicit::getObject(unsigned char* pData, long nLength,

if (nLength <= 1) {
char errorText[256];
snprintf(errorText, 255, "Not enough data in Explicit. There is %d byte.", nLength);
snprintf(errorText, 255, "Not enough data in Explicit. There is %ld byte.", nLength);
return Py_BuildValue("s", errorText);
}

Expand Down
2 changes: 1 addition & 1 deletion src/asterix/DataRecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ PyObject* DataRecord::getData(int verbose)
Py_DECREF(v3);

PyObject* k4 = Py_BuildValue("s", "ts");
PyObject* v4 = Py_BuildValue("l", m_nTimestamp);
PyObject* v4 = Py_BuildValue("d", m_nTimestamp);
PyDict_SetItem(p, k4, v4);
Py_DECREF(k4);
Py_DECREF(v4);
Expand Down
4 changes: 2 additions & 2 deletions src/main/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#ifndef VERSION_H
#define VERSION_H

#define _VERSION 2.8.3
#define _VERSION_STR "2.8.3"
#define _VERSION 2.8.4
#define _VERSION_STR "2.8.4"

#endif
1 change: 1 addition & 0 deletions src/python/asterix.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*
*/

#define PY_SSIZE_T_CLEAN
#include <Python.h>

#if PY_MAJOR_VERSION >= 3
Expand Down
4 changes: 2 additions & 2 deletions src/python/python_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ int python_init(const char *xml_config_file) {
return 0;
}

PyObject *python_parse(const unsigned char *pBuf, unsigned int len, int verbose) {
PyObject *python_parse(const unsigned char *pBuf, Py_ssize_t len, int verbose) {
// get current timstamp in ms since epoch
struct timeval tp;
gettimeofday(&tp, NULL);
Expand All @@ -97,7 +97,7 @@ PyObject *python_parse(const unsigned char *pBuf, unsigned int len, int verbose)
}

PyObject *
python_parse_with_offset(const unsigned char *pBuf, unsigned int len, unsigned int offset, unsigned int blocks_count,
python_parse_with_offset(const unsigned char *pBuf, Py_ssize_t len, unsigned int offset, unsigned int blocks_count,
int verbose)
/* AUTHOR: Krzysztof Rutkowski, ICM UW, krutk@icm.edu.pl
*/
Expand Down
4 changes: 2 additions & 2 deletions src/python/python_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ extern "C" {
int python_start(const char *ini_file_path);
int python_init(const char *ini_file_path);
PyObject *python_describe(int category, const char *item, const char *field, const char *value);
PyObject *python_parse(const unsigned char *pBuf, unsigned int len, int verbose);
PyObject *python_parse(const unsigned char *pBuf, Py_ssize_t len, int verbose);
PyObject *
python_parse_with_offset(const unsigned char *pBuf, unsigned int len, unsigned int offset, unsigned int blocks_count,
python_parse_with_offset(const unsigned char *pBuf, Py_ssize_t len, unsigned int offset, unsigned int blocks_count,
int verbose);
void asterix_start(const char *ini_filename, const char *filename);

Expand Down

0 comments on commit 1cd32bb

Please sign in to comment.