Author: vajda Date: Sun Nov 3 23:09:07 2019 New Revision: 1869345 URL: http://svn.apache.org/viewvc?rev=1869345&view=rev Log: added support for Python 3.8
Modified: lucene/pylucene/trunk/jcc/CHANGES lucene/pylucene/trunk/jcc/jcc3/sources/JArray.cpp lucene/pylucene/trunk/jcc/jcc3/sources/functions.cpp lucene/pylucene/trunk/jcc/setup.py Modified: lucene/pylucene/trunk/jcc/CHANGES URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/CHANGES?rev=1869345&r1=1869344&r2=1869345&view=diff ============================================================================== --- lucene/pylucene/trunk/jcc/CHANGES (original) +++ lucene/pylucene/trunk/jcc/CHANGES Sun Nov 3 23:09:07 2019 @@ -2,6 +2,7 @@ Version 3.6 -> ------------------ - fixed bug with wrongly assuming 1BYTE_KIND python strings to be utf-8 - added setting of type.__module__ for all generated wrapper types (python 3) + - added support for Python 3.8 - Version 3.5 -> 3.6 Modified: lucene/pylucene/trunk/jcc/jcc3/sources/JArray.cpp URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc3/sources/JArray.cpp?rev=1869345&r1=1869344&r2=1869345&view=diff ============================================================================== --- lucene/pylucene/trunk/jcc/jcc3/sources/JArray.cpp (original) +++ lucene/pylucene/trunk/jcc/jcc3/sources/JArray.cpp Sun Nov 3 23:09:07 2019 @@ -58,7 +58,7 @@ public: { Py_XDECREF(self->obj); #if PY_VERSION_HEX >= 0x03080000 - PyObject *type = Py_TYPE(self); + PyObject *type = (PyObject *) Py_TYPE(self); #endif self->ob_base.ob_type->tp_free((PyObject *) self); @@ -133,7 +133,7 @@ static void dealloc(U *self) { self->array = JArray<T>((jobject) NULL); #if PY_VERSION_HEX >= 0x03080000 - PyObject *type = Py_TYPE(self); + PyObject *type = (PyObject *) Py_TYPE(self); #endif self->ob_base.ob_type->tp_free((PyObject *) self); @@ -613,16 +613,16 @@ public: type_object = (PyTypeObject *) PyType_FromSpec(&spec); if (type_object != NULL) { - PyModule_AddObject(module, name, (PyObject *) type_object); - PyObject *module_name = PyModule_GetNameObject(module); if (module_name != NULL) { - PyObject_SetAttrString((PyObject *) type_object, - "__module__", module_name); + PyDict_SetItemString(type_object->tp_dict, + "__module__", module_name); Py_DECREF(module_name); } + + PyModule_AddObject(module, name, (PyObject *) type_object); } _t_iterator<U>::JArrayIterator = type_object; @@ -694,16 +694,16 @@ public: PyDict_SetItemString(type_object->tp_dict, "wrapfn_", make_descriptor(wrapfn_<T>)); - PyModule_AddObject(module, name, (PyObject *) type_object); - PyObject *module_name = PyModule_GetNameObject(module); if (module_name != NULL) { - PyObject_SetAttrString((PyObject *) type_object, - "__module__", module_name); + PyDict_SetItemString(type_object->tp_dict, + "__module__", module_name); Py_DECREF(module_name); } + + PyModule_AddObject(module, name, (PyObject *) type_object); } U::format = PyUnicode_FromFormat("JArray<%s>%%s", type_name); Modified: lucene/pylucene/trunk/jcc/jcc3/sources/functions.cpp URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc3/sources/functions.cpp?rev=1869345&r1=1869344&r2=1869345&view=diff ============================================================================== --- lucene/pylucene/trunk/jcc/jcc3/sources/functions.cpp (original) +++ lucene/pylucene/trunk/jcc/jcc3/sources/functions.cpp Sun Nov 3 23:09:07 2019 @@ -1734,16 +1734,15 @@ void installType(PyTypeObject **type, Py Py_INCREF(PY_TYPE(FinalizerClass)); } - PyModule_AddObject(module, name, (PyObject *) *type); - PyObject *module_name = PyModule_GetNameObject(module); if (module_name != NULL) { - PyObject_SetAttrString((PyObject *) *type, "__module__", - module_name); + PyDict_SetItemString((*type)->tp_dict, "__module__", module_name); Py_DECREF(module_name); } + + PyModule_AddObject(module, name, (PyObject *) *type); } } Modified: lucene/pylucene/trunk/jcc/setup.py URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/setup.py?rev=1869345&r1=1869344&r2=1869345&view=diff ============================================================================== --- lucene/pylucene/trunk/jcc/setup.py (original) +++ lucene/pylucene/trunk/jcc/setup.py Sun Nov 3 23:09:07 2019 @@ -364,8 +364,9 @@ def main(debug): '-current_version', jcc_ver, '-compatibility_version', jcc_ver] elif platform == 'linux': - kwds["extra_link_args"] = \ - lflags + ['-lpython%s.%s%s' %( + kwds["extra_link_args"] = lflags + if sys.version_info < (3, 8): + kwds["extra_link_args"] += ['-lpython%s.%s%s' %( sys.version_info[0:2] + ('' if using_python2 else 'm',))] kwds["force_shared"] = True # requires jcc/patches/patch.43 elif platform in IMPLIB_LFLAGS: