Port to Python 3.
[catacomb-python] / pgen.c
diff --git a/pgen.c b/pgen.c
index 777ec32..3c2a792 100644 (file)
--- a/pgen.c
+++ b/pgen.c
@@ -125,8 +125,10 @@ static PyObject *pfilt_pyint(PyObject *me)
   return (rc);
 }
 
+#ifdef PY2
 static PyObject *pfilt_pylong(PyObject *me)
   { return (mp_topylong(PFILT_F(me)->m)); }
+#endif
 
 static PyObject *pfget_x(PyObject *me, void *hunoz)
   { return (mp_pywrap(MP_COPY(PFILT_F(me)->m))); }
@@ -156,7 +158,9 @@ static const PyNumberMethods pfilt_pynumber = {
   0,                                   /* @nb_add@ */
   0,                                   /* @nb_subtract@ */
   0,                                   /* @nb_multiply@ */
+#ifdef PY2
   0,                                   /* @nb_divide@ */
+#endif
   0,                                   /* @nb_remainder@ */
   0,                                   /* @nb_divmod@ */
   0,                                   /* @nb_power@ */
@@ -170,17 +174,23 @@ static const PyNumberMethods pfilt_pynumber = {
   0,                                   /* @nb_and@ */
   0,                                   /* @nb_xor@ */
   0,                                   /* @nb_or@ */
+#ifdef PY2
   0,                                   /* @nb_coerce@ */
+#endif
   pfilt_pyint,                         /* @nb_int@ */
-  pfilt_pylong,                                /* @nb_long@ */
+  PY23(pfilt_pylong, 0),               /* @nb_long@ */
   0,                                   /* @nb_float@ */
+#ifdef PY2
   0,                                   /* @nb_oct@ */
   0,                                   /* @nb_hex@ */
+#endif
 
   0,                                   /* @nb_inplace_add@ */
   0,                                   /* @nb_inplace_subtract@ */
   0,                                   /* @nb_inplace_multiply@ */
+#ifdef PY2
   0,                                   /* @nb_inplace_divide@ */
+#endif
   0,                                   /* @nb_inplace_remainder@ */
   0,                                   /* @nb_inplace_power@ */
   0,                                   /* @nb_inplace_lshift@ */