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
6c5accdd
Commit
6c5accdd
authored
Aug 11, 2012
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support 'from __future__ import absolute_import'
parent
36d8cab3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
5 deletions
+6
-5
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+3
-2
Cython/Compiler/Future.py
Cython/Compiler/Future.py
+1
-0
Cython/Compiler/Main.py
Cython/Compiler/Main.py
+2
-3
No files found.
Cython/Compiler/ExprNodes.py
View file @
6c5accdd
...
@@ -34,7 +34,7 @@ import Symtab
...
@@ -34,7 +34,7 @@ import Symtab
import
Options
import
Options
from
Cython
import
Utils
from
Cython
import
Utils
from
Annotate
import
AnnotationItem
from
Annotate
import
AnnotationItem
from
Cython.Compiler
import
Future
from
Cython.Debugging
import
print_call_chain
from
Cython.Debugging
import
print_call_chain
from
DebugFlags
import
debug_disposal_code
,
debug_temp_alloc
,
\
from
DebugFlags
import
debug_disposal_code
,
debug_temp_alloc
,
\
debug_coercion
debug_coercion
...
@@ -1933,7 +1933,8 @@ class ImportNode(ExprNode):
...
@@ -1933,7 +1933,8 @@ class ImportNode(ExprNode):
def
analyse_types
(
self
,
env
):
def
analyse_types
(
self
,
env
):
if
self
.
level
is
None
:
if
self
.
level
is
None
:
if
env
.
directives
[
'language_level'
]
<
3
or
env
.
directives
[
'py2_import'
]:
if
(
env
.
directives
[
'py2_import'
]
or
Future
.
absolute_import
not
in
env
.
global_scope
().
context
.
future_directives
):
self
.
level
=
-
1
self
.
level
=
-
1
else
:
else
:
self
.
level
=
0
self
.
level
=
0
...
...
Cython/Compiler/Future.py
View file @
6c5accdd
...
@@ -10,6 +10,7 @@ unicode_literals = _get_feature("unicode_literals")
...
@@ -10,6 +10,7 @@ unicode_literals = _get_feature("unicode_literals")
with_statement
=
_get_feature
(
"with_statement"
)
with_statement
=
_get_feature
(
"with_statement"
)
division
=
_get_feature
(
"division"
)
division
=
_get_feature
(
"division"
)
print_function
=
_get_feature
(
"print_function"
)
print_function
=
_get_feature
(
"print_function"
)
absolute_import
=
_get_feature
(
"absolute_import"
)
nested_scopes
=
_get_feature
(
"nested_scopes"
)
# dummy
nested_scopes
=
_get_feature
(
"nested_scopes"
)
# dummy
generators
=
_get_feature
(
"generators"
)
# dummy
generators
=
_get_feature
(
"generators"
)
# dummy
...
...
Cython/Compiler/Main.py
View file @
6c5accdd
...
@@ -81,9 +81,8 @@ class Context(object):
...
@@ -81,9 +81,8 @@ class Context(object):
def
set_language_level
(
self
,
level
):
def
set_language_level
(
self
,
level
):
self
.
language_level
=
level
self
.
language_level
=
level
if
level
>=
3
:
if
level
>=
3
:
from
Future
import
print_function
,
unicode_literals
from
Future
import
print_function
,
unicode_literals
,
absolute_import
self
.
future_directives
.
add
(
print_function
)
self
.
future_directives
.
update
([
print_function
,
unicode_literals
,
absolute_import
])
self
.
future_directives
.
add
(
unicode_literals
)
self
.
modules
[
'builtins'
]
=
self
.
modules
[
'__builtin__'
]
self
.
modules
[
'builtins'
]
=
self
.
modules
[
'__builtin__'
]
# pipeline creation functions can now be found in Pipeline.py
# pipeline creation functions can now be found in Pipeline.py
...
...
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