summaryrefslogtreecommitdiff
path: root/modules/language/python/string.scm
diff options
context:
space:
mode:
Diffstat (limited to 'modules/language/python/string.scm')
-rw-r--r--modules/language/python/string.scm10
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/language/python/string.scm b/modules/language/python/string.scm
index 11a9737..084d933 100644
--- a/modules/language/python/string.scm
+++ b/modules/language/python/string.scm
@@ -23,7 +23,15 @@
(define-syntax-rule (aif it p x y) (let ((it p)) (if it x y)))
-(define (scm-str x) (slot-ref (pystring x) 'str))
+(define (scm-str x)
+ (cond
+ ((string? x)
+ x)
+ ((is-a? x <py-string>)
+ (slot-ref (pystring x) 'str))
+ (else
+ #f)))
+
(define (scm-sym x)
(if (symbol? x)
x