Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes C extension can't write/read too much annotations issue. #179

Merged
merged 2 commits into from
Dec 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions amazon/ion/ioncmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#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];

Expand Down Expand Up @@ -924,6 +925,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))) {
Expand Down Expand Up @@ -1495,6 +1497,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);
Expand Down