Skip to content

Commit

Permalink
Py 3.13 support
Browse files Browse the repository at this point in the history
  • Loading branch information
jschueller committed Sep 3, 2024
1 parent 63260aa commit f7e9cb8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 32 additions & 0 deletions recipe/py313.patch
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);

0 comments on commit f7e9cb8

Please sign in to comment.