clj-python / libpython-clj

Python bindings for Clojure
Eclipse Public License 2.0
1.05k stars 68 forks source link

ISSUE-167: py. macro breaks in go and go-loop #167

Closed jjtolton closed 3 years ago

jjtolton commented 3 years ago

Currently, the py. macro (and therefore the py.. macro) will break in go and go-loops.

(ns libpython-clj.sidecar
  (:require [libpython-clj2.require :refer [require-python import-python] :reload true]
            [libpython-clj2.python :as py :refer [py.] :reload true]
            [libpython-clj2.metadata :as metadata :reload true]
            [clojure.core.async :as a :refer [go go-loop]]))

(import-python)
(require-python '[os.path :as os-path :bind-ns ] )

(go (println (os-path/split "/hello"))) ;; works
(go (println (py. os-path "split" "/hello"))) ;; works 
(go (println (py/py. os-path split "/hello"))) ;; breaks

(for [path ["/hello"]
      :let [path (py. os-path split "/hello")]]
  path) ;; works

Using a string for the method name works.