Skip to content

Commit

Permalink
Allow enc_style to have values other than 0 and 1
Browse files Browse the repository at this point in the history
  • Loading branch information
vamega committed Nov 15, 2023
1 parent 9fa5397 commit c64e03e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions source/encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,17 @@ CBOREncoder_init(CBOREncoderObject *self, PyObject *args, PyObject *kwargs)
int value_sharing = 0, timestamp_format = 0, enc_style = 0,
date_as_datetime = 0, string_referencing = 0;

if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|pOpOppp", keywords,
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|pOpOBpp", keywords,
&fp, &timestamp_format, &tz, &value_sharing,
&default_handler, &enc_style, &date_as_datetime,
&default_handler, &self->enc_style, &date_as_datetime,
&string_referencing))
return -1;
// Predicate values are returned as ints, but need to be stored as bool or ubyte
if (timestamp_format == 1)
self->timestamp_format = true;
if (value_sharing == 1)
self->value_sharing = true;
if (enc_style == 1)
self->enc_style = 1;

if (string_referencing == 1) {
self->string_referencing = true;
self->string_namespacing = true;
Expand Down

0 comments on commit c64e03e

Please sign in to comment.