diff --git a/recipe/meta.yaml b/recipe/meta.yaml index aec0674..9a2ac1e 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -8,6 +8,8 @@ source: fn: nlopt-{{ version }}.tar.gz url: https://github.com/stevengj/nlopt/archive/v{{ version }}.tar.gz sha256: e02a4956a69d323775d79fdaec7ba7a23ed912c7d45e439bc933d991ea3193fd + patches: + - py313.patch build: number: 1 diff --git a/recipe/py313.patch b/recipe/py313.patch new file mode 100644 index 0000000..c835608 --- /dev/null +++ b/recipe/py313.patch @@ -0,0 +1,32 @@ +From d716820578d226976fbb4fa68478758dad1c79b0 Mon Sep 17 00:00:00 2001 +From: Julien Schueller +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); +