Skip to content

Commit 24fa537

Browse files
authored
refs qoretechnologies/qore#4373 added code to store the Python module name in all namespaces created while importing python modules; allowing for consistent binary paths in the Java module for imported code and also allowing for required Python modules to be implicitly imported from Java as well based on the binary name (#58)
1 parent 1ded1f8 commit 24fa537

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ project(qore-python-module)
33

44
set (VERSION_MAJOR 1)
55
set (VERSION_MINOR 1)
6-
set (VERSION_PATCH 0)
6+
set (VERSION_PATCH 1)
77

88
set(PROJECT_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
99

docs/mainpage.dox.tmpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,11 @@ PythonProgram::setSaveObjectCallback(callback);
500500
501501
@section pythonreleasenotes python Module Release Notes
502502
503+
@subsection python_1_1_1 python Module Version 1.1.1
504+
- mark %Qore namespaces imported from %Python modules so that other languages like Java can use consistent paths
505+
with %Python symbols
506+
(<a href="https://github.com/qorelanguage/qore/issues/4373">issue 4373</a>)
507+
503508
@subsection python_1_1 python Module Version 1.1
504509
- added support for Python 3.10
505510
(<a href="https://github.com/qorelanguage/qore/issues/4334">issue 4334</a>)

qore-python-module.spec

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
%global user_module_dir %{mydatarootdir}/qore-modules/
66

77
Name: qore-python-module
8-
Version: 1.1.0
8+
Version: 1.1.1
99
Release: 1
1010
Summary: Qorus Integration Engine - Qore Python module
1111
License: MIT
@@ -55,6 +55,9 @@ make DESTDIR=%{buildroot} install %{?_smp_mflags}
5555
%{module_dir}
5656

5757
%changelog
58+
* Fri Oct 31 2021 David Nichols <david@qore.org>
59+
- updated to version 1.1.1
60+
5861
* Wed Oct 27 2021 David Nichols <david@qore.org>
5962
- updated to version 1.1.0
6063

src/QorePythonProgram.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2120,7 +2120,15 @@ QoreNamespace* QorePythonProgram::getNamespaceForObject(PyObject* obj) {
21202120

21212121
//printd(5, "QorePythonProgram::getNamespaceForObject() obj %p (%s) -> ns: Python::%s\n", obj,
21222122
// Py_TYPE(obj)->tp_name, ns_path.c_str());
2123-
return pyns->findCreateNamespacePathAll(ns_path.c_str());
2123+
QoreNamespace* ns = pyns->findCreateNamespacePathAll(ns_path.c_str());
2124+
#if QORE_VERSION_CODE >= 10013
2125+
if (module_context) {
2126+
if (ns->setKeyValueIfNotSet("python_module", module_context)) {
2127+
printd(5, "set python_module: '%s' in ns: '%s'\n", module_context, ns->getPath(true).c_str());
2128+
}
2129+
}
2130+
#endif
2131+
return ns;
21242132
}
21252133

21262134
QoreClass* QorePythonProgram::getCreateQorePythonClassIntern(ExceptionSink* xsink, PyTypeObject* type,

0 commit comments

Comments
 (0)