gnucash stable: Multiple changes pushed
John Ralls
jralls at code.gnucash.org
Thu Mar 30 21:22:39 EDT 2023
Updated via https://github.com/Gnucash/gnucash/commit/d7d9240e (commit)
via https://github.com/Gnucash/gnucash/commit/8b25832b (commit)
via https://github.com/Gnucash/gnucash/commit/cfc0890d (commit)
via https://github.com/Gnucash/gnucash/commit/735a6113 (commit)
from https://github.com/Gnucash/gnucash/commit/0d598d51 (commit)
commit d7d9240e3d73f6bb7d6c297a5577ecf73f4f020d
Merge: 0d598d51ed 8b25832ba0
Author: John Ralls <jralls at ceridwen.us>
Date: Thu Mar 30 18:22:09 2023 -0700
Merge Richard Cohen's 'fix-python-311-build' of github.com:richardcohen/gnucash into stable
commit 8b25832ba086c6e18627c5fc04e3f09b71970f11
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Wed Mar 29 11:21:10 2023 +0100
PySys_SetArgv is deprecated in 3.11
The initialization API was updated in 3.8.
"This API is kept for backward compatibility:
setting PyConfig.argv and PyConfig.parse_argv should be used instead,
see Python Initialization Configuration."
diff --git a/gnucash/python/gncmod-python.c b/gnucash/python/gncmod-python.c
index 9b92ec48f7..d2bd8a5183 100644
--- a/gnucash/python/gncmod-python.c
+++ b/gnucash/python/gncmod-python.c
@@ -57,6 +57,11 @@ libgncmod_python_gnc_module_description(void)
return g_strdup("An embedded Python interpreter");
}
+#if PY_VERSION_HEX >= 0x030b0000
+// PySys_SetArgv is deprecated in 3.11
+#pragma GCC diagnostic warning "-Wdeprecated-declarations"
+#endif
+
int
libgncmod_python_gnc_module_init(int refcount)
{
commit cfc0890d5dbf73074ab790d6a4929aeb8f055ad0
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Wed Mar 29 11:09:36 2023 +0100
Move variables close to use
diff --git a/gnucash/python/gncmod-python.c b/gnucash/python/gncmod-python.c
index 4f7824ff1f..9b92ec48f7 100644
--- a/gnucash/python/gncmod-python.c
+++ b/gnucash/python/gncmod-python.c
@@ -60,17 +60,15 @@ libgncmod_python_gnc_module_description(void)
int
libgncmod_python_gnc_module_init(int refcount)
{
- FILE *fp;
- gchar *pkgdatadir, *init_filename;
- wchar_t* argv = NULL;
-
Py_Initialize();
+
+ wchar_t* argv = NULL;
PySys_SetArgv(0, &argv);
- pkgdatadir = gnc_path_get_pkgdatadir();
- init_filename = g_build_filename(pkgdatadir, "python/init.py", (char*)NULL);
- g_debug("Looking for python init script at %s", (init_filename ? init_filename : "<null>"));
- fp = fopen(init_filename, "r");
+ gchar *pkgdatadir = gnc_path_get_pkgdatadir();
+ gchar *init_filename = g_build_filename(pkgdatadir, "python/init.py", (char*)NULL);
+ g_debug("Looking for python init script at %s", init_filename);
+ FILE *fp = fopen(init_filename, "r");
if (fp)
{
PyRun_SimpleFile(fp, init_filename);
commit 735a61136147defa71ce0d599a186c524912d2c5
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Wed Mar 29 11:01:00 2023 +0100
Remove commented out code in gncmod-python.c
diff --git a/gnucash/python/gncmod-python.c b/gnucash/python/gncmod-python.c
index f287693274..4f7824ff1f 100644
--- a/gnucash/python/gncmod-python.c
+++ b/gnucash/python/gncmod-python.c
@@ -57,39 +57,15 @@ libgncmod_python_gnc_module_description(void)
return g_strdup("An embedded Python interpreter");
}
-//extern PyObject* PyInit__sw_app_utils(void);
-//extern PyObject* PyInit__sw_core_utils(void);
-
int
libgncmod_python_gnc_module_init(int refcount)
{
- /* There isn't yet a python module to init.
- PyObject *pName, *pModule;
- */
FILE *fp;
gchar *pkgdatadir, *init_filename;
wchar_t* argv = NULL;
Py_Initialize();
PySys_SetArgv(0, &argv);
- // I don't quite understand why these are loaded here
- // - these are python modules so should be able to just import them
- // in init.py
- //PyInit__sw_app_utils();
- //PyInit__sw_core_utils();
-
- /* There isn't yet a python module to init.
- pName = PyString_FromString("path/to/init.py");
- pModule = PyImport_Import(pName);
-
- if (!pModule) {
- PyErr_Print();
- return FALSE;
- }
-
- Py_DECREF(pName);
- Py_DECREF(pModule);
- */
pkgdatadir = gnc_path_get_pkgdatadir();
init_filename = g_build_filename(pkgdatadir, "python/init.py", (char*)NULL);
Summary of changes:
gnucash/python/gncmod-python.c | 41 ++++++++++-------------------------------
1 file changed, 10 insertions(+), 31 deletions(-)
More information about the gnucash-changes
mailing list