*.c: Make all of the type-definition tables read-only.
[catacomb-python] / bytestring.c
index eef8ed1..2468ea2 100644 (file)
@@ -265,7 +265,7 @@ BINOP(xor, ^)
   }
 UNOP(not, ~)
 
-static PyNumberMethods bytestring_pynumber = {
+static const PyNumberMethods bytestring_pynumber = {
   0,                                   /* @nb_add@ */
   0,                                   /* @nb_subtract@ */
   0,                                   /* @nb_multiply@ */
@@ -291,7 +291,7 @@ static PyNumberMethods bytestring_pynumber = {
   0,                                   /* @nb_hex@ */
 };
 
-static PySequenceMethods bytestring_pysequence = {
+static const PySequenceMethods bytestring_pysequence = {
   0,                                   /* @sq_length@ */
   bytestring_pyconcat,                 /* @sq_concat@ */
   bytestring_pyrepeat,                 /* @sq_repeat@ */
@@ -304,7 +304,7 @@ static PySequenceMethods bytestring_pysequence = {
   0,                                   /* @sq_inplace_repeat@ */
 };
 
-static PyMappingMethods bytestring_pymapping = {
+static const PyMappingMethods bytestring_pymapping = {
   0,                                   /* @mp_length@ */
   bytestring_pysubscript,              /* @mp_subscript@ */
   0,                                   /* @mp_ass_subscript@ */
@@ -322,9 +322,9 @@ static PyTypeObject bytestring_pytype_skel = {
   0,                                   /* @tp_setattr@ */
   0,                                   /* @tp_compare@ */
   0,                                   /* @tp_repr@ */
-  &bytestring_pynumber,                        /* @tp_as_number@ */
-  &bytestring_pysequence,              /* @tp_as_sequence@ */
-  &bytestring_pymapping,               /* @tp_as_mapping@ */
+  PYNUMBER(bytestring),                        /* @tp_as_number@ */
+  PYSEQUENCE(bytestring),              /* @tp_as_sequence@ */
+  PYMAPPING(bytestring),               /* @tp_as_mapping@ */
   0,                                   /* @tp_hash@ */
   0,                                   /* @tp_call@ */
   0,                                   /* @tp_str@ */
@@ -361,7 +361,7 @@ static PyTypeObject bytestring_pytype_skel = {
 
 /*----- Initialization ----------------------------------------------------*/
 
-static PyMethodDef methods[] = {
+static const PyMethodDef methods[] = {
 #define METHNAME(func) meth_##func
   METH (ctstreq,       "ctstreq(S, T) -> BOOL")
   METH (_ByteString_zero, "zero(N) -> 0000...00")