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
51d50168
Commit
51d50168
authored
Feb 26, 2016
by
Marius Wachtler
1
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1115 from undingen/cleanup_1028
Address minor comment from #1028
parents
0535bf7b
0b79eb2d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
9 deletions
+16
-9
src/runtime/float.cpp
src/runtime/float.cpp
+5
-6
src/runtime/str.cpp
src/runtime/str.cpp
+2
-1
test/integration/numpy_test.py
test/integration/numpy_test.py
+6
-2
test/tests/float.py
test/tests/float.py
+1
-0
test/tests/str_functions.py
test/tests/str_functions.py
+2
-0
No files found.
src/runtime/float.cpp
View file @
51d50168
...
...
@@ -929,17 +929,15 @@ template <ExceptionStyle S> Box* floatNew(BoxedClass* _cls, Box* a) noexcept(S =
// Roughly analogous to CPython's float_new.
// The arguments need to be unpacked from args and kwds.
static
Box
*
floatNewPacked
(
BoxedClass
*
type
,
Box
*
args
,
Box
*
kwds
)
noexcept
{
PyObject
*
x
=
False
;
PyObject
*
x
=
False
;
// False is like initalizing it to 0.0 but faster because we don't need to box it in case the
// optional arg exists
static
char
*
kwlist
[
2
]
=
{
NULL
,
NULL
};
kwlist
[
0
]
=
const_cast
<
char
*>
(
"x"
);
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwds
,
"|O:float"
,
kwlist
,
&
x
))
return
NULL
;
if
(
x
==
NULL
)
return
floatNew
<
CAPI
>
(
type
,
None
);
else
return
floatNew
<
CAPI
>
(
type
,
x
);
return
floatNew
<
CAPI
>
(
type
,
x
);
}
PyObject
*
float_str_or_repr
(
double
v
,
int
precision
,
char
format_code
)
{
...
...
@@ -1663,7 +1661,8 @@ void setupFloat() {
float_cls
->
giveAttr
(
"__divmod__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
floatDivmod
,
UNKNOWN
,
2
)));
float_cls
->
giveAttr
(
"__rdivmod__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
floatRDivmod
,
UNKNOWN
,
2
)));
auto
float_new
=
FunctionMetadata
::
create
((
void
*
)
floatNew
<
CXX
>
,
UNKNOWN
,
2
,
false
,
false
,
ParamNames
::
empty
(),
CXX
);
auto
float_new
=
FunctionMetadata
::
create
((
void
*
)
floatNew
<
CXX
>
,
UNKNOWN
,
2
,
false
,
false
,
ParamNames
({
""
,
"x"
},
""
,
""
),
CXX
);
float_new
->
addVersion
((
void
*
)
floatNew
<
CAPI
>
,
UNKNOWN
,
CAPI
);
float_cls
->
giveAttr
(
"__new__"
,
new
BoxedFunction
(
float_new
,
{
boxFloat
(
0.0
)
}));
...
...
src/runtime/str.cpp
View file @
51d50168
...
...
@@ -2921,7 +2921,8 @@ void setupStr() {
str_cls
->
giveAttr
(
md
.
ml_name
,
new
BoxedMethodDescriptor
(
&
md
,
str_cls
));
}
auto
str_new
=
FunctionMetadata
::
create
((
void
*
)
strNew
<
CXX
>
,
UNKNOWN
,
2
,
false
,
false
,
ParamNames
::
empty
(),
CXX
);
auto
str_new
=
FunctionMetadata
::
create
((
void
*
)
strNew
<
CXX
>
,
UNKNOWN
,
2
,
false
,
false
,
ParamNames
({
""
,
"object"
},
""
,
""
),
CXX
);
str_new
->
addVersion
((
void
*
)
strNew
<
CAPI
>
,
UNKNOWN
,
CAPI
);
str_cls
->
giveAttr
(
"__new__"
,
new
BoxedFunction
(
str_new
,
{
EmptyString
}));
...
...
test/integration/numpy_test.py
View file @
51d50168
...
...
@@ -141,7 +141,7 @@ import numpy as np
a = np.array([1, 2**16, 2**32], dtype=int)
s = a.astype(str)
print s
assert repr(s) == "array(['1', '65536', '4294967296'],
\
n
dtype='|S21')"
assert repr(s) == "array(['1', '65536', '4294967296'],
\
\
n dtype='|S21')"
"""
numpy_test
=
"import numpy as np; np.test(verbose=2)"
...
...
@@ -154,7 +154,11 @@ subprocess.check_call([PYTHON_EXE, "-c", mandelbrot], cwd=CYTHON_DIR)
print_progress_header
(
"Running NumPy str test..."
)
subprocess
.
check_call
([
PYTHON_EXE
,
"-c"
,
mandelbrot
],
cwd
=
CYTHON_DIR
)
subprocess
.
check_call
([
PYTHON_EXE
,
"-c"
,
string_test
],
cwd
=
CYTHON_DIR
)
# fails in release mode
#print_progress_header("Running NumPy test_abc.py test...")
#subprocess.check_call([PYTHON_EXE, os.path.join(NUMPY_DIR, "numpy/core/tests/test_abc.py")], cwd=CYTHON_DIR)
print_progress_header
(
"Running NumPy test suite..."
)
# Currently we crash running the test suite. Uncomment for testing or
...
...
test/tests/float.py
View file @
51d50168
...
...
@@ -3,6 +3,7 @@ f = 1.0
print
f
print
float
(
2
)
print
float
(
x
=
2
)
# print f - 2
...
...
test/tests/str_functions.py
View file @
51d50168
...
...
@@ -10,6 +10,8 @@ print repr('"')
# print repr("'") // don't feel like handling this right now; this should print out (verbatim) "'", ie realize it can use double quotes
print
repr
(
"'
\
"
"
)
print
str
(
object
=
"test"
)
print
"hello world
\
t
more
\
n
words
\
v
a
\
f
b
\
a
o"
.
split
()
print
" test "
.
split
()
print
" test "
.
split
(
' '
)
...
...
Boxiang Sun
@Daetalus
mentioned in commit
e7c9df46
·
Sep 08, 2016
mentioned in commit
e7c9df46
mentioned in commit e7c9df46a40eb092867d2611bd7054e485824877
Toggle commit list
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