Skip to content

Commit 29ba5fc

Browse files
committed
Unreleased but updated version to support graal native static compilation.
1 parent 6ee8934 commit 29ba5fc

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Time for a ChangeLog!
22

3+
## 2.00-beta-13
4+
* Update to dtype-next to support graal native static ffi and library generation.
5+
* Update to dtype-next to have correct definitions of ptr-t, offset-t, and size-t types.
6+
37
## 2.00-beta-12
48
* Small refinements around embedding and documentation.
59

deps.edn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{:paths ["src"]
22
:deps {org.clojure/clojure {:mvn/version "1.10.2" :scope "provided"}
33
camel-snake-kebab/camel-snake-kebab {:mvn/version "0.4.0"}
4-
cnuernber/dtype-next {:mvn/version "6.12"}
4+
cnuernber/dtype-next {:mvn/version "6.23"}
55
net.java.dev.jna/jna {:mvn/version "5.7.0"}
66
org.clojure/data.json {:mvn/version "1.0.0"}}
77

src/libpython_clj2/python/ffi.clj

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ Required for some python modules"}
8080
:PyGILState_Ensure {:rettype :int32
8181
:requires-gil? false
8282
:doc "Ensure this thread owns the python GIL.
83+
8384
Each call must be matched with PyGILState_Release"}
8485
:PyGILState_Check {:rettype :int32
8586
:requires-gil? false
@@ -291,7 +292,17 @@ Each call must be matched with PyGILState_Release"}
291292
})
292293

293294

294-
(def python-lib-def* (delay (dt-ffi/define-library python-library-fns)))
295+
(def python-lib-def* (delay (dt-ffi/define-library
296+
python-library-fns
297+
["_Py_NoneStruct"
298+
"_Py_FalseStruct"
299+
"_Py_TrueStruct"
300+
"PyType_Type"
301+
"PyExc_StopIteration"
302+
"PyRange_Type"
303+
"PyExc_Exception"]
304+
nil
305+
)))
295306
(defonce pyobject-struct-type*
296307
(delay (dt-struct/define-datatype!
297308
:pyobject [{:name :ob_refcnt :datatype (ffi-size-t/size-t-type)}
@@ -439,7 +450,7 @@ Each call must be matched with PyGILState_Release"}
439450

440451
(defn- deref-ptr-ptr
441452
^Pointer [^Pointer val]
442-
(Pointer. (case (ffi-size-t/size-t-type)
453+
(Pointer. (case (ffi-size-t/offset-t-type)
443454
:int32 (.getInt (native-buffer/unsafe) (.address val))
444455
:int64 (.getLong (native-buffer/unsafe) (.address val)))))
445456

@@ -721,8 +732,8 @@ Each call must be matched with PyGILState_Release"}
721732
(defn pystr->str
722733
^String [pyobj]
723734
;;manually allocate/deallocate for speed; this gets called a lot
724-
(let [size-obj (dt-ffi/make-ptr (ffi-size-t/size-t-type) 0 {:resource-type nil
725-
:uninitialized? true})
735+
(let [size-obj (dt-ffi/make-ptr :pointer 0 {:resource-type nil
736+
:uninitialized? true})
726737
^Pointer str-ptr (PyUnicode_AsUTF8AndSize pyobj size-obj)
727738
nbuf (native-buffer/wrap-address (.address str-ptr)
728739
(size-obj 0)

0 commit comments

Comments
 (0)