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
ef4807e6
Commit
ef4807e6
authored
May 19, 2016
by
Boxiang Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update numpy test
clone numpy with 1.11.0 tag from github, and adjust the numpy test file.
parent
d9659bc9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
144 deletions
+40
-144
test/integration/numpy_patch.patch
test/integration/numpy_patch.patch
+15
-130
test/integration/numpy_test.py
test/integration/numpy_test.py
+25
-14
No files found.
test/integration/numpy_patch.patch
View file @
ef4807e6
diff --git a/numpy/core/src/multiarray/compiled_base.c b/numpy/core/src/multiarray/compiled_base.c
index
8ffeeda..5d43aab
100644
index
b9db3bb..2d24efc
100644
--- a/numpy/core/src/multiarray/compiled_base.c
+++ b/numpy/core/src/multiarray/compiled_base.c
@@ -133
6,13 +1336
,13 @@
arr_add_docstring(PyObject *NPY_UNUSED(dummy), PyObject *args)
@@ -133
7,13 +1337
,13 @@
arr_add_docstring(PyObject *NPY_UNUSED(dummy), PyObject *args)
_ADDDOC(Type, new->tp_doc, new->tp_name);
}
else if (_TESTDOC2(MemberDescr)) {
- _ADDDOC(MemberDescr, new->d_member->doc, new->d_member->name);
+ /
/_ADDDOC(MemberDescr, new->d_member->doc, new->d_member->name);
+ /
* _ADDDOC(MemberDescr, new->d_member->doc, new->d_member->name); */
}
else if (_TESTDOC2(GetSetDescr)) {
- _ADDDOC(GetSetDescr, new->d_getset->doc, new->d_getset->name);
+ /
/_ADDDOC(GetSetDescr, new->d_getset->doc, new->d_getset->name);
+ /
* _ADDDOC(GetSetDescr, new->d_getset->doc, new->d_getset->name); */
}
else if (_TESTDOC2(MethodDescr)) {
- _ADDDOC(MethodDescr, new->d_method->ml_doc, new->d_method->ml_name);
+ /
/_ADDDOC(MethodDescr, new->d_method->ml_doc, new->d_method->ml_name);
+ /
* _ADDDOC(MethodDescr, new->d_method->ml_doc, new->d_method->ml_name); */
}
else {
PyObject *doc_attr;
diff --git a/numpy/core/src/multiarray/descriptor.c b/numpy/core/src/multiarray/descriptor.c
index d025901..27c8718 100644
--- a/numpy/core/src/multiarray/descriptor.c
+++ b/numpy/core/src/multiarray/descriptor.c
@@ -1051,6 +1051,11 @@
_convert_from_dict(PyObject *obj, int align)
"with align=True",
(int)offset, (int)newdescr->alignment);
ret = NPY_FAIL;
+
+ // Pyston change: we don't deal well with execution continuing
+ // after an exception has been set. Subsequent calls to GetItem and
+ // such happen with the exception set (PyErr_Occurred() == true).
+ goto fail;
}
else if (offset + newdescr->elsize > totalsize) {
totalsize = offset + newdescr->elsize;
@@ -1079,6 +1084,11 @@
_convert_from_dict(PyObject *obj, int align)
PyErr_SetString(PyExc_ValueError,
"field names must be strings");
ret = NPY_FAIL;
+
+ // Pyston change: we don't deal well with execution continuing
+ // after an exception has been set. Subsequent calls to GetItem and
+ // such happen with the exception set (PyErr_Occurred() == true).
+ goto fail;
}
/* Insert into dictionary */
@@ -1086,6 +1096,11 @@
_convert_from_dict(PyObject *obj, int align)
PyErr_SetString(PyExc_ValueError,
"name already used as a name or title");
ret = NPY_FAIL;
+
+ // Pyston change: we don't deal well with execution continuing
+ // after an exception has been set. Subsequent calls to GetItem and
+ // such happen with the exception set (PyErr_Occurred() == true).
+ goto fail;
}
PyDict_SetItem(fields, name, tup);
Py_DECREF(name);
@@ -1099,6 +1114,11 @@
_convert_from_dict(PyObject *obj, int align)
PyErr_SetString(PyExc_ValueError,
"title already used as a name or title.");
ret=NPY_FAIL;
+
+ // Pyston change: we don't deal well with execution continuing
+ // after an exception has been set. Subsequent calls to GetItem and
+ // such happen with the exception set (PyErr_Occurred() == true).
+ goto fail;
}
PyDict_SetItem(fields, title, tup);
}
diff --git a/numpy/core/tests/test_records.py b/numpy/core/tests/test_records.py
index 7a18f29..a8d4e4b 100644
--- a/numpy/core/tests/test_records.py
+++ b/numpy/core/tests/test_records.py
@@ -12,7 +12,7 @@
from numpy.testing import (
assert_array_almost_equal, assert_raises
diff --git a/setup.py b/setup.py
index cc8f3c1..d3f89f6 100755
--- a/setup.py
+++ b/setup.py
@@ -352,6 +352,7 @@
def setup_package():
platforms = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"],
test_suite='nose.collector',
cmdclass={"sdist": sdist_checked},
+ zip_safe=False,
)
-
+"""
class TestFromrecords(TestCase):
def test_fromrecords(self):
r = np.rec.fromrecords([[456, 'dbe', 1.2], [2, 'de', 1.3]],
@@ -294,6 +294,6 @@
def test_find_duplicate():
l3 = [2, 2, 1, 4, 1, 6, 2, 3]
assert_(np.rec.find_duplicate(l3) == [2, 1])
-
+"""
if __name__ == "__main__":
run_module_suite()
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py
index f4ce678..56f5cd9 100644
--- a/numpy/lib/tests/test_io.py
+++ b/numpy/lib/tests/test_io.py
@@ -885,7 +885,8 @@
class Testfromregex(TestCase):
#####--------------------------------------------------------------------------
-
+# Pyston: these don't work, segfault, not sure why
+"""
class TestFromTxt(TestCase):
#
def test_record(self):
@@ -1822,6 +1823,7 @@
M 33 21.99
assert_allclose(test['f0'], 73786976294838206464.)
assert_equal(test['f1'], 17179869184)
assert_equal(test['f2'], 1024)
+"""
def test_gzip_load():
a = np.random.random((5, 5))
diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py
index d3ec704..d68ffb0 100644
--- a/numpy/ma/tests/test_core.py
+++ b/numpy/ma/tests/test_core.py
@@ -1433,7 +1433,12 @@
class TestMaskedArrayAttributes(TestCase):
def assign():
m = np.ma.array(a)
m.dtype = np.dtype('f8')
- assert_raises(ValueError, assign)
+
+ # Pyston: Some weirdness here with a jitted frame calling a C function
+# that raises an exception in C-style, and the exception is still set as we
+# return from the jitted function, causing an assertion to be triggered. Also,
+# this happens with a with context catching the exception and stuff. I have no idea.
+#assert_raises(ValueError, assign)
b = a.view(dtype='f4', type=np.ma.MaskedArray) # raises?
assert_equal(b.dtype, np.dtype('f4'))
diff --git a/numpy/ma/tests/test_regression.py b/numpy/ma/tests/test_regression.py
index dba74d3..23cfeed 100644
--- a/numpy/ma/tests/test_regression.py
+++ b/numpy/ma/tests/test_regression.py
@@ -35,7 +35,8 @@
class TestRegression(TestCase):
a[2, 0] = np.ma.masked
b = np.zeros((4, 2))
a*b
- b*a
+ # Pyston: commented out for now, causes assertion to be triggered.
+ # b*a
def test_masked_array_repeat(self, level=rlevel):
# Ticket #271
if "--force" in sys.argv:
test/integration/numpy_test.py
View file @
ef4807e6
...
...
@@ -60,7 +60,7 @@ if not os.path.exists(ENV_NAME) or os.stat(sys.executable).st_mtime > os.stat(EN
SRC_DIR
=
ENV_NAME
PYTHON_EXE
=
os
.
path
.
abspath
(
ENV_NAME
+
"/bin/python"
)
CYTHON_DIR
=
os
.
path
.
abspath
(
os
.
path
.
join
(
SRC_DIR
,
"Cython-0.22"
))
NUMPY_DIR
=
os
.
path
.
dirname
(
__file__
)
+
"/../lib/numpy"
NUMPY_DIR
=
os
.
path
.
abspath
(
os
.
path
.
join
(
SRC_DIR
,
"numpy"
))
print_progress_header
(
"Setting up Cython..."
)
if
not
os
.
path
.
exists
(
CYTHON_DIR
):
...
...
@@ -82,21 +82,32 @@ if not os.path.exists(CYTHON_DIR):
else
:
print
">>> Cython already installed."
print_progress_header
(
"Patching NumPy..."
)
NUMPY_PATCH_FILE
=
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"numpy_patch.patch"
))
print_progress_header
(
"Cloning up NumPy..."
)
if
not
os
.
path
.
exists
(
NUMPY_DIR
):
url
=
"https://github.com/numpy/numpy"
subprocess
.
check_call
([
"git"
,
"clone"
,
"--branch"
,
"v1.11.0"
,
url
],
cwd
=
SRC_DIR
)
else
:
print
">>> NumPy already installed."
PATCH_FILE
=
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"numpy_patch.patch"
))
print_progress_header
(
"Patching NumPy..."
)
subprocess
.
check_call
([
"patch"
,
"-p1"
,
"--input="
+
PATCH_FILE
],
cwd
=
NUMPY_DIR
)
try
:
cmd
=
[
"patch"
,
"-p1"
,
"--forward"
,
"-i"
,
NUMPY_PATCH_FILE
,
"-d"
,
NUMPY_DIR
]
subprocess
.
check_output
(
cmd
,
stderr
=
subprocess
.
STDOUT
)
except
subprocess
.
CalledProcessError
as
e
:
print
e
.
output
if
"Reversed (or previously applied) patch detected! Skipping patch"
not
in
e
.
output
:
raise
e
print_progress_header
(
"Setting up NumPy..."
)
subprocess
.
check_call
([
PYTHON_EXE
,
"setup.py"
,
"build"
],
cwd
=
NUMPY_DIR
)
print_progress_header
(
"Installing NumPy..."
)
subprocess
.
check_call
([
PYTHON_EXE
,
"setup.py"
,
"install"
],
cwd
=
NUMPY_DIR
)
env
=
os
.
environ
CYTHON_BIN_DIR
=
os
.
path
.
abspath
(
os
.
path
.
join
(
ENV_NAME
+
"/bin"
))
env
[
"PATH"
]
=
CYTHON_BIN_DIR
+
":"
+
env
[
"PATH"
]
print_progress_header
(
"Setting up NumPy..."
)
subprocess
.
check_call
([
PYTHON_EXE
,
"setup.py"
,
"build"
],
cwd
=
NUMPY_DIR
,
env
=
env
)
print_progress_header
(
"Installing NumPy..."
)
subprocess
.
check_call
([
PYTHON_EXE
,
"setup.py"
,
"install"
],
cwd
=
NUMPY_DIR
,
env
=
env
)
except
:
subprocess
.
check_call
([
"rm"
,
"-rf"
,
NUMPY_DIR
])
# From Wikipedia
script
=
"""
...
...
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