Skip to content

Commit 572b770

Browse files
committed
fix for Python 3.5
pragma away some warnings
1 parent d7fada9 commit 572b770

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

c/cbormodule.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,11 @@ PyObject* inner_loads_c(Reader* rin, uint8_t c) {
453453
PyErr_Format(PyExc_RuntimeError, "unknown cbor marker %02x", c);
454454
return NULL;
455455
}
456+
#pragma GCC diagnostic push
457+
#pragma GCC diagnostic ignored "-Wunreachable-code"
456458
PyErr_SetString(PyExc_RuntimeError, "cbor library internal error moof!");
457459
return NULL;
460+
#pragma GCC diagnostic pop
458461
}
459462

460463
static int loads_kv(PyObject* out, Reader* rin) {
@@ -531,8 +534,11 @@ static PyObject* loads_tag(Reader* rin, uint64_t aux) {
531534
PyErr_Format(PyExc_ValueError, "TAG BIGNUM not followed by bytes but %02x", sc);
532535
return NULL;
533536
}
537+
#pragma GCC diagnostic push
538+
#pragma GCC diagnostic ignored "-Wunreachable-code"
534539
PyErr_Format(PyExc_ValueError, "TODO: WRITEME CBOR TAG BIGNUM %02x ...\n", sc);
535540
return NULL;
541+
#pragma GCC diagnostic pop
536542
} else if (aux == CBOR_TAG_NEGBIGNUM) {
537543
// If the next object is bytes, interpret it here without making a PyObject for it.
538544
uint8_t sc;
@@ -550,8 +556,11 @@ static PyObject* loads_tag(Reader* rin, uint64_t aux) {
550556
PyErr_Format(PyExc_ValueError, "TAG NEGBIGNUM not followed by bytes but %02x", sc);
551557
return NULL;
552558
}
559+
#pragma GCC diagnostic push
560+
#pragma GCC diagnostic ignored "-Wunreachable-code"
553561
PyErr_Format(PyExc_ValueError, "TODO: WRITEME CBOR TAG NEGBIGNUM %02x ...\n", sc);
554562
return NULL;
563+
#pragma GCC diagnostic pop
555564
}
556565
out = inner_loads(rin);
557566
if (out == NULL) { return NULL; }
@@ -1468,7 +1477,11 @@ PyInit__cbor(void)
14681477
modef.m_doc = NULL;
14691478
modef.m_size = 0;
14701479
modef.m_methods = CborMethods;
1471-
modef.m_reload = NULL;
1480+
#ifdef Py_mod_exec
1481+
modef.m_slots = NULL; // Py >= 3.5
1482+
#else
1483+
modef.m_reload = NULL; // Py < 3.5
1484+
#endif
14721485
modef.m_traverse = NULL;
14731486
modef.m_clear = NULL;
14741487
modef.m_free = NULL;

cbor/VERSION.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
'0.1.24'
1+
'0.1.25'

0 commit comments

Comments
 (0)