Mercurial > pytave
changeset 113:6552040d6d4c
pytave.cc: Second attempt to make return type Python 2 or 3 compatible
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Sun, 20 Sep 2015 02:41:36 +0200 |
parents | ca8bdbe49a94 |
children | f6fec9453ac9 |
files | pytave.cc |
diffstat | 1 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/pytave.cc Sun Sep 20 02:40:53 2015 +0200 +++ b/pytave.cc Sun Sep 20 02:41:36 2015 +0200 @@ -61,7 +61,12 @@ locale_t c_locale; #endif - PyMODINIT_FUNC init(bool silent = true) { +#if defined (PYTHON_ABI_VERSION) + PyObject* +#else + void +#endif + init(bool silent = true) { #ifdef HAVE_USELOCALE c_locale = newlocale(LC_ALL, "C", 0); #endif @@ -72,7 +77,11 @@ || !octave_parse_exception::init() || !variable_name_exception::init ()) { PyErr_SetString(PyExc_ImportError, "_pytave: init failed"); - return NULL; +#if defined (PYTHON_ABI_VERSION) + return 0; +#else + return; +#endif } // Initialize Octave.