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
Gwenaël Samain
cython
Commits
267a657b
Commit
267a657b
authored
Aug 04, 2008
by
Dag Sverre Seljebotn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added cython builtin scope
parent
bdf1058f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
3 deletions
+27
-3
Cython/Compiler/CythonScope.py
Cython/Compiler/CythonScope.py
+20
-0
Cython/Compiler/Main.py
Cython/Compiler/Main.py
+7
-3
No files found.
Cython/Compiler/CythonScope.py
0 → 100644
View file @
267a657b
from
Symtab
import
ModuleScope
from
PyrexTypes
import
*
shape_func_type
=
CFuncType
(
c_ptr_type
(
c_py_ssize_t_type
),
[
CFuncTypeArg
(
"buffer"
,
py_object_type
,
None
)])
class
CythonScope
(
ModuleScope
):
def
__init__
(
self
,
context
):
ModuleScope
.
__init__
(
self
,
u'cython'
,
None
,
context
)
self
.
pxd_file_loaded
=
True
self
.
shape_entry
=
self
.
declare_cfunction
(
'shape'
,
shape_func_type
,
pos
=
None
,
visibility
=
'public'
,
cname
=
'<error>'
)
def
create_cython_scope
(
context
):
return
CythonScope
(
context
)
Cython/Compiler/Main.py
View file @
267a657b
...
...
@@ -23,6 +23,7 @@ from Errors import PyrexError, CompileError, error
from
Symtab
import
BuiltinScope
,
ModuleScope
from
Cython
import
Utils
from
Cython.Utils
import
open_new_file
,
replace_suffix
import
CythonScope
module_name_pattern
=
re
.
compile
(
r"[A-Za-z_][A-Za-z0-9_]*(\
.[A-Z
a-z_][A-Za-z0-9_]*)*$"
)
...
...
@@ -60,8 +61,9 @@ class Context:
def
__init__
(
self
,
include_directories
,
pragma_overrides
):
#self.modules = {"__builtin__" : BuiltinScope()}
import
Builtin
import
Builtin
,
CythonScope
self
.
modules
=
{
"__builtin__"
:
Builtin
.
builtin_scope
}
self
.
modules
[
"cython"
]
=
CythonScope
.
create_cython_scope
(
self
)
self
.
include_directories
=
include_directories
self
.
future_directives
=
set
()
self
.
pragma_overrides
=
pragma_overrides
...
...
@@ -77,7 +79,7 @@ class Context:
from
ParseTreeTransforms
import
WithTransform
,
NormalizeTree
,
PostParse
,
PxdPostParse
from
ParseTreeTransforms
import
AnalyseDeclarationsTransform
,
AnalyseExpressionsTransform
from
ParseTreeTransforms
import
CreateClosureClasses
,
MarkClosureVisitor
,
DecoratorTransform
from
ParseTreeTransforms
import
ResolveOptions
from
ParseTreeTransforms
import
ResolveOptions
,
SpecialFunctions
from
Optimize
import
FlattenInListTransform
,
SwitchTransform
,
OptimizeRefcounting
from
Buffer
import
IntroduceBufferAuxiliaryVars
from
ModuleNode
import
check_c_classes
...
...
@@ -103,6 +105,7 @@ class Context:
AnalyseExpressionsTransform
(
self
),
SwitchTransform
(),
OptimizeRefcounting
(
self
),
SpecialFunctions
(
self
),
# CreateClosureClasses(context),
]
...
...
@@ -127,7 +130,7 @@ class Context:
return
module_node
return
([
create_parse
(
self
)
create_parse
(
self
)
,
]
+
self
.
create_pipeline
(
pxd
=
False
)
+
[
inject_pxd_code
,
generate_pyx_code
,
...
...
@@ -182,6 +185,7 @@ class Context:
if
debug_find_module
:
print
(
"Context.find_module: module_name = %s, relative_to = %s, pos = %s, need_pxd = %s"
%
(
module_name
,
relative_to
,
pos
,
need_pxd
))
scope
=
None
pxd_pathname
=
None
if
not
module_name_pattern
.
match
(
module_name
):
...
...
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