Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ccpp_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: "3.13.2"
python-version: "3.14"

- name: Install Inno-setup
run: choco install InnoSetup
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- macOS Tahoe 26: CI setup and platform support.

- Python 3.14 support.

### Changed

- `jsondecode`: Significantly improved performance by integrating [simdjson](https://simdjson.org/), enabling faster and more efficient JSON parsing.
Expand Down
2 changes: 1 addition & 1 deletion modules/python_engine/src/cpp/PythonFileRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ PythonFileRunner::runFile(const std::wstring& filename, const wstringVector& arg
PyGILState_STATE gstate = NLSPyGILState_Ensure();

PyObject* obj = NLSPy_BuildValue("s", wstring_to_utf8(filename).c_str());
FILE* file = NLS_Py_fopen_obj(obj, "r");
FILE* file = NLS_Py_fopen(obj, "r");
NLSPy_DECREF(obj);
if (file == NULL) {
errorMessage = _W("Impossible to open file: ") + filename;
Expand Down
17 changes: 13 additions & 4 deletions modules/python_engine/src/cpp/PythonLibraryWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ PyObject* _Py_NoneStructPtr = nullptr;
//=============================================================================
static bool pythonLibraryLoaded = false;
static Nelson::library_handle python3XX_handle = nullptr;
static std::string NLSPy_fopen_obj_symbol_name = "_Py_fopen_obj";
//=============================================================================
static bool
loadPythonSymbols();
Expand Down Expand Up @@ -108,7 +109,7 @@ using PROC_PyList_SetItem = int (*)(PyObject* ob1, Py_ssize_t sz, PyObject* ob2)
using PROC_PyUnicode_DecodeFSDefault = PyObject* (*)(const char* s);
using PROC_PyRun_SimpleFileExFlags
= int (*)(FILE* fp, const char* filename, int closeit, PyCompilerFlags* flags);
using PROC_Py_fopen_obj = FILE* (*)(PyObject* path, const char* mode);
using PROC_Py_fopen = FILE* (*)(PyObject* path, const char* mode);
Comment thread
Nelson-numerical-software marked this conversation as resolved.
using PROC_PyDict_Copy = PyObject* (*)(PyObject* mp);
using PROC_PyDict_Clear = void (*)(PyObject* mp);
using PROC_PyDict_Update = int (*)(PyObject* mp, PyObject* other);
Expand Down Expand Up @@ -245,7 +246,15 @@ loadPythonSymbols()
LOAD_PYTHON_SYMBOL(PyList_SetItem);
LOAD_PYTHON_SYMBOL(PyUnicode_DecodeFSDefault);
LOAD_PYTHON_SYMBOL(PyRun_SimpleFileExFlags);
LOAD_PYTHON_SYMBOL(_Py_fopen_obj);
//=============================================================================
// Python 3.14 and later: _Py_fopen
Comment thread
Nelson-numerical-software marked this conversation as resolved.
pythonSymbols[NLSPy_fopen_obj_symbol_name] = reinterpret_cast<void*>(
Nelson::get_function(python3XX_handle, NLSPy_fopen_obj_symbol_name));
if (!pythonSymbols[NLSPy_fopen_obj_symbol_name]) {
NLSPy_fopen_obj_symbol_name = "Py_fopen";
LOAD_PYTHON_SYMBOL(Py_fopen);
Comment thread
Nelson-numerical-software marked this conversation as resolved.
}
Comment thread
Nelson-numerical-software marked this conversation as resolved.
//=============================================================================
LOAD_PYTHON_SYMBOL(PyDict_Copy);
LOAD_PYTHON_SYMBOL(PyDict_Clear);
LOAD_PYTHON_SYMBOL(PyDict_Update);
Expand Down Expand Up @@ -788,9 +797,9 @@ NLSPyRun_SimpleFileExFlags(FILE* fp, const char* filename, int closeit, PyCompil
}
//=============================================================================
FILE*
NLS_Py_fopen_obj(PyObject* path, const char* mode)
NLS_Py_fopen(PyObject* path, const char* mode)
{
return reinterpret_cast<PROC_Py_fopen_obj>(pythonSymbols["_Py_fopen_obj"])(path, mode);
return reinterpret_cast<PROC_Py_fopen>(pythonSymbols[NLSPy_fopen_obj_symbol_name])(path, mode);
}
//=============================================================================
PyObject*
Expand Down
2 changes: 1 addition & 1 deletion modules/python_engine/src/cpp/PythonLibraryWrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ int
NLSPyRun_SimpleFileExFlags(FILE* fp, const char* filename, int closeit, PyCompilerFlags* flags);
//=============================================================================
FILE*
NLS_Py_fopen_obj(PyObject* path, const char* mode);
NLS_Py_fopen(PyObject* path, const char* mode);
Comment thread
Nelson-numerical-software marked this conversation as resolved.
//=============================================================================
PyObject*
NLSPyDict_Copy(PyObject* mp);
Expand Down