Skip to content

Commit fdfab08

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents e0d3653 + ed3c651 commit fdfab08

File tree

5 files changed

+12
-16
lines changed

5 files changed

+12
-16
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ matrix:
2626
- go: master
2727
env:
2828
- TAGS="-tags travis"
29+
- GO111MODULE=on
2930

3031
script:
3132
- go install -v $TAGS ./...

builtin/builtin.go

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,6 @@ If the iterable is empty, return True.
238238

239239
func builtin_all(self, seq py.Object) (py.Object, error) {
240240
iter, err := py.Iter(seq)
241-
res := false
242241
if err != nil {
243242
return nil, err
244243
}
@@ -250,14 +249,11 @@ func builtin_all(self, seq py.Object) (py.Object, error) {
250249
}
251250
return nil, err
252251
}
253-
if py.ObjectIsTrue(item) {
254-
res = true
255-
} else {
256-
res = false
257-
break
252+
if !py.ObjectIsTrue(item) {
253+
return py.False, nil
258254
}
259255
}
260-
return py.NewBool(res), nil
256+
return py.True, nil
261257
}
262258

263259
const any_doc = `any(iterable) -> bool
@@ -267,7 +263,6 @@ If the iterable is empty, Py_RETURN_FALSE."`
267263

268264
func builtin_any(self, seq py.Object) (py.Object, error) {
269265
iter, err := py.Iter(seq)
270-
res := false
271266
if err != nil {
272267
return nil, err
273268
}
@@ -280,11 +275,10 @@ func builtin_any(self, seq py.Object) (py.Object, error) {
280275
return nil, err
281276
}
282277
if py.ObjectIsTrue(item) {
283-
res = true
284-
break
278+
return py.True, nil
285279
}
286280
}
287-
return py.NewBool(res), nil
281+
return py.False, nil
288282
}
289283

290284
const round_doc = `round(number[, ndigits]) -> number

builtin/tests/builtin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
assert all((0,0,0)) == False
1212
assert all((1,1,0)) == False
1313
assert all(["hello", "world"]) == True
14-
assert all([]) == False
14+
assert all([]) == True
1515

1616
doc="any"
1717
assert any((0,0,0)) == False

go.mod

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
module github.com/go-python/gpython
22

3-
require (
4-
github.com/mattn/go-runewidth v0.0.3 // indirect
5-
github.com/peterh/liner v0.0.0-20180619022028-8c1271fcf47f
6-
)
3+
require github.com/peterh/liner v1.1.0

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
github.com/mattn/go-runewidth v0.0.3 h1:a+kO+98RDGEfo6asOGMmpodZq4FNtnGP54yps8BzLR4=
2+
github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
3+
github.com/peterh/liner v1.1.0 h1:f+aAedNJA6uk7+6rXsYBnhdo4Xux7ESLe+kcuVUF5os=
4+
github.com/peterh/liner v1.1.0/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0=

0 commit comments

Comments
 (0)