Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
8165581c
Commit
8165581c
authored
Feb 26, 2016
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit '
eb3b2738
' into refcounting
parents
19db347a
eb3b2738
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
43 additions
and
149 deletions
+43
-149
CMakeLists.txt
CMakeLists.txt
+1
-1
from_cpython/Lib/test/test_decimal.py
from_cpython/Lib/test/test_decimal.py
+16
-43
src/codegen/runtime_hooks.cpp
src/codegen/runtime_hooks.cpp
+0
-1
src/codegen/runtime_hooks.h
src/codegen/runtime_hooks.h
+1
-1
src/runtime/float.cpp
src/runtime/float.cpp
+2
-84
src/runtime/float.h
src/runtime/float.h
+0
-2
src/runtime/inline/link_forcer.cpp
src/runtime/inline/link_forcer.cpp
+0
-1
src/runtime/long.cpp
src/runtime/long.cpp
+4
-4
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+8
-3
src/runtime/types.h
src/runtime/types.h
+0
-1
test/CPYTHON_TEST_NOTES.md
test/CPYTHON_TEST_NOTES.md
+0
-1
test/cpython/decimaltestdata
test/cpython/decimaltestdata
+1
-0
test/tests/float.py
test/tests/float.py
+8
-5
test/tests/long.py
test/tests/long.py
+2
-2
No files found.
CMakeLists.txt
View file @
8165581c
...
@@ -316,7 +316,7 @@ add_pyston_test(force_llvm tests -a=-n -a=-X -t50)
...
@@ -316,7 +316,7 @@ add_pyston_test(force_llvm tests -a=-n -a=-X -t50)
if
(
${
CMAKE_BUILD_TYPE
}
STREQUAL
"Release"
)
if
(
${
CMAKE_BUILD_TYPE
}
STREQUAL
"Release"
)
add_pyston_test
(
max_compilation_tier tests -a=-O -a=-X -t50
)
add_pyston_test
(
max_compilation_tier tests -a=-O -a=-X -t50
)
endif
()
endif
()
add_pyston_test
(
defaults cpython --exit-code-only --skip-failing -t
5
0
)
add_pyston_test
(
defaults cpython --exit-code-only --skip-failing -t
10
0
)
add_pyston_test
(
defaults integration --exit-code-only --skip-failing -t600
)
add_pyston_test
(
defaults integration --exit-code-only --skip-failing -t600
)
if
(
ENABLE_EXTRA_TESTS
)
if
(
ENABLE_EXTRA_TESTS
)
add_pyston_test
(
defaults extra -t600 --exit-code-only
)
add_pyston_test
(
defaults extra -t600 --exit-code-only
)
...
...
from_cpython/Lib/test/test_decimal.py
View file @
8165581c
# expected: fail
# Copyright (c) 2004 Python Software Foundation.
# Copyright (c) 2004 Python Software Foundation.
# All rights reserved.
# All rights reserved.
...
@@ -32,9 +31,8 @@ import pickle, copy
...
@@ -32,9 +31,8 @@ import pickle, copy
import
unittest
import
unittest
from
decimal
import
*
from
decimal
import
*
import
numbers
import
numbers
from
test.test_support
import
(
run_unittest
,
run_doctest
,
requires_unicode
,
u
,
from
test.test_support
import
(
run_unittest
,
run_doctest
,
is_resource_enabled
,
check_py3k_warnings
,
is_resource_enabled
,
check_py3k_warnings
)
run_with_locale
)
import
random
import
random
try
:
try
:
import
threading
import
threading
...
@@ -597,12 +595,11 @@ class DecimalExplicitConstructionTest(unittest.TestCase):
...
@@ -597,12 +595,11 @@ class DecimalExplicitConstructionTest(unittest.TestCase):
d
=
nc
.
create_decimal
(
prevdec
)
d
=
nc
.
create_decimal
(
prevdec
)
self
.
assertEqual
(
str
(
d
),
'5.00E+8'
)
self
.
assertEqual
(
str
(
d
),
'5.00E+8'
)
@
requires_unicode
def
test_unicode_digits
(
self
):
def
test_unicode_digits
(
self
):
test_values
=
{
test_values
=
{
u
(
r'\uff11'
)
:
'1'
,
u
'
\
uff11
'
:
'1'
,
u
(
r'\u0660.\u0660\u0663\u0667\u0662e-\u0663'
)
:
'0.0000372'
,
u
'
\
u0660
.
\
u0660
\
u0663
\
u0667
\
u0662
e-
\
u0663
'
:
'0.0000372'
,
u
(
r'-nan\u0c68\u0c6a\u0c66\u0c66'
)
:
'-NaN2400'
,
u
'-nan
\
u0c68
\
u0c6a
\
u0c66
\
u0c66
'
:
'-NaN2400'
,
}
}
for
input
,
expected
in
test_values
.
items
():
for
input
,
expected
in
test_values
.
items
():
self
.
assertEqual
(
str
(
Decimal
(
input
)),
expected
)
self
.
assertEqual
(
str
(
Decimal
(
input
)),
expected
)
...
@@ -826,11 +823,6 @@ class DecimalFormatTest(unittest.TestCase):
...
@@ -826,11 +823,6 @@ class DecimalFormatTest(unittest.TestCase):
# issue 6850
# issue 6850
(
'a=-7.0'
,
'0.12345'
,
'aaaa0.1'
),
(
'a=-7.0'
,
'0.12345'
,
'aaaa0.1'
),
# issue 22090
(
'<^+15.20%'
,
'inf'
,
'<<+Infinity%<<<'
),
(
'
\
x07
>,%'
,
'sNaN1234567'
,
'sNaN1234567%'
),
(
'=10.10%'
,
'NaN123'
,
' NaN123%'
),
]
]
for
fmt
,
d
,
result
in
test_values
:
for
fmt
,
d
,
result
in
test_values
:
self
.
assertEqual
(
format
(
Decimal
(
d
),
fmt
),
result
)
self
.
assertEqual
(
format
(
Decimal
(
d
),
fmt
),
result
)
...
@@ -907,23 +899,6 @@ class DecimalFormatTest(unittest.TestCase):
...
@@ -907,23 +899,6 @@ class DecimalFormatTest(unittest.TestCase):
self
.
assertEqual
(
get_fmt
(
123456
,
crazy
,
'012n'
),
'00-01-2345-6'
)
self
.
assertEqual
(
get_fmt
(
123456
,
crazy
,
'012n'
),
'00-01-2345-6'
)
self
.
assertEqual
(
get_fmt
(
123456
,
crazy
,
'013n'
),
'000-01-2345-6'
)
self
.
assertEqual
(
get_fmt
(
123456
,
crazy
,
'013n'
),
'000-01-2345-6'
)
@
run_with_locale
(
'LC_ALL'
,
'ps_AF.UTF-8'
)
def
test_wide_char_separator_decimal_point
(
self
):
# locale with wide char separator and decimal point
import
locale
decimal_point
=
locale
.
localeconv
()[
'decimal_point'
]
thousands_sep
=
locale
.
localeconv
()[
'thousands_sep'
]
if
decimal_point
!=
'
\
xd9
\
xab
'
:
self
.
skipTest
(
'inappropriate decimal point separator'
'({!r} not {!r})'
.
format
(
decimal_point
,
'
\
xd9
\
xab
'
))
if
thousands_sep
!=
'
\
xd9
\
xac
'
:
self
.
skipTest
(
'inappropriate thousands separator'
'({!r} not {!r})'
.
format
(
thousands_sep
,
'
\
xd9
\
xac
'
))
self
.
assertEqual
(
format
(
Decimal
(
'100000000.123'
),
'n'
),
'100
\
xd9
\
xac
000
\
xd9
\
xac
000
\
xd9
\
xab
123'
)
class
DecimalArithmeticOperatorsTest
(
unittest
.
TestCase
):
class
DecimalArithmeticOperatorsTest
(
unittest
.
TestCase
):
'''Unit tests for all arithmetic operators, binary and unary.'''
'''Unit tests for all arithmetic operators, binary and unary.'''
...
@@ -1683,10 +1658,9 @@ class DecimalPythonAPItests(unittest.TestCase):
...
@@ -1683,10 +1658,9 @@ class DecimalPythonAPItests(unittest.TestCase):
def
test_pickle
(
self
):
def
test_pickle
(
self
):
d
=
Decimal
(
'-3.141590000'
)
d
=
Decimal
(
'-3.141590000'
)
for
proto
in
range
(
pickle
.
HIGHEST_PROTOCOL
+
1
):
p
=
pickle
.
dumps
(
d
)
p
=
pickle
.
dumps
(
d
,
proto
)
e
=
pickle
.
loads
(
p
)
e
=
pickle
.
loads
(
p
)
self
.
assertEqual
(
d
,
e
)
self
.
assertEqual
(
d
,
e
)
def
test_int
(
self
):
def
test_int
(
self
):
for
x
in
range
(
-
250
,
250
):
for
x
in
range
(
-
250
,
250
):
...
@@ -1770,13 +1744,12 @@ class DecimalPythonAPItests(unittest.TestCase):
...
@@ -1770,13 +1744,12 @@ class DecimalPythonAPItests(unittest.TestCase):
class
ContextAPItests
(
unittest
.
TestCase
):
class
ContextAPItests
(
unittest
.
TestCase
):
def
test_pickle
(
self
):
def
test_pickle
(
self
):
for
proto
in
range
(
pickle
.
HIGHEST_PROTOCOL
+
1
):
c
=
Context
()
c
=
Context
()
e
=
pickle
.
loads
(
pickle
.
dumps
(
c
))
e
=
pickle
.
loads
(
pickle
.
dumps
(
c
,
proto
))
for
k
in
vars
(
c
):
for
k
in
vars
(
c
):
v1
=
vars
(
c
)[
k
]
v1
=
vars
(
c
)[
k
]
v2
=
vars
(
e
)[
k
]
v2
=
vars
(
e
)[
k
]
self
.
assertEqual
(
v1
,
v2
)
self
.
assertEqual
(
v1
,
v2
)
def
test_equality_with_other_types
(
self
):
def
test_equality_with_other_types
(
self
):
self
.
assertIn
(
Decimal
(
10
),
[
'a'
,
1.0
,
Decimal
(
10
),
(
1
,
2
),
{}])
self
.
assertIn
(
Decimal
(
10
),
[
'a'
,
1.0
,
Decimal
(
10
),
(
1
,
2
),
{}])
...
@@ -2298,7 +2271,7 @@ class ContextFlags(unittest.TestCase):
...
@@ -2298,7 +2271,7 @@ class ContextFlags(unittest.TestCase):
"operation raises different flags depending on flags set: "
+
"operation raises different flags depending on flags set: "
+
"expected %s, got %s"
%
(
expected_flags
,
new_flags
))
"expected %s, got %s"
%
(
expected_flags
,
new_flags
))
def
test_main
(
arith
=
Non
e
,
verbose
=
None
,
todo_tests
=
None
,
debug
=
None
):
def
test_main
(
arith
=
Fals
e
,
verbose
=
None
,
todo_tests
=
None
,
debug
=
None
):
""" Execute the tests.
""" Execute the tests.
Runs all arithmetic tests if arith is True or if the "decimal" resource
Runs all arithmetic tests if arith is True or if the "decimal" resource
...
@@ -2307,7 +2280,7 @@ def test_main(arith=None, verbose=None, todo_tests=None, debug=None):
...
@@ -2307,7 +2280,7 @@ def test_main(arith=None, verbose=None, todo_tests=None, debug=None):
init
()
init
()
global
TEST_ALL
,
DEBUG
global
TEST_ALL
,
DEBUG
TEST_ALL
=
arith
if
arith
is
not
None
else
is_resource_enabled
(
'decimal'
)
TEST_ALL
=
arith
or
is_resource_enabled
(
'decimal'
)
DEBUG
=
debug
DEBUG
=
debug
if
todo_tests
is
None
:
if
todo_tests
is
None
:
...
...
src/codegen/runtime_hooks.cpp
View file @
8165581c
...
@@ -241,7 +241,6 @@ void initGlobalFuncs(GlobalState& g) {
...
@@ -241,7 +241,6 @@ void initGlobalFuncs(GlobalState& g) {
GET
(
printExprHelper
);
GET
(
printExprHelper
);
GET
(
printHelper
);
GET
(
printHelper
);
GET
(
printFloat
);
GET
(
listAppendInternal
);
GET
(
listAppendInternal
);
GET
(
getSysStdout
);
GET
(
getSysStdout
);
...
...
src/codegen/runtime_hooks.h
View file @
8165581c
...
@@ -42,7 +42,7 @@ struct GlobalFuncs {
...
@@ -42,7 +42,7 @@ struct GlobalFuncs {
llvm
::
Value
*
unpackIntoArray
,
*
raiseAttributeError
,
*
raiseAttributeErrorStr
,
*
raiseAttributeErrorCapi
,
llvm
::
Value
*
unpackIntoArray
,
*
raiseAttributeError
,
*
raiseAttributeErrorStr
,
*
raiseAttributeErrorCapi
,
*
raiseAttributeErrorStrCapi
,
*
raiseNotIterableError
,
*
raiseIndexErrorStr
,
*
raiseIndexErrorStrCapi
,
*
raiseAttributeErrorStrCapi
,
*
raiseNotIterableError
,
*
raiseIndexErrorStr
,
*
raiseIndexErrorStrCapi
,
*
assertNameDefined
,
*
assertFail
,
*
assertFailDerefNameDefined
,
*
printExprHelper
,
*
printHelper
;
*
assertNameDefined
,
*
assertFail
,
*
assertFailDerefNameDefined
,
*
printExprHelper
,
*
printHelper
;
llvm
::
Value
*
printFloat
,
*
listAppendInternal
,
*
getSysStdout
;
llvm
::
Value
*
listAppendInternal
,
*
getSysStdout
;
ExceptionSwitchable
<
llvm
::
Value
*>
runtimeCall0
,
runtimeCall1
,
runtimeCall2
,
runtimeCall3
,
runtimeCall
,
runtimeCallN
;
ExceptionSwitchable
<
llvm
::
Value
*>
runtimeCall0
,
runtimeCall1
,
runtimeCall2
,
runtimeCall3
,
runtimeCall
,
runtimeCallN
;
ExceptionSwitchable
<
llvm
::
Value
*>
callattr0
,
callattr1
,
callattr2
,
callattr3
,
callattr
,
callattrN
;
ExceptionSwitchable
<
llvm
::
Value
*>
callattr0
,
callattr1
,
callattr2
,
callattr3
,
callattr
,
callattrN
;
llvm
::
Value
*
reoptCompiledFunc
,
*
compilePartialFunc
;
llvm
::
Value
*
reoptCompiledFunc
,
*
compilePartialFunc
;
...
...
src/runtime/float.cpp
View file @
8165581c
...
@@ -838,82 +838,6 @@ Box* floatNonzero(BoxedFloat* self) {
...
@@ -838,82 +838,6 @@ Box* floatNonzero(BoxedFloat* self) {
return
boxBool
(
floatNonzeroUnboxed
(
self
));
return
boxBool
(
floatNonzeroUnboxed
(
self
));
}
}
std
::
string
floatFmt
(
double
x
,
int
precision
,
char
code
)
{
char
fmt
[
5
]
=
"%.*g"
;
fmt
[
3
]
=
code
;
if
(
isnan
(
x
))
{
return
"nan"
;
}
if
(
isinf
(
x
))
{
if
(
x
>
0
)
return
"inf"
;
return
"-inf"
;
}
char
buf
[
40
];
int
n
=
snprintf
(
buf
,
40
,
fmt
,
precision
,
x
);
int
dot
=
-
1
;
int
exp
=
-
1
;
int
first
=
-
1
;
for
(
int
i
=
0
;
i
<
n
;
i
++
)
{
char
c
=
buf
[
i
];
if
(
c
==
'.'
)
{
dot
=
i
;
}
else
if
(
c
==
'e'
)
{
exp
=
i
;
}
else
if
(
first
==
-
1
&&
c
>=
'0'
&&
c
<=
'9'
)
{
first
=
i
;
}
}
if
(
dot
==
-
1
&&
exp
==
-
1
)
{
if
(
n
==
precision
)
{
memmove
(
buf
+
first
+
2
,
buf
+
first
+
1
,
(
n
-
first
-
1
));
buf
[
first
+
1
]
=
'.'
;
exp
=
n
+
1
;
int
exp_digs
=
snprintf
(
buf
+
n
+
1
,
5
,
"e%+.02d"
,
(
n
-
first
-
1
));
n
+=
exp_digs
+
1
;
dot
=
1
;
}
else
{
buf
[
n
]
=
'.'
;
buf
[
n
+
1
]
=
'0'
;
n
+=
2
;
return
std
::
string
(
buf
,
n
);
}
}
if
(
exp
!=
-
1
&&
dot
==
-
1
)
{
return
std
::
string
(
buf
,
n
);
}
assert
(
dot
!=
-
1
);
int
start
,
end
;
if
(
exp
)
{
start
=
exp
-
1
;
end
=
dot
;
}
else
{
start
=
n
-
1
;
end
=
dot
+
2
;
}
for
(
int
i
=
start
;
i
>=
end
;
i
--
)
{
if
(
buf
[
i
]
==
'0'
)
{
memmove
(
buf
+
i
,
buf
+
i
+
1
,
n
-
i
-
1
);
n
--
;
}
else
if
(
buf
[
i
]
==
'.'
)
{
memmove
(
buf
+
i
,
buf
+
i
+
1
,
n
-
i
-
1
);
n
--
;
break
;
}
else
{
break
;
}
}
return
std
::
string
(
buf
,
n
);
}
template
<
ExceptionStyle
S
>
static
BoxedFloat
*
_floatNew
(
Box
*
a
)
noexcept
(
S
==
CAPI
)
{
template
<
ExceptionStyle
S
>
static
BoxedFloat
*
_floatNew
(
Box
*
a
)
noexcept
(
S
==
CAPI
)
{
if
(
a
->
cls
==
float_cls
)
{
if
(
a
->
cls
==
float_cls
)
{
return
static_cast
<
BoxedFloat
*>
(
a
);
return
static_cast
<
BoxedFloat
*>
(
a
);
...
@@ -951,11 +875,10 @@ template <ExceptionStyle S> static BoxedFloat* _floatNew(Box* a) noexcept(S == C
...
@@ -951,11 +875,10 @@ template <ExceptionStyle S> static BoxedFloat* _floatNew(Box* a) noexcept(S == C
if
(
!
r
)
{
if
(
!
r
)
{
if
(
S
==
CAPI
)
{
if
(
S
==
CAPI
)
{
if
(
!
PyErr_Occurred
())
if
(
!
PyErr_Occurred
())
PyErr_Format
(
TypeError
,
"float() argument must be a string or a number, not '%s'
\n
"
,
PyErr_SetString
(
PyExc_TypeError
,
"float() argument must be a string or a number"
);
getTypeName
(
a
));
return
NULL
;
return
NULL
;
}
else
{
}
else
{
raiseExcHelper
(
TypeError
,
"float() argument must be a string or a number
, not '%s'
\n
"
,
getTypeName
(
a
)
);
raiseExcHelper
(
TypeError
,
"float() argument must be a string or a number
"
);
}
}
}
}
...
@@ -1108,11 +1031,6 @@ Box* floatHash(BoxedFloat* self) {
...
@@ -1108,11 +1031,6 @@ Box* floatHash(BoxedFloat* self) {
return
boxInt
(
_Py_HashDouble
(
self
->
d
));
return
boxInt
(
_Py_HashDouble
(
self
->
d
));
}
}
extern
"C"
void
printFloat
(
double
d
)
{
std
::
string
s
=
floatFmt
(
d
,
12
,
'g'
);
printf
(
"%s"
,
s
.
c_str
());
}
static
void
_addFunc
(
const
char
*
name
,
ConcreteCompilerType
*
rtn_type
,
void
*
float_func
,
void
*
int_func
,
static
void
_addFunc
(
const
char
*
name
,
ConcreteCompilerType
*
rtn_type
,
void
*
float_func
,
void
*
int_func
,
void
*
boxed_func
)
{
void
*
boxed_func
)
{
std
::
vector
<
ConcreteCompilerType
*>
v_ff
,
v_fi
,
v_uu
;
std
::
vector
<
ConcreteCompilerType
*>
v_ff
,
v_fi
,
v_uu
;
...
...
src/runtime/float.h
View file @
8165581c
...
@@ -24,8 +24,6 @@ extern "C" double pow_float_float(double lhs, double rhs);
...
@@ -24,8 +24,6 @@ extern "C" double pow_float_float(double lhs, double rhs);
class
BoxedFloat
;
class
BoxedFloat
;
bool
floatNonzeroUnboxed
(
BoxedFloat
*
self
);
bool
floatNonzeroUnboxed
(
BoxedFloat
*
self
);
std
::
string
floatFmt
(
double
x
,
int
precision
,
char
code
);
}
}
#endif
#endif
src/runtime/inline/link_forcer.cpp
View file @
8165581c
...
@@ -116,7 +116,6 @@ void force() {
...
@@ -116,7 +116,6 @@ void force() {
FORCE
(
printExprHelper
);
FORCE
(
printExprHelper
);
FORCE
(
printHelper
);
FORCE
(
printHelper
);
FORCE
(
printFloat
);
FORCE
(
listAppendInternal
);
FORCE
(
listAppendInternal
);
FORCE
(
getSysStdout
);
FORCE
(
getSysStdout
);
...
...
src/runtime/long.cpp
View file @
8165581c
...
@@ -658,7 +658,7 @@ template <ExceptionStyle S> Box* _longNew(Box* val, Box* _base) noexcept(S == CA
...
@@ -658,7 +658,7 @@ template <ExceptionStyle S> Box* _longNew(Box* val, Box* _base) noexcept(S == CA
return
NULL
;
return
NULL
;
}
}
if
(
val
==
N
one
)
{
if
(
val
==
N
ULL
)
{
PyErr_SetString
(
PyExc_TypeError
,
"long() missing string argument"
);
PyErr_SetString
(
PyExc_TypeError
,
"long() missing string argument"
);
return
NULL
;
return
NULL
;
}
}
...
@@ -671,7 +671,7 @@ template <ExceptionStyle S> Box* _longNew(Box* val, Box* _base) noexcept(S == CA
...
@@ -671,7 +671,7 @@ template <ExceptionStyle S> Box* _longNew(Box* val, Box* _base) noexcept(S == CA
if
(
!
PyInt_Check
(
_base
))
if
(
!
PyInt_Check
(
_base
))
raiseExcHelper
(
TypeError
,
"integer argument expected, got %s"
,
getTypeName
(
_base
));
raiseExcHelper
(
TypeError
,
"integer argument expected, got %s"
,
getTypeName
(
_base
));
if
(
val
==
N
one
)
if
(
val
==
N
ULL
)
raiseExcHelper
(
TypeError
,
"long() missing string argument"
);
raiseExcHelper
(
TypeError
,
"long() missing string argument"
);
if
(
!
PyString_Check
(
val
)
&&
!
PyUnicode_Check
(
val
))
if
(
!
PyString_Check
(
val
)
&&
!
PyUnicode_Check
(
val
))
...
@@ -679,7 +679,7 @@ template <ExceptionStyle S> Box* _longNew(Box* val, Box* _base) noexcept(S == CA
...
@@ -679,7 +679,7 @@ template <ExceptionStyle S> Box* _longNew(Box* val, Box* _base) noexcept(S == CA
}
}
base
=
static_cast
<
BoxedInt
*>
(
_base
)
->
n
;
base
=
static_cast
<
BoxedInt
*>
(
_base
)
->
n
;
}
else
{
}
else
{
if
(
val
==
N
one
)
if
(
val
==
N
ULL
)
return
PyLong_FromLong
(
0L
);
return
PyLong_FromLong
(
0L
);
Box
*
r
=
PyNumber_Long
(
val
);
Box
*
r
=
PyNumber_Long
(
val
);
...
@@ -1642,7 +1642,7 @@ void setupLong() {
...
@@ -1642,7 +1642,7 @@ void setupLong() {
auto
long_new
=
FunctionMetadata
::
create
((
void
*
)
longNew
<
CXX
>
,
UNKNOWN
,
3
,
false
,
false
,
auto
long_new
=
FunctionMetadata
::
create
((
void
*
)
longNew
<
CXX
>
,
UNKNOWN
,
3
,
false
,
false
,
ParamNames
({
""
,
"x"
,
"base"
},
""
,
""
),
CXX
);
ParamNames
({
""
,
"x"
,
"base"
},
""
,
""
),
CXX
);
long_new
->
addVersion
((
void
*
)
longNew
<
CAPI
>
,
UNKNOWN
,
CAPI
);
long_new
->
addVersion
((
void
*
)
longNew
<
CAPI
>
,
UNKNOWN
,
CAPI
);
long_cls
->
giveAttr
(
"__new__"
,
new
BoxedFunction
(
long_new
,
{
autoDecref
(
boxInt
(
0
))
,
NULL
}));
long_cls
->
giveAttr
(
"__new__"
,
new
BoxedFunction
(
long_new
,
{
NULL
,
NULL
}));
long_cls
->
giveAttr
(
"__mul__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
longMul
,
UNKNOWN
,
2
)));
long_cls
->
giveAttr
(
"__mul__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
longMul
,
UNKNOWN
,
2
)));
long_cls
->
giveAttr
(
"__rmul__"
,
incref
(
long_cls
->
getattr
(
autoDecref
(
internStringMortal
(
"__mul__"
)))));
long_cls
->
giveAttr
(
"__rmul__"
,
incref
(
long_cls
->
getattr
(
autoDecref
(
internStringMortal
(
"__mul__"
)))));
...
...
src/runtime/objmodel.cpp
View file @
8165581c
...
@@ -2590,9 +2590,14 @@ template <ExceptionStyle S> Box* _getattrEntry(Box* obj, BoxedString* attr, void
...
@@ -2590,9 +2590,14 @@ template <ExceptionStyle S> Box* _getattrEntry(Box* obj, BoxedString* attr, void
->
setType
(
RefType
::
BORROWED
)
->
setType
(
RefType
::
BORROWED
)
->
setNullable
(
true
);
->
setNullable
(
true
);
}
}
rewriter
->
call
(
true
,
(
void
*
)
NoexcHelper
::
call
,
rtn
,
rewriter
->
getArg
(
0
),
if
(
S
==
CXX
&&
return_convention
==
ReturnConvention
::
CAPI_RETURN
)
{
rewriter
->
loadConst
((
intptr_t
)
attr
,
Location
::
forArg
(
2
)));
rewriter
->
checkAndThrowCAPIException
(
rtn
);
return_convention
=
(
S
==
CXX
)
?
ReturnConvention
::
HAS_RETURN
:
ReturnConvention
::
CAPI_RETURN
;
return_convention
=
ReturnConvention
::
HAS_RETURN
;
}
else
{
rewriter
->
call
(
true
,
(
void
*
)
NoexcHelper
::
call
,
rtn
,
rewriter
->
getArg
(
0
),
rewriter
->
loadConst
((
intptr_t
)
attr
,
Location
::
forArg
(
2
)));
return_convention
=
(
S
==
CXX
)
?
ReturnConvention
::
HAS_RETURN
:
ReturnConvention
::
CAPI_RETURN
;
}
}
}
}
}
...
...
src/runtime/types.h
View file @
8165581c
...
@@ -162,7 +162,6 @@ extern "C" Box* createDict();
...
@@ -162,7 +162,6 @@ extern "C" Box* createDict();
extern
"C"
Box
*
createList
();
extern
"C"
Box
*
createList
();
extern
"C"
Box
*
createSlice
(
Box
*
start
,
Box
*
stop
,
Box
*
step
);
extern
"C"
Box
*
createSlice
(
Box
*
start
,
Box
*
stop
,
Box
*
step
);
extern
"C"
Box
*
createTuple
(
int64_t
nelts
,
Box
**
elts
);
extern
"C"
Box
*
createTuple
(
int64_t
nelts
,
Box
**
elts
);
extern
"C"
void
printFloat
(
double
d
);
Box
*
objectStr
(
Box
*
);
Box
*
objectStr
(
Box
*
);
Box
*
objectRepr
(
Box
*
);
Box
*
objectRepr
(
Box
*
);
...
...
test/CPYTHON_TEST_NOTES.md
View file @
8165581c
...
@@ -73,7 +73,6 @@ test_ctypes [unknown]
...
@@ -73,7 +73,6 @@ test_ctypes [unknown]
test_curses [unknown]
test_curses [unknown]
test_datetime needs _PyObject_GetDictPtr
test_datetime needs _PyObject_GetDictPtr
test_dbm [unknown]
test_dbm [unknown]
test_decimal I think we need to copy decimaltestdata from cpython
test_decorators decorator bug -- we evaluate decorator obj and its args in wrong order
test_decorators decorator bug -- we evaluate decorator obj and its args in wrong order
test_deque couple unknown issues
test_deque couple unknown issues
test_descrtut `exec in DefaultDict()`
test_descrtut `exec in DefaultDict()`
...
...
test/cpython/decimaltestdata
0 → 120000
View file @
8165581c
../../from_cpython/Lib/test/decimaltestdata
\ No newline at end of file
test/tests/float.py
View file @
8165581c
...
@@ -37,11 +37,14 @@ print type(F2(D(F())))
...
@@ -37,11 +37,14 @@ print type(F2(D(F())))
print
type
(
float
(
F
()))
print
type
(
float
(
F
()))
try
:
for
a
in
[
"hello world"
,
None
]:
f
=
float
(
"hello world"
)
try
:
print
f
f
=
float
(
a
)
except
ValueError
as
e
:
print
f
print
e
except
ValueError
as
e
:
print
"ValueError"
,
e
except
TypeError
as
e
:
print
"TypeError"
,
e
try
:
try
:
f
=
float
(
"5 hello world"
)
f
=
float
(
"5 hello world"
)
...
...
test/tests/long.py
View file @
8165581c
...
@@ -125,11 +125,11 @@ print type(+long.__new__(C, 5L))
...
@@ -125,11 +125,11 @@ print type(+long.__new__(C, 5L))
print
((
0L
).
bit_length
())
print
((
0L
).
bit_length
())
values
=
[
'inf'
,
'-inf'
,
'nan'
]
values
=
[
float
(
'inf'
),
float
(
'-inf'
),
float
(
'nan'
),
None
]
for
v
in
values
:
for
v
in
values
:
try
:
try
:
long
(
float
(
v
)
)
long
(
v
)
except
Exception
as
e
:
except
Exception
as
e
:
print
(
e
.
message
)
print
(
e
.
message
)
...
...
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