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
621dbe64
Commit
621dbe64
authored
Aug 23, 2012
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enable 'binding' directive by default when compiling .py files
parent
f5bfa123
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
6 deletions
+19
-6
Cython/Compiler/Main.py
Cython/Compiler/Main.py
+17
-5
Cython/Compiler/Options.py
Cython/Compiler/Options.py
+2
-1
No files found.
Cython/Compiler/Main.py
View file @
621dbe64
...
@@ -385,13 +385,14 @@ def create_default_resultobj(compilation_source, options):
...
@@ -385,13 +385,14 @@ def create_default_resultobj(compilation_source, options):
def
run_pipeline
(
source
,
options
,
full_module_name
=
None
,
context
=
None
):
def
run_pipeline
(
source
,
options
,
full_module_name
=
None
,
context
=
None
):
import
Pipeline
import
Pipeline
source_ext
=
os
.
path
.
splitext
(
source
)[
1
]
options
.
configure_language_defaults
(
source_ext
[
1
:])
# py/pyx
if
context
is
None
:
if
context
is
None
:
context
=
options
.
create_context
()
context
=
options
.
create_context
()
# Set up source object
# Set up source object
cwd
=
os
.
getcwd
()
cwd
=
os
.
getcwd
()
abs_path
=
os
.
path
.
abspath
(
source
)
abs_path
=
os
.
path
.
abspath
(
source
)
source_ext
=
os
.
path
.
splitext
(
source
)[
1
]
full_module_name
=
full_module_name
or
context
.
extract_module_name
(
source
,
options
)
full_module_name
=
full_module_name
or
context
.
extract_module_name
(
source
,
options
)
if
options
.
relative_path_in_code_position_comments
:
if
options
.
relative_path_in_code_position_comments
:
...
@@ -471,10 +472,21 @@ class CompilationOptions(object):
...
@@ -471,10 +472,21 @@ class CompilationOptions(object):
defaults
=
defaults
.
__dict__
defaults
=
defaults
.
__dict__
else
:
else
:
defaults
=
default_options
defaults
=
default_options
self
.
__dict__
.
update
(
defaults
)
self
.
__dict__
.
update
(
kw
)
options
=
dict
(
defaults
)
if
'language_level'
not
in
kw
and
'language_level'
in
self
.
compiler_directives
:
options
.
update
(
kw
)
self
.
language_level
=
int
(
self
.
compiler_directives
[
'language_level'
])
directives
=
dict
(
options
[
'compiler_directives'
])
# copy mutable field
options
[
'compiler_directives'
]
=
directives
if
'language_level'
in
directives
and
'language_level'
not
in
kw
:
options
[
'language_level'
]
=
int
(
directives
[
'language_level'
])
self
.
__dict__
.
update
(
options
)
def
configure_language_defaults
(
self
,
source_extension
):
if
source_extension
==
'py'
:
if
self
.
compiler_directives
.
get
(
'binding'
)
is
None
:
self
.
compiler_directives
[
'binding'
]
=
True
def
create_context
(
self
):
def
create_context
(
self
):
return
Context
(
self
.
include_path
,
self
.
compiler_directives
,
return
Context
(
self
.
include_path
,
self
.
compiler_directives
,
...
...
Cython/Compiler/Options.py
View file @
621dbe64
...
@@ -124,7 +124,7 @@ directive_defaults = {
...
@@ -124,7 +124,7 @@ directive_defaults = {
'test_fail_if_path_exists'
:
[],
'test_fail_if_path_exists'
:
[],
# experimental, subject to change
# experimental, subject to change
'binding'
:
Fals
e
,
'binding'
:
Non
e
,
'experimental_cpp_class_def'
:
False
'experimental_cpp_class_def'
:
False
}
}
...
@@ -140,6 +140,7 @@ directive_types = {
...
@@ -140,6 +140,7 @@ directive_types = {
'final'
:
bool
,
# final cdef classes and methods
'final'
:
bool
,
# final cdef classes and methods
'internal'
:
bool
,
# cdef class visibility in the module dict
'internal'
:
bool
,
# cdef class visibility in the module dict
'infer_types'
:
bool
,
# values can be True/None/False
'infer_types'
:
bool
,
# values can be True/None/False
'binding'
:
bool
,
'cfunc'
:
None
,
# decorators do not take directive value
'cfunc'
:
None
,
# decorators do not take directive value
'ccall'
:
None
,
'ccall'
:
None
,
'cclass'
:
None
,
'cclass'
:
None
,
...
...
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