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
1cae03c0
Commit
1cae03c0
authored
Jul 15, 2008
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
future division
parent
44a8c73d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
2 deletions
+24
-2
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+1
-1
Cython/Compiler/Future.py
Cython/Compiler/Future.py
+1
-0
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+6
-1
tests/run/future_division.pyx
tests/run/future_division.pyx
+16
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
1cae03c0
...
...
@@ -3133,7 +3133,7 @@ class NumBinopNode(BinopNode):
"+"
:
"PyNumber_Add"
,
"-"
:
"PyNumber_Subtract"
,
"*"
:
"PyNumber_Multiply"
,
"/"
:
"PyNumber_Divide"
,
"/"
:
"
__Pyx_
PyNumber_Divide"
,
"//"
:
"PyNumber_FloorDivide"
,
"%"
:
"PyNumber_Remainder"
,
"**"
:
"PyNumber_Power"
...
...
Cython/Compiler/Future.py
View file @
1cae03c0
...
...
@@ -8,5 +8,6 @@ def _get_feature(name):
unicode_literals
=
_get_feature
(
"unicode_literals"
)
with_statement
=
_get_feature
(
"with_statement"
)
division
=
_get_feature
(
"division"
)
del
_get_feature
Cython/Compiler/ModuleNode.py
View file @
1cae03c0
...
...
@@ -5,6 +5,7 @@
import
os
,
time
from
cStringIO
import
StringIO
from
PyrexTypes
import
CPtrType
import
Future
try
:
set
...
...
@@ -467,8 +468,12 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code
.
putln
(
" #define PyInt_AsSsize_t PyLong_AsSsize_t"
)
code
.
putln
(
" #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask"
)
code
.
putln
(
" #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask"
)
code
.
putln
(
" #define PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)"
)
code
.
putln
(
" #define
__Pyx_
PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)"
)
code
.
putln
(
"#else"
)
if
Future
.
division
in
env
.
context
.
future_directives
:
code
.
putln
(
" #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)"
)
else
:
code
.
putln
(
" #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)"
)
code
.
putln
(
" #define PyBytes_Type PyString_Type"
)
code
.
putln
(
"#endif"
)
...
...
tests/run/future_division.pyx
0 → 100644
View file @
1cae03c0
from
__future__
import
division
__doc__
=
"""
>>> from future_division import doit
>>> doit(1,2)
(0.5, 0)
>>> doit(4,3)
(1.3333333333333333, 1)
>>> doit(4,3.0)
(1.3333333333333333, 1.0)
>>> doit(4,2)
(2.0, 2)
"""
def
doit
(
x
,
y
):
return
x
/
y
,
x
//
y
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