summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/language/python/bytes.scm6
-rw-r--r--modules/oop/pf-objects.scm22
2 files changed, 15 insertions, 13 deletions
diff --git a/modules/language/python/bytes.scm b/modules/language/python/bytes.scm
index 44c93bc..7700a00 100644
--- a/modules/language/python/bytes.scm
+++ b/modules/language/python/bytes.scm
@@ -57,7 +57,7 @@
(lp (+ i 1)))))
(slot-set! self 'bytes bytes)))
((is-a? s <py-string>)
- (__init__ self (slot-ref s 'bytes)))
+ (__init__ self (slot-ref s 'str)))
((is-a? s <py-bytes>)
(slot-set! self 'bytes (slot-ref s 'bytes)))
((is-a? s <bytevector>)
@@ -67,12 +67,12 @@
(b (b-make n)))
(bytevector-copy! (slot-ref s 'vec) 0 b 0 n)
(slot-set! self 'bytes b)))
- (else
+ (else
(for ((x : s)) ((r '()))
(cons (b-char x) r)
#:final
- (let* ((n (length r))
+ (let* ((n (length r))
(bytes (b-make n)))
(let lp ((i (- n 1)) (r r))
(if (>= i 0)
diff --git a/modules/oop/pf-objects.scm b/modules/oop/pf-objects.scm
index 10016c7..4ed5680 100644
--- a/modules/oop/pf-objects.scm
+++ b/modules/oop/pf-objects.scm
@@ -73,10 +73,10 @@ explicitly tell it to not update etc.
(create-object class meta goops x)))
(if (hash-table? dict)
(hash-for-each
- (lambda (k v) (set class k v))
+ (lambda (k v) k (set class k v))
dict)
(hashforeach
- (lambda (k v) (set class k v))
+ (lambda (k v) k (set class k v))
dict))
(let((mro (ref class '__mro__)))
(if (pair? mro)
@@ -98,7 +98,7 @@ explicitly tell it to not update etc.
(let ((dict (gen-methods (get-dict meta name keys))))
(aif it (ref meta '__class__)
(aif it (find-in-class (ref meta '__class__) '__call__ #f)
- (apply (it meta 'object) name parents dict keys)
+ (apply (it meta 'class) name parents dict keys)
(type- meta name parents dict keys))
(type- meta name parents dict keys))))
@@ -107,7 +107,7 @@ explicitly tell it to not update etc.
(apply it x)
(let ((obj (aif it (find-in-class class '__new__ #f)
((it class 'object))
- (make-object class meta goops))))
+ (make-object class meta goops))))
(aif it (ref obj '__init__)
(apply it x)
#f)
@@ -254,14 +254,14 @@ explicitly tell it to not update etc.
(let ((xx x))
(let ((res (mrefx xx key l)))
(if (and (not (struct? res)) (procedure? res))
- (res xx)
+ (res xx (fluid-ref *refkind*))
res))))
(define-syntax-rule (mref-py x key l)
(let ((xx x))
(let ((res (mrefx-py xx key l)))
(if (and (not (struct? res)) (procedure? res))
- (res xx)
+ (res xx (fluid-ref *refkind*))
res))))
(define-method (ref x key . l) (if (pair? l) (car l) #f))
@@ -347,6 +347,7 @@ explicitly tell it to not update etc.
(define-syntax-rule (mklam (mset a ...) val)
(if (and (procedure? val)
(not (pyclass? val))
+ (not (pytype? val))
(if (is-a? val <p>)
(ref val '__call__)
#t))
@@ -638,11 +639,11 @@ explicitly tell it to not update etc.
(lp (cdr l) mro min)))))
(car (reverse min))))))))
- (define goops (make-class (append goopses (list (kw->class kw meta)))
- '() #:name name))
+ (define goops (make-class (append goopses (list (kw->class kw meta)))
+ '() #:name name))
(define (gen-methods dict)
- (method dict)
+ (methods dict)
(pylist-set! dict '__goops__ goops)
(pylist-set! dict '__class__ meta)
(pylist-set! dict '__fget__ #t)
@@ -652,6 +653,7 @@ explicitly tell it to not update etc.
(pylist-set! dict '__class__ meta)
(pylist-set! dict '__mro__ (get-mro parents))
dict)
+
(create-class meta name parents gen-methods kw))
@@ -724,7 +726,7 @@ explicitly tell it to not update etc.
(if (keyword? x)
(cons (reverse r) l)
(lp (cdr l) (cons x r))))
- (cons (reverse l) '()))))
+ (cons (reverse r) '()))))
(define-syntax-rule (define-python-class name (parents ...) code ...)
(define name (mk-p-class name (arglist->pkw (list parents ...)) code ...)))