From 6ece9162059e2c63e04dfc82e6953cc348893e49 Mon Sep 17 00:00:00 2001 From: Eric Chen Date: Tue, 30 Nov 2021 15:15:01 -0800 Subject: [PATCH 1/2] Fixes ion-hash too much annotation issue. --- amazon/ion/ioncmodule.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/amazon/ion/ioncmodule.c b/amazon/ion/ioncmodule.c index 0a57cdca8..dcc5dc49d 100644 --- a/amazon/ion/ioncmodule.c +++ b/amazon/ion/ioncmodule.c @@ -16,6 +16,8 @@ #define ERR_MSG_MAX_LEN 100 #define FIELD_NAME_MAX_LEN 1000 +#define ANNOTATION_MAX_LEN 50 + static char _err_msg[ERR_MSG_MAX_LEN]; @@ -924,6 +926,7 @@ static PyObject* ionc_write(PyObject *self, PyObject *args, PyObject *kwds) { ION_WRITER_OPTIONS options; memset(&options, 0, sizeof(options)); options.output_as_binary = PyObject_IsTrue(binary); + options.max_annotation_count = ANNOTATION_MAX_LEN; IONCHECK(ion_writer_open(&writer, ion_stream, &options)); if (sequence_as_stream == Py_True && (PyList_Check(obj) || PyTuple_Check(obj))) { @@ -1495,6 +1498,7 @@ PyObject* ionc_read(PyObject* self, PyObject *args, PyObject *kwds) { ION_READER_OPTIONS options; memset(&options, 0, sizeof(options)); options.decimal_context = &dec_context; + options.max_annotation_count = ANNOTATION_MAX_LEN; IONCHECK(ion_reader_open_buffer(&reader, (BYTE*)buffer, (SIZE)size, &options)); // NULL represents default reader options top_level_container = PyList_New(0); From 8e507dce177b8ee1df00dfef8a2c6337ca9167c5 Mon Sep 17 00:00:00 2001 From: Eric Chen Date: Tue, 30 Nov 2021 15:16:45 -0800 Subject: [PATCH 2/2] style --- amazon/ion/ioncmodule.c | 1 - 1 file changed, 1 deletion(-) diff --git a/amazon/ion/ioncmodule.c b/amazon/ion/ioncmodule.c index dcc5dc49d..f2cbc05ee 100644 --- a/amazon/ion/ioncmodule.c +++ b/amazon/ion/ioncmodule.c @@ -18,7 +18,6 @@ #define FIELD_NAME_MAX_LEN 1000 #define ANNOTATION_MAX_LEN 50 - static char _err_msg[ERR_MSG_MAX_LEN]; #define _FAILWITHMSG(x, msg) { err = x; snprintf(_err_msg, ERR_MSG_MAX_LEN, msg); goto fail; }