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
084af98b
Commit
084af98b
authored
Mar 11, 2018
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compile C++ Cython utility code in a C++ context.
parent
de4aa5fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
Cython/Compiler/TreeFragment.py
Cython/Compiler/TreeFragment.py
+2
-2
Cython/Compiler/UtilityCode.py
Cython/Compiler/UtilityCode.py
+5
-5
No files found.
Cython/Compiler/TreeFragment.py
View file @
084af98b
...
@@ -24,13 +24,13 @@ from . import UtilNodes
...
@@ -24,13 +24,13 @@ from . import UtilNodes
class
StringParseContext
(
Main
.
Context
):
class
StringParseContext
(
Main
.
Context
):
def
__init__
(
self
,
name
,
include_directories
=
None
,
compiler_directives
=
None
):
def
__init__
(
self
,
name
,
include_directories
=
None
,
compiler_directives
=
None
,
cpp
=
False
):
if
include_directories
is
None
:
if
include_directories
is
None
:
include_directories
=
[]
include_directories
=
[]
if
compiler_directives
is
None
:
if
compiler_directives
is
None
:
compiler_directives
=
{}
compiler_directives
=
{}
Main
.
Context
.
__init__
(
self
,
include_directories
,
compiler_directives
,
Main
.
Context
.
__init__
(
self
,
include_directories
,
compiler_directives
,
create_testscope
=
False
)
create_testscope
=
False
,
cpp
=
cpp
)
self
.
module_name
=
name
self
.
module_name
=
name
def
find_module
(
self
,
module_name
,
relative_to
=
None
,
pos
=
None
,
need_pxd
=
1
,
absolute_fallback
=
True
):
def
find_module
(
self
,
module_name
,
relative_to
=
None
,
pos
=
None
,
need_pxd
=
1
,
absolute_fallback
=
True
):
...
...
Cython/Compiler/UtilityCode.py
View file @
084af98b
...
@@ -8,11 +8,10 @@ from . import Code
...
@@ -8,11 +8,10 @@ from . import Code
class
NonManglingModuleScope
(
Symtab
.
ModuleScope
):
class
NonManglingModuleScope
(
Symtab
.
ModuleScope
):
cpp
=
False
def
__init__
(
self
,
prefix
,
*
args
,
**
kw
):
def
__init__
(
self
,
prefix
,
*
args
,
**
kw
):
self
.
prefix
=
prefix
self
.
prefix
=
prefix
self
.
cython_scope
=
None
self
.
cython_scope
=
None
self
.
cpp
=
kw
.
pop
(
'cpp'
,
False
)
Symtab
.
ModuleScope
.
__init__
(
self
,
*
args
,
**
kw
)
Symtab
.
ModuleScope
.
__init__
(
self
,
*
args
,
**
kw
)
def
add_imported_entry
(
self
,
name
,
entry
,
pos
):
def
add_imported_entry
(
self
,
name
,
entry
,
pos
):
...
@@ -44,7 +43,7 @@ class CythonUtilityCodeContext(StringParseContext):
...
@@ -44,7 +43,7 @@ class CythonUtilityCodeContext(StringParseContext):
if
self
.
scope
is
None
:
if
self
.
scope
is
None
:
self
.
scope
=
NonManglingModuleScope
(
self
.
scope
=
NonManglingModuleScope
(
self
.
prefix
,
module_name
,
parent_module
=
None
,
context
=
self
)
self
.
prefix
,
module_name
,
parent_module
=
None
,
context
=
self
,
cpp
=
self
.
cpp
)
return
self
.
scope
return
self
.
scope
...
@@ -119,7 +118,8 @@ class CythonUtilityCode(Code.UtilityCodeBase):
...
@@ -119,7 +118,8 @@ class CythonUtilityCode(Code.UtilityCodeBase):
from
.
import
Pipeline
,
ParseTreeTransforms
from
.
import
Pipeline
,
ParseTreeTransforms
context
=
CythonUtilityCodeContext
(
context
=
CythonUtilityCodeContext
(
self
.
name
,
compiler_directives
=
self
.
compiler_directives
)
self
.
name
,
compiler_directives
=
self
.
compiler_directives
,
cpp
=
cython_scope
.
is_cpp
()
if
cython_scope
else
False
)
context
.
prefix
=
self
.
prefix
context
.
prefix
=
self
.
prefix
context
.
cython_scope
=
cython_scope
context
.
cython_scope
=
cython_scope
#context = StringParseContext(self.name)
#context = StringParseContext(self.name)
...
@@ -223,7 +223,7 @@ class CythonUtilityCode(Code.UtilityCodeBase):
...
@@ -223,7 +223,7 @@ class CythonUtilityCode(Code.UtilityCodeBase):
for
dep
in
self
.
requires
:
for
dep
in
self
.
requires
:
if
dep
.
is_cython_utility
:
if
dep
.
is_cython_utility
:
dep
.
declare_in_scope
(
dest_scope
)
dep
.
declare_in_scope
(
dest_scope
,
cython_scope
=
cython_scope
)
return
original_scope
return
original_scope
...
...
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