clj-python / clj-python/libpython-clj
as-jvm failed for a returned list
未關閉
還沒有人認領這個 Issue。
- 主要語言
- Clojure
- 星號
- 1.2k
- 分支
- 74
- PR 合併指標
- 30 天內沒有已合併 PR
描述
Hi,
I experienced an issue while I was using libpython-clj to encode the returned list as json via cheshire, it threw an exception with this snippet:
(println "Just something interesting from Python:"
(-> (py/py. simple a_list)
py/as-list
json/generate-string))
The exception:
Execution error (ClassCastException) at cheshire.generate/generate$fn (generate.clj:135).
class java.lang.String cannot be cast to class java.util.Map$Entry (java.lang.String and java.util.Map$Entry are in module java.base of loader 'bootstrap')
And it worked fine for a map.
I've created a demo repo for this: https://github.com/whatacold/libpython-clj-as-jvm-issue, hopefully I've put all necessary info there.
Was there something I was missing? Thanks.
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先使用 libpython-clj、py/as-list 和 Cheshire 的 json/generate-string,根據回報的 snippet 重現問題,然後將傳回的列表與正常運作的 map 案例進行比較。Issue 中連結的示範儲存庫包含額外的重現情境。完成的標準是找出列表為何以錯誤的形式傳到 Cheshire,並確認傳回的列表可以編碼為 JSON,而不會發生回報的 ClassCastException。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- clojure, python
- 領域
- backend
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100