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
Kirill Smelkov
cython
Commits
de5cc1b2
Commit
de5cc1b2
authored
Jul 22, 2017
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make module exec function cname module specific to make it easier to select in a debugger/profiler
parent
9f2471db
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+9
-6
Cython/Compiler/Naming.py
Cython/Compiler/Naming.py
+2
-2
No files found.
Cython/Compiler/ModuleNode.py
View file @
de5cc1b2
...
@@ -204,7 +204,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -204,7 +204,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
h_code
.
putln
(
"#if PY_MAJOR_VERSION < 3"
)
h_code
.
putln
(
"#if PY_MAJOR_VERSION < 3"
)
h_code
.
putln
(
"PyMODINIT_FUNC init%s(void);"
%
env
.
module_name
)
h_code
.
putln
(
"PyMODINIT_FUNC init%s(void);"
%
env
.
module_name
)
h_code
.
putln
(
"#else"
)
h_code
.
putln
(
"#else"
)
h_code
.
putln
(
"PyMODINIT_FUNC
PyInit_%s(void);"
%
env
.
module_name
)
h_code
.
putln
(
"PyMODINIT_FUNC
%s(void);"
%
self
.
mod_init_func_cname
(
'PyInit'
,
env
)
)
h_code
.
putln
(
"#endif"
)
h_code
.
putln
(
"#endif"
)
h_code
.
putln
(
""
)
h_code
.
putln
(
""
)
h_code
.
putln
(
"#endif /* !%s */"
%
h_guard
)
h_code
.
putln
(
"#endif /* !%s */"
%
h_guard
)
...
@@ -2109,7 +2109,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -2109,7 +2109,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code
.
enter_cfunc_scope
(
self
.
scope
)
code
.
enter_cfunc_scope
(
self
.
scope
)
code
.
putln
(
""
)
code
.
putln
(
""
)
header2
=
"PyMODINIT_FUNC init%s(void)"
%
env
.
module_name
header2
=
"PyMODINIT_FUNC init%s(void)"
%
env
.
module_name
header3
=
"PyMODINIT_FUNC
PyInit_%s(void)"
%
env
.
module_name
header3
=
"PyMODINIT_FUNC
%s(void)"
%
self
.
mod_init_func_cname
(
'PyInit'
,
env
)
code
.
putln
(
"#if PY_MAJOR_VERSION < 3"
)
code
.
putln
(
"#if PY_MAJOR_VERSION < 3"
)
code
.
putln
(
"%s; /*proto*/"
%
header2
)
code
.
putln
(
"%s; /*proto*/"
%
header2
)
code
.
putln
(
header2
)
code
.
putln
(
header2
)
...
@@ -2129,7 +2129,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -2129,7 +2129,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code
.
putln
(
""
)
code
.
putln
(
""
)
# main module init code lives in Py_mod_exec function, not in PyInit function
# main module init code lives in Py_mod_exec function, not in PyInit function
code
.
putln
(
"static int %s(PyObject *%s)"
%
(
code
.
putln
(
"static int %s(PyObject *%s)"
%
(
Naming
.
pymodule_exec_func_cname
,
self
.
mod_init_func_cname
(
Naming
.
pymodule_exec_func_cname
,
env
)
,
Naming
.
pymodinit_module_arg
))
Naming
.
pymodinit_module_arg
))
code
.
putln
(
"#endif"
)
# PEP489
code
.
putln
(
"#endif"
)
# PEP489
...
@@ -2446,6 +2446,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -2446,6 +2446,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
main_method
=
Options
.
embed
,
main_method
=
Options
.
embed
,
wmain_method
=
wmain
))
wmain_method
=
wmain
))
def
mod_init_func_cname
(
self
,
prefix
,
env
):
return
'%s_%s'
%
(
prefix
,
env
.
module_name
)
def
generate_pymoduledef_struct
(
self
,
env
,
code
):
def
generate_pymoduledef_struct
(
self
,
env
,
code
):
if
env
.
doc
:
if
env
.
doc
:
doc
=
"%s"
%
code
.
get_string_const
(
env
.
doc
)
doc
=
"%s"
%
code
.
get_string_const
(
env
.
doc
)
...
@@ -2459,14 +2462,14 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -2459,14 +2462,14 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code
.
putln
(
""
)
code
.
putln
(
""
)
code
.
putln
(
"#if PY_MAJOR_VERSION >= 3"
)
code
.
putln
(
"#if PY_MAJOR_VERSION >= 3"
)
code
.
putln
(
"#if CYTHON_PEP489_MULTI_PHASE_INIT"
)
code
.
putln
(
"#if CYTHON_PEP489_MULTI_PHASE_INIT"
)
exec_func_cname
=
self
.
mod_init_func_cname
(
Naming
.
pymodule_exec_func_cname
,
env
)
code
.
putln
(
"static PyObject* %s(PyObject *spec, PyModuleDef *def); /*proto*/"
%
code
.
putln
(
"static PyObject* %s(PyObject *spec, PyModuleDef *def); /*proto*/"
%
Naming
.
pymodule_create_func_cname
)
Naming
.
pymodule_create_func_cname
)
code
.
putln
(
"static int %s(PyObject* module); /*proto*/"
%
code
.
putln
(
"static int %s(PyObject* module); /*proto*/"
%
exec_func_cname
)
Naming
.
pymodule_exec_func_cname
)
code
.
putln
(
"static PyModuleDef_Slot %s[] = {"
%
Naming
.
pymoduledef_slots_cname
)
code
.
putln
(
"static PyModuleDef_Slot %s[] = {"
%
Naming
.
pymoduledef_slots_cname
)
code
.
putln
(
"{Py_mod_create, %s},"
%
Naming
.
pymodule_create_func_cname
)
code
.
putln
(
"{Py_mod_create, %s},"
%
Naming
.
pymodule_create_func_cname
)
code
.
putln
(
"{Py_mod_exec, %s},"
%
Naming
.
pymodule_
exec_func_cname
)
code
.
putln
(
"{Py_mod_exec, %s},"
%
exec_func_cname
)
code
.
putln
(
"{0, NULL}"
)
code
.
putln
(
"{0, NULL}"
)
code
.
putln
(
"};"
)
code
.
putln
(
"};"
)
code
.
putln
(
"#endif"
)
code
.
putln
(
"#endif"
)
...
...
Cython/Compiler/Naming.py
View file @
de5cc1b2
...
@@ -103,8 +103,8 @@ cleanup_cname = pyrex_prefix + "module_cleanup"
...
@@ -103,8 +103,8 @@ cleanup_cname = pyrex_prefix + "module_cleanup"
pymoduledef_cname
=
pyrex_prefix
+
"moduledef"
pymoduledef_cname
=
pyrex_prefix
+
"moduledef"
pymoduledef_slots_cname
=
pyrex_prefix
+
"moduledef_slots"
pymoduledef_slots_cname
=
pyrex_prefix
+
"moduledef_slots"
pymodinit_module_arg
=
pyrex_prefix
+
"pyinit_module"
pymodinit_module_arg
=
pyrex_prefix
+
"pyinit_module"
pymodule_create_func_cname
=
pyrex_prefix
+
"py
init_module
_create"
pymodule_create_func_cname
=
pyrex_prefix
+
"py
mod
_create"
pymodule_exec_func_cname
=
pyrex_prefix
+
"py
init_module
_exec"
pymodule_exec_func_cname
=
pyrex_prefix
+
"py
mod
_exec"
optional_args_cname
=
pyrex_prefix
+
"optional_args"
optional_args_cname
=
pyrex_prefix
+
"optional_args"
import_star
=
pyrex_prefix
+
"import_star"
import_star
=
pyrex_prefix
+
"import_star"
import_star_set
=
pyrex_prefix
+
"import_star_set"
import_star_set
=
pyrex_prefix
+
"import_star_set"
...
...
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