relative imports debugged and yield with no arguments fixed

parent 068b21ca
......@@ -517,9 +517,9 @@ empty list."
((#:import (#:from (("." . nn) . nm) l))
;; Make sure to load the module in
(let* ((u (module-name (current-module)))
(let* ((u (get-current-module))
(u (reverse (list-cdr-ref (reverse (u-it u)) (length nn))))
(xl (append u (map (lambda (nm) (exp vs nm)) nm)))
(xl (append u (map (lambda (nm) (exp vs nm)) (cdr nm))))
(s.ss (find-symbols xl l)))
(for-each dont-warn (car s.ss))
(if p
......@@ -621,9 +621,9 @@ empty list."
((#:import (#:from (("." . nn) . nm) l))
;; Make sure to load the module in
(let* ((u (module-name (current-module)))
(let* ((u (get-current-module))
(u (reverse (list-cdr-ref (reverse (u-it u)) (length nn))))
(xl (append u (map (lambda (nm) (exp vs nm)) nm))))
(xl (append u (map (lambda (nm) (exp vs (cdr nm))) nm))))
(let ((s.ss (find-symbols xl l)))
(for-each dont-warn (car s.ss))
......@@ -1114,10 +1114,8 @@ empty list."
(fluid-set! *doc* x)))))
(define (u-it m)
(if (and (eq? (list-ref m 0) 'language)
(eq? (list-ref m 1) 'python)
(eq? (list-ref m 0) 'module))
(cddr m)
(if (>= (length m) 1)
(reverse (cdr (reverse m)))
'()))
(define (tr-comp op x y)
......@@ -1487,9 +1485,9 @@ empty list."
`(,(C 'use) ,? ,l ,l))))
((_ (#:from (("." . nn) . nm) . #f))
(let* ((u (module-name (current-module)))
(let* ((u (get-current-module))
(u (reverse (list-cdr-ref (reverse (u-it u)) (length nn))))
(xl (append u (map (lambda (nm) (exp vs nm)) nm)))
(xl (append u (map (lambda (nm) (exp vs (cdr nm))) nm)))
(l `(language python module ,@xl)))
;; Make sure to load the module in
......@@ -1501,9 +1499,9 @@ empty list."
((_ (#:from ("." . nn) . #f))
(let* ((nm '())
(u (module-name (current-module)))
(u (get-current-module))
(u (reverse (list-cdr-ref (reverse (u-it u)) (length nn))))
(xl (append u (map (lambda (nm) (exp vs nm)) nm)))
(xl (append u (map (lambda (nm) (exp vs nm)) (cdr nm))))
(l `(language python module ,@xl)))
;; Make sure to load the module in
......@@ -1521,18 +1519,18 @@ empty list."
((_ (#:from (("." . nn) . nm) l))
;; Make sure to load the module in
(let* ((u (module-name (current-module)))
(let* ((u (get-current-module))
(u (reverse (list-cdr-ref (reverse (u-it u)) (length nn))))
(xl (append u (map (lambda (nm) (exp vs nm)) nm)))
(xl (append u (map (lambda (nm) (exp vs nm)) (cdr nm))))
(ll `(language python module ,@xl)))
`(,(C '@@values) ,l ,ll ,xl)))
((_ (#:from ("." . nn) l))
;; Make sure to load the module in
(let* ((nm '())
(u (module-name (current-module)))
(u (get-current-module))
(u (reverse (list-cdr-ref (reverse (u-it u)) (length nn))))
(xl (append u (map (lambda (nm) (exp vs nm)) nm)))
(xl (append u (map (lambda (nm) (exp vs nm)) (cdr nm))))
(ll `(language python module ,@xl)))
`(,(C 'use) #t ()
......@@ -1564,7 +1562,7 @@ empty list."
(lambda (dots ids as)
`(,(G 'begin)
,@(map (lambda (dots ids as)
(let* ((u (module-name (current-module)))
(let* ((u (get-current-module))
(u (if (null? dots)
'()
(reverse (list-cdr-ref
......@@ -1572,7 +1570,9 @@ empty list."
(- (length dots) 1)))))
(path (append (if (null? dots) '() u)
(map (g vs exp) ids))))
(map (g vs exp) (if (null? dots)
ids
(cdr ids))))))
(if as
(exp
vs
......@@ -1894,8 +1894,10 @@ empty list."
(let ((f (gensym "f")))
`(,(G 'begin)
(,(G 'fluid-set!) ,(Y 'in-yield) #t)
(,(G 'let) ((,f (scm.yield ,@(gen-yargs vs args))))
(,f)))))
(,(G 'let) ((,f (scm.yield ,@(if args
(gen-yargs vs args)
(list None)))))
(,f)))))
((_ f args)
......
......@@ -8,7 +8,7 @@
#:use-module (language python module)
#:use-module (language python dict)
#:use-module ((language python module python)
#:select (getattr type))
#:select (getattr type object))
#:export (MappingProxyType Functiontype LambdaType
MethodType BuiltinMethodType CodeType
......@@ -31,6 +31,8 @@ Define names for built-in types that aren't directly accessible as a builtin.
(define TracebackType #:TracebackType)
(define FrameType #:FrameType)
(define DynamicClassAttribute #:DynamicClassAttribute)
(define ClassType type)
(define InctanceType object)
(define-python-class DynamicClassAttribute ()
"Route attribute access on a class to __getattr__.
......
(define-module (language python module six)
#:export ())
#:use-module (language python module python)
#:export (PY2 PY3 string_types))
(define PY2 #f
(define PY3 #t)
(define string_types str)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment