Skip to content

Commit f6af29a

Browse files
committed
fix merge conflict
2 parents b451bf2 + 51a6831 commit f6af29a

File tree

37 files changed

+255
-46
lines changed

37 files changed

+255
-46
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
name: Build
2020
strategy:
2121
matrix:
22-
go-version: [1.17.x, 1.16.x]
22+
go-version: [1.18.x, 1.17.x]
2323
platform: [ubuntu-latest, macos-latest, windows-latest]
2424
runs-on: ${{ matrix.platform }}
2525
steps:

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ cover.out
1010
/dist
1111

1212
# tests
13-
builtin/testfile
14-
examples/embedding/embedding
13+
stdlib/builtin/testfile
14+
examples/embedding/embedding

compile/compile_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ package compile
1010

1111
import (
1212
"fmt"
13-
"io/ioutil"
13+
"io"
1414
"os/exec"
1515
"testing"
1616

@@ -118,7 +118,7 @@ func EqCodeCode(t *testing.T, name string, a, b string) {
118118
t.Errorf("%s code want %q, got %q", name, a, b)
119119
return
120120
}
121-
stdoutData, err := ioutil.ReadAll(stdout)
121+
stdoutData, err := io.ReadAll(stdout)
122122
if err != nil {
123123
t.Fatalf("Failed to read data: %v", err)
124124
}

examples/embedding/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
// This initializes gpython for runtime execution and is essential.
1212
// It defines forward-declared symbols and registers native built-in modules, such as sys and time.
13-
_ "github.com/go-python/gpython/modules"
13+
_ "github.com/go-python/gpython/stdlib"
1414

1515
// Commonly consumed gpython
1616
"github.com/go-python/gpython/py"
@@ -27,8 +27,8 @@ func runWithFile(pyFile string) error {
2727

2828
// See type Context interface and related docs
2929
ctx := py.NewContext(py.DefaultContextOpts())
30-
31-
// This drives modules being able to perform cleanup and release resources
30+
31+
// This drives modules being able to perform cleanup and release resources
3232
defer ctx.Close()
3333

3434
var err error

examples/multi-context/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414

1515
// This initializes gpython for runtime execution and is critical.
1616
// It defines forward-declared symbols and registers native built-in modules, such as sys and time.
17-
_ "github.com/go-python/gpython/modules"
17+
_ "github.com/go-python/gpython/stdlib"
1818

1919
// This is the primary import for gpython.
2020
// It contains all symbols needed to fully compile and run python.
@@ -129,7 +129,7 @@ func RunMultiPi(numWorkers, numTimes int) time.Duration {
129129
}
130130
workersRunning.Done()
131131

132-
// This drives modules being able to perform cleanup and release resources
132+
// This drives modules being able to perform cleanup and release resources
133133
w.ctx.Close()
134134
}()
135135
}

go.mod

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
module github.com/go-python/gpython
22

3-
go 1.16
3+
go 1.17
44

55
require (
6+
github.com/google/go-cmp v0.5.7
67
github.com/gopherjs/gopherwasm v1.1.0
78
github.com/peterh/liner v1.2.2
89
)
10+
11+
require (
12+
github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c // indirect
13+
github.com/mattn/go-runewidth v0.0.13 // indirect
14+
github.com/rivo/uniseg v0.2.0 // indirect
15+
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect
16+
)

go.sum

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1+
github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
2+
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
13
github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c h1:16eHWuMGvCjSfgRJKqIzapE78onvvTbdi1rMkU00lZw=
24
github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
3-
github.com/gopherjs/gopherwasm v1.0.0 h1:32nge/RlujS1Im4HNCJPp0NbBOAeBXFuT1KonUuLl+Y=
4-
github.com/gopherjs/gopherwasm v1.0.0/go.mod h1:SkZ8z7CWBz5VXbhJel8TxCmAcsQqzgWGR/8nMhyhZSI=
55
github.com/gopherjs/gopherwasm v1.1.0 h1:fA2uLoctU5+T3OhOn2vYP0DVT6pxc7xhTlBB1paATqQ=
66
github.com/gopherjs/gopherwasm v1.1.0/go.mod h1:SkZ8z7CWBz5VXbhJel8TxCmAcsQqzgWGR/8nMhyhZSI=
7-
github.com/mattn/go-runewidth v0.0.3 h1:a+kO+98RDGEfo6asOGMmpodZq4FNtnGP54yps8BzLR4=
87
github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
9-
github.com/peterh/liner v1.1.0 h1:f+aAedNJA6uk7+6rXsYBnhdo4Xux7ESLe+kcuVUF5os=
10-
github.com/peterh/liner v1.1.0/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0=
8+
github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=
9+
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
1110
github.com/peterh/liner v1.2.2 h1:aJ4AOodmL+JxOZZEL2u9iJf8omNRpqHc/EbrK+3mAXw=
1211
github.com/peterh/liner v1.2.2/go.mod h1:xFwJyiKIXJZUKItq5dGHZSTBRAuG/CpeNpWLyiNRNwI=
13-
golang.org/x/sys v0.0.0-20211117180635-dee7805ff2e1 h1:kwrAHlwJ0DUBZwQ238v+Uod/3eZ8B2K5rYsUHBQvzmI=
12+
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
13+
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
1414
golang.org/x/sys v0.0.0-20211117180635-dee7805ff2e1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
15+
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 h1:OH54vjqzRWmbJ62fjuhxy7AxFFgoHN0/DPc/UrL8cAs=
16+
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
17+
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
18+
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ import (
1414
"runtime"
1515
"runtime/pprof"
1616

17-
_ "github.com/go-python/gpython/modules"
1817
"github.com/go-python/gpython/py"
1918
"github.com/go-python/gpython/repl"
2019
"github.com/go-python/gpython/repl/cli"
20+
21+
_ "github.com/go-python/gpython/stdlib"
2122
)
2223

2324
// Globals

parser/testparser/testparser.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ package main
77
import (
88
"flag"
99
"fmt"
10-
"io/ioutil"
10+
"io"
1111
"log"
1212
"os"
1313

@@ -47,7 +47,7 @@ func main() {
4747
_, err = parser.Lex(in, path, "exec")
4848
} else if *compileFile {
4949
var input []byte
50-
input, err = ioutil.ReadAll(in)
50+
input, err = io.ReadAll(in)
5151
if err != nil {
5252
log.Fatalf("Failed to read %q: %v", path, err)
5353
}

py/dict.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ func (a StringDict) M__str__() (Object, error) {
114114
return a.M__repr__()
115115
}
116116

117+
func (a StringDict) M__len__() (Object, error) {
118+
return Int(len(a)), nil
119+
}
120+
117121
func (a StringDict) M__repr__() (Object, error) {
118122
var out bytes.Buffer
119123
out.WriteRune('{')

0 commit comments

Comments
 (0)