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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
77b60f7b
Commit
77b60f7b
authored
May 14, 2009
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Module is main flag for embedded mode.
parent
9b7cc754
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+8
-6
Cython/Compiler/Naming.py
Cython/Compiler/Naming.py
+1
-0
No files found.
Cython/Compiler/ModuleNode.py
View file @
77b60f7b
...
...
@@ -265,6 +265,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code
=
globalstate
[
'before_global_var'
]
code
.
putln
(
'#define __Pyx_MODULE_NAME "%s"'
%
self
.
full_module_name
)
code
.
putln
(
"int %s%s = %s;"
%
(
Naming
.
module_is_main
,
self
.
full_module_name
.
replace
(
'.'
,
'__'
),
int
(
Options
.
embed
)))
code
.
putln
(
""
)
code
.
putln
(
"/* Implementation of %s */"
%
env
.
qualified_name
)
self
.
generate_const_definitions
(
env
,
code
)
...
...
@@ -1835,12 +1836,13 @@ 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
)))
code
.
putln
(
"if (%s%s) {"
%
(
Naming
.
module_is_main
,
self
.
full_module_name
.
replace
(
'.'
,
'__'
)))
code
.
putln
(
'if (__Pyx_SetAttrString(%s, "__name__", %s) < 0) %s;'
%
(
env
.
module_cname
,
self
.
__main__cname
,
code
.
error_goto
(
self
.
pos
)))
code
.
putln
(
"}"
)
if
Options
.
pre_import
is
not
None
:
code
.
putln
(
'%s = PyImport_AddModule(__Pyx_NAMESTR("%s"));'
%
(
...
...
Cython/Compiler/Naming.py
View file @
77b60f7b
...
...
@@ -43,6 +43,7 @@ vtabptr_prefix = pyrex_prefix + "vtabptr_"
vtabstruct_prefix
=
pyrex_prefix
+
"vtabstruct_"
opt_arg_prefix
=
pyrex_prefix
+
"opt_args_"
convert_func_prefix
=
pyrex_prefix
+
"convert_"
module_is_main
=
pyrex_prefix
+
"module_is_main_"
args_cname
=
pyrex_prefix
+
"args"
pykwdlist_cname
=
pyrex_prefix
+
"pyargnames"
...
...
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