Skip to content

minor comment cleanup and typo patrol #194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions py/bigint.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func BigIntCheckExact(obj Object) (*BigInt, error) {
return bigInt, nil
}

// Checks that obj is exactly a bigInd and returns an error if not
// Checks that obj is exactly a BigInt and returns an error if not
func BigIntCheck(obj Object) (*BigInt, error) {
// FIXME should be checking subclasses
return BigIntCheckExact(obj)
Expand All @@ -65,7 +65,7 @@ func BigIntCheck(obj Object) (*BigInt, error) {

// Convert an Object to an BigInt
//
// Retrurns ok as to whether the conversion worked or not
// Returns ok as to whether the conversion worked or not
func ConvertToBigInt(other Object) (*BigInt, bool) {
switch b := other.(type) {
case Int:
Expand Down
2 changes: 1 addition & 1 deletion py/bool.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (a Bool) M__repr__() (Object, error) {

// Convert an Object to an Bool
//
// Retrurns ok as to whether the conversion worked or not
// Returns ok as to whether the conversion worked or not
func convertToBool(other Object) (Bool, bool) {
switch b := other.(type) {
case Bool:
Expand Down
2 changes: 1 addition & 1 deletion py/bytes.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func (a Bytes) M__repr__() (Object, error) {

// Convert an Object to an Bytes
//
// Retrurns ok as to whether the conversion worked or not
// Returns ok as to whether the conversion worked or not
func convertToBytes(other Object) (Bytes, bool) {
switch b := other.(type) {
case Bytes:
Expand Down
2 changes: 1 addition & 1 deletion py/complex.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func ComplexNew(metatype *Type, args Tuple, kwargs StringDict) (Object, error) {

// Convert an Object to an Complex
//
// Retrurns ok as to whether the conversion worked or not
// Returns ok as to whether the conversion worked or not
func convertToComplex(other Object) (Complex, bool) {
switch b := other.(type) {
case Complex:
Expand Down
2 changes: 1 addition & 1 deletion py/float.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ var floatDivisionByZero = ExceptionNewf(ZeroDivisionError, "float division by ze

// Convert an Object to an Float
//
// Retrurns ok as to whether the conversion worked or not
// Returns ok as to whether the conversion worked or not
func convertToFloat(other Object) (Float, bool) {
switch b := other.(type) {
case Float:
Expand Down
2 changes: 1 addition & 1 deletion py/int.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func cantConvert(a Object, to string) (Object, error) {

// Convert an Object to an Int
//
// Retrurns ok as to whether the conversion worked or not
// Returns ok as to whether the conversion worked or not
func convertToInt(other Object) (Int, bool) {
switch b := other.(type) {
case Int:
Expand Down
2 changes: 1 addition & 1 deletion py/none.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (a NoneType) M__repr__() (Object, error) {

// Convert an Object to an NoneType
//
// Retrurns ok as to whether the conversion worked or not
// Returns ok as to whether the conversion worked or not
func convertToNoneType(other Object) (NoneType, bool) {
switch b := other.(type) {
case NoneType:
Expand Down
3 changes: 3 additions & 0 deletions py/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,11 @@ func RunSrc(ctx Context, pySrc string, pySrcDesc string, inModule interface{}) (
}

// RunCode executes the given code object within the given module and returns the Module to indicate success.
//
// If inModule is a *Module, then the code is run in that module.
//
// If inModule is nil, the code is run in a new __main__ module (and the new Module is returned).
//
// If inModule is a string, the code is run in a new module with the given name (and the new Module is returned).
func RunCode(ctx Context, code *Code, codeDesc string, inModule interface{}) (*Module, error) {
var (
Expand Down
2 changes: 1 addition & 1 deletion py/string.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ func (a String) M__imul__(other Object) (Object, error) {

// Convert an Object to an String
//
// Retrurns ok as to whether the conversion worked or not
// Returns ok as to whether the conversion worked or not
func convertToString(other Object) (String, bool) {
switch b := other.(type) {
case String:
Expand Down
10 changes: 7 additions & 3 deletions stdlib/stdlib.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type context struct {

// NewContext creates a new gpython interpreter instance context.
//
// See type Context interface for info.
// See interface py.Context defined in py/run.go
func NewContext(opts py.ContextOpts) py.Context {
ctx := &context{
opts: opts,
Expand Down Expand Up @@ -109,6 +109,7 @@ func (ctx *context) ModuleInit(impl *py.ModuleImpl) (*py.Module, error) {
return module, nil
}

// See interface py.Context defined in py/run.go
func (ctx *context) ResolveAndCompile(pathname string, opts py.CompileOpts) (py.CompileOut, error) {
err := ctx.pushBusy()
defer ctx.popBusy()
Expand Down Expand Up @@ -202,7 +203,7 @@ func (ctx *context) popBusy() {
ctx.running.Done()
}

// Close -- see type py.Context
// See interface py.Context defined in py/run.go
func (ctx *context) Close() error {
ctx.closeOnce.Do(func() {
ctx.closing = true
Expand All @@ -216,7 +217,7 @@ func (ctx *context) Close() error {
return nil
}

// Done -- see type py.Context
// See interface py.Context defined in py/run.go
func (ctx *context) Done() <-chan struct{} {
return ctx.done
}
Expand Down Expand Up @@ -274,6 +275,7 @@ func resolveRunPath(runPath string, opts py.CompileOpts, pathObjs []py.Object, t
return err
}

// See interface py.Context defined in py/run.go
func (ctx *context) RunCode(code *py.Code, globals, locals py.StringDict, closure py.Tuple) (py.Object, error) {
err := ctx.pushBusy()
defer ctx.popBusy()
Expand All @@ -284,10 +286,12 @@ func (ctx *context) RunCode(code *py.Code, globals, locals py.StringDict, closur
return vm.EvalCode(ctx, code, globals, locals, nil, nil, nil, nil, closure)
}

// See interface py.Context defined in py/run.go
func (ctx *context) GetModule(moduleName string) (*py.Module, error) {
return ctx.store.GetModule(moduleName)
}

// See interface py.Context defined in py/run.go
func (ctx *context) Store() *py.ModuleStore {
return ctx.store
}