Skip to content

Commit 03fab5f

Browse files
committed
Support for Python3.9 - cfunction_new -> cfunction_newex
1 parent a85be74 commit 03fab5f

3 files changed

Lines changed: 10 additions & 8 deletions

File tree

src/libpython_clj/jna.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@
292292
METH_O
293293
METH_STATIC
294294
METH_VARARGS
295-
PyCFunction_New
295+
PyCFunction_NewEx
296296
PyInstanceMethod_New)
297297

298298

src/libpython_clj/jna/concrete/cfunction.clj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@
5151
;; #endif
5252

5353

54-
(def-pylib-fn PyCFunction_New
54+
(def-pylib-fn PyCFunction_NewEx
5555
"Create a new callable from an item."
5656
Pointer
5757
[method-def (partial jna/ensure-type PyMethodDef)]
58-
[self as-pyobj])
58+
[self as-pyobj]
59+
[module as-pyobj])
5960

6061

6162
(def-pylib-fn PyInstanceMethod_New

src/libpython_clj/python/object.clj

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -444,11 +444,12 @@ Object's refcount is bad. Crash is imminent"
444444
;;This is a nice little tidbit, cfunction_new
445445
;;steals the reference.
446446
(let [py-self (when py-self (incref (->python py-self)))]
447-
(-> (libpy/PyCFunction_New (method-def-data->method-def
448-
{:name method-name
449-
:doc documentation
450-
:function cfunc})
451-
py-self)
447+
(-> (libpy/PyCFunction_NewEx (method-def-data->method-def
448+
{:name method-name
449+
:doc documentation
450+
:function cfunc})
451+
py-self
452+
nil)
452453
(wrap-pyobject)))))
453454

454455

0 commit comments

Comments
 (0)