Skip to content

Commit

Permalink
[fix][change] pymodule-import-string
Browse files Browse the repository at this point in the history
  • Loading branch information
digikar99 committed May 30, 2024
1 parent 76c9a1a commit f69e4d2
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/import-export.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,20 @@ Arguments:

(declaim (ftype (function (string string)) pymodule-import-string))
(defun pymodule-import-string (pymodule-name lisp-package)
"Returns two values:
- The first value is the import form
- The second value is the name of the package in python itself"
(let ((package-in-python (pycall "str" (%pythonize (intern lisp-package)))))
(values
(cond (*is-submodule* nil)
(*lisp-package-supplied-p*
`(import-module ,pymodule-name
:as ,package-in-python))
(t `(import-module ,pymodule-name)))
package-in-python)))
(cond (*is-submodule*
(values nil pymodule-name))
(*lisp-package-supplied-p*
(values
`(import-module ,pymodule-name :as ,package-in-python)
package-in-python))
(t
(values
`(import-module ,pymodule-name)
package-in-python)))))

(defun function-reload-string (&key pymodule-name lisp-package fun-name as)
(if *called-from-defpymodule*
Expand Down

0 comments on commit f69e4d2

Please sign in to comment.