You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pylucene-commits@lucene.apache.org by va...@apache.org on 2019/10/17 18:10:44 UTC
svn commit: r1868563 - in /lucene/pylucene/trunk/jcc/jcc3/sources:
JArray.cpp functions.cpp
Author: vajda
Date: Thu Oct 17 18:10:43 2019
New Revision: 1868563
URL: http://svn.apache.org/viewvc?rev=1868563&view=rev
Log:
Added __module__ to JArray() types.
Modified:
lucene/pylucene/trunk/jcc/jcc3/sources/JArray.cpp
lucene/pylucene/trunk/jcc/jcc3/sources/functions.cpp
Modified: lucene/pylucene/trunk/jcc/jcc3/sources/JArray.cpp
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc3/sources/JArray.cpp?rev=1868563&r1=1868562&r2=1868563&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc3/sources/JArray.cpp (original)
+++ lucene/pylucene/trunk/jcc/jcc3/sources/JArray.cpp Thu Oct 17 18:10:43 2019
@@ -612,9 +612,19 @@ public:
type_object = (PyTypeObject *) PyType_FromSpec(&spec);
- if (type_object != NULL)
+ 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);
+ Py_DECREF(module_name);
+ }
+ }
+
_t_iterator<U>::JArrayIterator = type_object;
}
};
@@ -685,6 +695,15 @@ public:
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);
+ Py_DECREF(module_name);
+ }
}
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=1868563&r1=1868562&r2=1868563&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc3/sources/functions.cpp (original)
+++ lucene/pylucene/trunk/jcc/jcc3/sources/functions.cpp Thu Oct 17 18:10:43 2019
@@ -1740,8 +1740,8 @@ void installType(PyTypeObject **type, Py
if (module_name != NULL)
{
- PyObject_SetAttrString(
- (PyObject *) *type, "__module__", module_name);
+ PyObject_SetAttrString((PyObject *) *type, "__module__",
+ module_name);
Py_DECREF(module_name);
}
}