Commits

Lenard Lindstrom committed c707b82

Fix for Python 3.2 and 3.3

Comments (0)

Files changed (1)

     return 0;
 }
 
-#if Py_MAJOR_VERSION_HEX < 3
+#if PY_MAJOR_VERSION < 3
 #define INT_CHECK(o) (PyInt_Check(o) || PyLong_Check(o))
 #define INT_AS_PY_SSIZE_T(o) (PyInt_AsSsize_t(o))
 #else
 };
 
 static int
-buffer_nonzero(BufferObject *self)
+buffer_bool(BufferObject *self)
 {
     return self->view_p != NULL;
 }
     (binaryfunc)0,                              /* nb_add */
     (binaryfunc)0,                              /* nb_subtract */
     (binaryfunc)0,                              /* nb_multiply */
+#if PY_MAJOR_VERSION < 3
     (binaryfunc)0,                              /* nb_divide */
+#endif
     (binaryfunc)0,                              /* nb_remainder */
     (binaryfunc)0,                              /* nb_divmod */
     (ternaryfunc)0,                             /* nb_power */
     (unaryfunc)0,                               /* nb_negative */
     (unaryfunc)0,                               /* nb_positive */
     (unaryfunc)0,                               /* nb_absolute */
-    (inquiry)buffer_nonzero,                    /* nb_nonzero */
+    (inquiry)buffer_bool,                       /* nb_nonzero / nb_bool */
     (unaryfunc)0,                               /* nb_invert */
     (binaryfunc)0,                              /* nb_lshift */
     (binaryfunc)0,                              /* nb_rshift */
     (binaryfunc)0,                              /* nb_and */
     (binaryfunc)0,                              /* nb_xor */
     (binaryfunc)0,                              /* nb_or */
-#if Py_MAJOR_VERSION < 3
+#if PY_MAJOR_VERSION < 3
     (coercion)0,                                /* nb_coerce */
 #endif
     (unaryfunc)0,                               /* nb_int */
-#if Py_MAJOR_VERSION < 3
+#if PY_MAJOR_VERSION < 3
     (unaryfunc)0,                               /* nb_long */
 #else
     0,                                          /* nb_reserved */
 #endif
     (unaryfunc)0,                               /* nb_float */
+#if PY_MAJOR_VERSION < 3
     (unaryfunc)0,                               /* nb_oct */
     (unaryfunc)0,                               /* nb_hex */
+#endif
     (binaryfunc)0,                              /* nb_inplace_add */
     (binaryfunc)0,                              /* nb_inplace_subtract */
     (binaryfunc)0,                              /* nb_inplace_multiply */
+#if PY_MAJOR_VERSION < 3
     (binaryfunc)0,                              /* nb_inplace_divide */
+#endif
     (binaryfunc)0,                              /* nb_inplace_remainder */
     (ternaryfunc)0,                             /* nb_inplace_power */
     (binaryfunc)0,                              /* nb_inplace_lshift */
     (binaryfunc)0,                              /* nb_true_divide */
     (binaryfunc)0,                              /* nb_inplace_floor_divide */
     (binaryfunc)0,                              /* nb_inplace_true_divide */
-#if Py_VERSION_HEX >= 0x02050000
+#if PY_VERSION_HEX >= 0x02050000
     (unaryfunc)0,                               /* nb_index */
 #endif
 };
     0                           /* tp_del */
 };
 
-/*DOC*/ static char bufferproxy_doc[] =
-/*DOC*/    "exports BufferProxy, a generic wrapper object for an py_buffer";
+/*DOC*/ static char newbuffer_doc[] =
+/*DOC*/    "exports BufferMixin, add a new buffer interface to a class";
 
 MODINIT_DEFINE(newbuffer)
 {
     static struct PyModuleDef _module = {
         PyModuleDef_HEAD_INIT,
         "newbuffer",
-        "Just a stub right now",
+        newbuffer_doc,
         -1,
         NULL, NULL, NULL, NULL, NULL
     };
 #if PY3
     module = PyModule_Create(&_module);
 #else
-    module = Py_InitModule3("newbuffer", 0, bufferproxy_doc);
+    module = Py_InitModule3("newbuffer", 0, newbuffer_doc);
 #endif
 
     Py_INCREF(&BufferMixin_Type);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.