Skip to content

Commit 118acd7

Browse files
author
Тимофей Шкредов
committed
Remove syscalls and change go version
1 parent a8b6220 commit 118acd7

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

go.mod

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

3-
go 1.18
3+
go 1.25
44

55
require (
66
github.com/google/go-cmp v0.5.8

main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"os/signal"
1515
"runtime"
1616
"runtime/pprof"
17-
"syscall"
1817

1918
"github.com/go-python/gpython/py"
2019
"github.com/go-python/gpython/repl"
@@ -51,7 +50,7 @@ func xmain(args []string) {
5150
defer ctx.Close()
5251

5352
sigCh := make(chan os.Signal, 1)
54-
signal.Notify(sigCh, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
53+
signal.Notify(sigCh, os.Interrupt)
5554
go func() {
5655
for range sigCh {
5756
ctx.SetInterrupt()

stdlib/stdlib.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type context struct {
4545
closed bool
4646
running sync.WaitGroup
4747
done chan struct{}
48-
interrupt int32 // atomic; non-zero means KeyboardInterrupt pending
48+
interrupt atomic.Int32 // non-zero means KeyboardInterrupt pending
4949
}
5050

5151
// NewContext creates a new gpython interpreter instance context.
@@ -196,12 +196,12 @@ func (ctx *context) ResolveAndCompile(pathname string, opts py.CompileOpts) (py.
196196

197197
// See interface py.Context defined in py/run.go
198198
func (ctx *context) SetInterrupt() {
199-
atomic.StoreInt32(&ctx.interrupt, 1)
199+
ctx.interrupt.Store(1)
200200
}
201201

202202
// See interface py.Context defined in py/run.go
203203
func (ctx *context) CheckInterrupt() bool {
204-
return atomic.SwapInt32(&ctx.interrupt, 0) != 0
204+
return ctx.interrupt.Swap(0) != 0
205205
}
206206

207207
func (ctx *context) pushBusy() error {

0 commit comments

Comments
 (0)