Skip to content

Fix "end" option in print func #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 26, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix "end" option
Fix line 190 to 193.
The print function corrected the end option not applied.
Added code performed when "end" value of parameter "kwargs" is not "nil".
  • Loading branch information
Sungmin-Joo committed Sep 26, 2019
commit 40d09788c218c8b92f0d982f6725b3f1d2941206
8 changes: 4 additions & 4 deletions builtin/builtin.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ flush: whether to forcibly flush the stream.`

func builtin_print(self py.Object, args py.Tuple, kwargs py.StringDict) (py.Object, error) {
var (
sepObj py.Object = py.String(" ")
sepObj py.Object = py.String(" ")
endObj py.Object = py.String("\n")
file py.Object = py.MustGetModule("sys").Globals["stdout"]
flush py.Object
flush py.Object
)
kwlist := []string{"sep", "end", "file", "flush"}
err := py.ParseTupleAndKeywords(nil, kwargs, "|ssOO:print", kwlist, &sepObj, &endObj, &file, &flush)
Expand All @@ -199,7 +199,7 @@ func builtin_print(self py.Object, args py.Tuple, kwargs py.StringDict) (py.Obje
}

for i, v := range args {
v, err := py.Str(v)
v, err := py.Str(v)
if err != nil {
return nil, err
}
Expand All @@ -213,7 +213,7 @@ func builtin_print(self py.Object, args py.Tuple, kwargs py.StringDict) (py.Obje
_, err = py.Call(write, py.Tuple{sep}, nil)
if err != nil {
return nil, err
}
}
}
}

Expand Down