Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
611591bf
Commit
611591bf
authored
Apr 21, 2009
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
__name__ == "__main__" for embedded modules
parent
9ad9a05e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
Cython/Compiler/CmdLine.py
Cython/Compiler/CmdLine.py
+0
-1
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+9
-1
No files found.
Cython/Compiler/CmdLine.py
View file @
611591bf
...
...
@@ -73,7 +73,6 @@ def parse_command_line(args):
options
=
CompilationOptions
(
default_options
)
sources
=
[]
while
args
:
print
args
if
args
[
0
].
startswith
(
"-"
):
option
=
pop_arg
()
if
option
in
(
"-V"
,
"--version"
):
...
...
Cython/Compiler/ModuleNode.py
View file @
611591bf
...
...
@@ -56,6 +56,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
else
:
env
.
doc
=
self
.
doc
env
.
directives
=
self
.
directives
if
Options
.
embed
:
self
.
__main__cname
=
env
.
intern_identifier
(
EncodedString
(
"__main__"
))
self
.
body
.
analyse_declarations
(
env
)
def
process_implementation
(
self
,
options
,
result
):
...
...
@@ -1803,6 +1805,12 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
env
.
module_cname
,
Naming
.
builtins_cname
,
code
.
error_goto
(
self
.
pos
)))
if
Options
.
embed
:
code
.
putln
(
'if (__Pyx_SetAttrString(%s, "__name__", %s) < 0) %s;'
%
(
env
.
module_cname
,
self
.
__main__cname
,
code
.
error_goto
(
self
.
pos
)))
if
Options
.
pre_import
is
not
None
:
code
.
putln
(
'%s = PyImport_AddModule(__Pyx_NAMESTR("%s"));'
%
(
...
...
@@ -2459,7 +2467,7 @@ int main(int argc, char** argv) {
#else
PyInit_%(module_name)s(name);
#endif
r = PyErr_Occurred();
r = PyErr_Occurred()
!= NULL
;
Py_Finalize();
return r;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment