Skip to content

Commit ee952c8

Browse files
raffncw
authored andcommitted
print should use __str__ or __repr__ when available
1 parent 6e7b5ec commit ee952c8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

builtin/builtin.go

+5
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ func builtin_print(self py.Object, args py.Tuple, kwargs py.StringDict) (py.Obje
189189
end := endObj.(py.String)
190190
// FIXME ignoring file and flush
191191
for i, v := range args {
192+
v, err := py.Str(v)
193+
if err != nil {
194+
return nil, err
195+
}
196+
192197
fmt.Printf("%v", v)
193198
if i != len(args)-1 {
194199
fmt.Print(sep)

0 commit comments

Comments
 (0)