Skip to content

Commit 03f02c0

Browse files
committed
Set __name__, __doc__ and __package__ in Module
1 parent 0de7e76 commit 03f02c0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

py/module.go

+4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ func NewModule(name, doc string, methods []*Method, globals StringDict) *Module
3939
for _, method := range methods {
4040
m.Globals[method.Name] = method
4141
}
42+
// Set some module globals
43+
m.Globals["__name__"] = String(name)
44+
m.Globals["__doc__"] = String(doc)
45+
m.Globals["__package__"] = None
4246
// Register the module
4347
modules[name] = m
4448
// Make a note of the builtin module

0 commit comments

Comments
 (0)