Skip to content

Issue dereferencing JVM primitives / objects from codegen namespaces #163

@enragedginger

Description

@enragedginger

I'm using the cv2 library. I ran the codegen on it, and swapped out my require-python usage of the library with a standard Clojure :require. An error is thrown when deref-ing constants from the generated namespace. Codegen creates this:
(def ^{:doc ""} COLOR_BGR2GRAY (as-jvm/generic-pyobject (py-global-delay (py/get-attr @src-obj* "COLOR_BGR2GRAY"))))

(py/get-attr @src-obj* "COLOR_BGR2GRAY") returns a java.lang.Long

When I try to use COLOR_BGR2GRAY, this error is thrown:

Error printing return value at tech.v3.datatype.ffi.ptr-value/unchecked-ptr-value (ptr_value.clj:17).
Item 6 is not convertible to a C pointer

I can reproduce this error with this:
(as-jvm/generic-pyobject (py-global-delay 6))

You can also replace 6 with some other JVM value (i.e. true or {:thing 1}) and reproduce the error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions