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

Lines changed: 4 additions & 0 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy