-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
63260aa
commit f7e9cb8
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
From d716820578d226976fbb4fa68478758dad1c79b0 Mon Sep 17 00:00:00 2001 | ||
From: Julien Schueller <schueller@phimeca.com> | ||
Date: Thu, 15 Aug 2024 21:18:49 +0200 | ||
Subject: [PATCH] Python: Replace deprecated PyEval_CallObject | ||
|
||
Closes #565 | ||
--- | ||
src/swig/nlopt-python.i | 4 ++-- | ||
1 file changed, 2 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/src/swig/nlopt-python.i b/src/swig/nlopt-python.i | ||
index 41531faa..b5cf55e1 100644 | ||
--- a/src/swig/nlopt-python.i | ||
+++ b/src/swig/nlopt-python.i | ||
@@ -151,7 +151,7 @@ static double func_python(unsigned n, const double *x, double *grad, void *f) | ||
: PyArray_SimpleNew(1, &sz0, NPY_DOUBLE); | ||
|
||
PyObject *arglist = Py_BuildValue("OO", xpy, gradpy); | ||
- PyObject *result = PyEval_CallObject((PyObject *) f, arglist); | ||
+ PyObject *result = PyObject_Call((PyObject *) f, arglist, NULL); | ||
Py_DECREF(arglist); | ||
|
||
Py_DECREF(gradpy); | ||
@@ -192,7 +192,7 @@ static void mfunc_python(unsigned m, double *result, | ||
: PyArray_SimpleNew(1, &sz0, NPY_DOUBLE); | ||
|
||
PyObject *arglist = Py_BuildValue("OOO", rpy, xpy, gradpy); | ||
- PyObject *res = PyEval_CallObject((PyObject *) f, arglist); | ||
+ PyObject *res = PyObject_Call((PyObject *) f, arglist, NULL); | ||
Py_XDECREF(res); | ||
Py_DECREF(arglist); | ||
|