@@ -60,8 +60,8 @@ func NewContext(opts py.ContextOpts) py.Context {
60
60
}
61
61
62
62
func (ctx * context ) ModuleInit (impl * py.ModuleImpl ) (* py.Module , error ) {
63
- err := ctx .PushBusy ()
64
- defer ctx .PopBusy ()
63
+ err := ctx .pushBusy ()
64
+ defer ctx .popBusy ()
65
65
if err != nil {
66
66
return nil , err
67
67
}
@@ -101,8 +101,8 @@ func (ctx *context) ModuleInit(impl *py.ModuleImpl) (*py.Module, error) {
101
101
}
102
102
103
103
func (ctx * context ) ResolveAndCompile (pathname string , opts py.CompileOpts ) (py.CompileOut , error ) {
104
- err := ctx .PushBusy ()
105
- defer ctx .PopBusy ()
104
+ err := ctx .pushBusy ()
105
+ defer ctx .popBusy ()
106
106
if err != nil {
107
107
return py.CompileOut {}, err
108
108
}
@@ -181,20 +181,20 @@ func (ctx *context) ResolveAndCompile(pathname string, opts py.CompileOpts) (py.
181
181
return out , nil
182
182
}
183
183
184
- func (ctx * context ) PushBusy () error {
184
+ func (ctx * context ) pushBusy () error {
185
185
if ctx .closed {
186
186
return py .ExceptionNewf (py .RuntimeError , "Context closed" )
187
187
}
188
188
ctx .running .Add (1 )
189
189
return nil
190
190
}
191
191
192
- func (ctx * context ) PopBusy () {
192
+ func (ctx * context ) popBusy () {
193
193
ctx .running .Done ()
194
194
}
195
195
196
196
// Close -- see type py.Context
197
- func (ctx * context ) Close () {
197
+ func (ctx * context ) Close () error {
198
198
ctx .closeOnce .Do (func () {
199
199
ctx .closing = true
200
200
ctx .running .Wait ()
@@ -204,6 +204,7 @@ func (ctx *context) Close() {
204
204
ctx .store .OnContextClosed ()
205
205
close (ctx .done )
206
206
})
207
+ return nil
207
208
}
208
209
209
210
// Done -- see type py.Context
@@ -265,8 +266,8 @@ func resolveRunPath(runPath string, opts py.CompileOpts, pathObjs []py.Object, t
265
266
}
266
267
267
268
func (ctx * context ) RunCode (code * py.Code , globals , locals py.StringDict , closure py.Tuple ) (py.Object , error ) {
268
- err := ctx .PushBusy ()
269
- defer ctx .PopBusy ()
269
+ err := ctx .pushBusy ()
270
+ defer ctx .popBusy ()
270
271
if err != nil {
271
272
return nil , err
272
273
}
0 commit comments