Skip to content

Commit acd458b

Browse files
wetorncw
authored andcommitted
py: int() default to decimal
1 parent 652daef commit acd458b

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

py/int.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (o Int) Type() *Type {
5555
func IntNew(metatype *Type, args Tuple, kwargs StringDict) (Object, error) {
5656
var xObj Object = Int(0)
5757
var baseObj Object
58-
base := 0
58+
base := 10
5959
err := ParseTupleAndKeywords(args, kwargs, "|OO:int", []string{"x", "base"}, &xObj, &baseObj)
6060
if err != nil {
6161
return nil, err

py/tests/int.py

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103

104104
doc="sigils"
105105
assert int("7") == 7
106+
assert int("07") == 7
106107
assert int("07", 10) == 7
107108

108109
assert int("F", 16) == 15

0 commit comments

Comments
 (0)