summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.appveyor.yml7
-rw-r--r--.ctags.d1
-rw-r--r--.gitignore5
-rw-r--r--.lgtm.yml4
-rw-r--r--.travis.yml3
-rw-r--r--azure-pipelines.yml20
-rw-r--r--doc/Makefile2
-rw-r--r--doc/release/1.17.0-notes.rst43
-rw-r--r--doc/source/release.rst1
-rw-r--r--doc/source/user/numpy-for-matlab-users.rst10
-rw-r--r--numpy/core/src/multiarray/lowlevel_strided_loops.c.src12
-rw-r--r--numpy/core/src/multiarray/methods.c2
-rw-r--r--numpy/core/tests/test_multiarray.py38
-rw-r--r--numpy/distutils/ccompiler.py12
-rw-r--r--numpy/distutils/exec_command.py23
-rw-r--r--numpy/random/mtrand/mtrand.pyx2
-rw-r--r--numpy/random/mtrand/numpy.pxd2
-rw-r--r--pavement.py3
-rwxr-xr-xsetup.py16
-rw-r--r--shippable.yml3
20 files changed, 150 insertions, 59 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
index 01440c6a0..079496d93 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -30,11 +30,6 @@ environment:
PYTHON_ARCH: 32
TEST_MODE: fast
- - PYTHON: C:\Python27-x64
- PYTHON_VERSION: 2.7
- PYTHON_ARCH: 64
- TEST_MODE: fast
-
- PYTHON: C:\Python36-x64
PYTHON_VERSION: 3.6
PYTHON_ARCH: 64
@@ -91,7 +86,7 @@ install:
$clnt.DownloadFile($env:OPENBLAS, $file)
Get-FileHash $file | Format-List
- Expand-Archive $file $tmpdir
+ Expand-Archive $file $tmpdir
rm $tmpdir\$env:PYTHON_ARCH\lib\*.dll.a
$lib = ls $tmpdir\$env:PYTHON_ARCH\lib\*.a | ForEach { ls $_ } | Select-Object -first 1
diff --git a/.ctags.d b/.ctags.d
new file mode 100644
index 000000000..60f7d6c65
--- /dev/null
+++ b/.ctags.d
@@ -0,0 +1 @@
+--langmaps=c:+.src
diff --git a/.gitignore b/.gitignore
index 0a1e1909f..c2eddb84a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -124,6 +124,10 @@ numpy/core/include/numpy/config.h
numpy/core/include/numpy/multiarray_api.txt
numpy/core/include/numpy/ufunc_api.txt
numpy/core/lib/
+numpy/core/src/common/npy_binsearch.h
+numpy/core/src/common/npy_partition.h
+numpy/core/src/common/npy_sort.h
+numpy/core/src/common/templ_common.h
numpy/core/src/multiarray/_multiarray_tests.c
numpy/core/src/multiarray/arraytypes.c
numpy/core/src/multiarray/einsum.c
@@ -150,6 +154,7 @@ numpy/core/src/umath/_umath_tests.c
numpy/core/src/umath/scalarmath.c
numpy/core/src/umath/funcs.inc
numpy/core/src/umath/loops.[ch]
+numpy/core/src/umath/matmul.[ch]
numpy/core/src/umath/operand_flag_tests.c
numpy/core/src/umath/simd.inc
numpy/core/src/umath/struct_ufunc_test.c
diff --git a/.lgtm.yml b/.lgtm.yml
index 8507b6d45..c1c54ec3c 100644
--- a/.lgtm.yml
+++ b/.lgtm.yml
@@ -12,3 +12,7 @@ extraction:
python_setup:
requirements:
- cython>=0.29
+ cpp:
+ index:
+ build_command:
+ - python3 setup.py build
diff --git a/.travis.yml b/.travis.yml
index 491fcefea..ae3cf26dc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -31,7 +31,6 @@ env:
ahp7Qnm0rWRmA0z9SomuRUQOJQ6s684vU="
python:
- - 2.7
- 3.5
- 3.6
matrix:
@@ -63,8 +62,6 @@ matrix:
- python3-setuptools
- python: 3.6
env: USE_WHEEL=1 RUN_FULL_TESTS=1 RUN_COVERAGE=1 INSTALL_PICKLE5=1
- - python: 2.7
- env: USE_WHEEL=1 RUN_FULL_TESTS=1 PYTHON_OPTS="-3 -OO"
- python: 3.6
env: USE_SDIST=1
- python: 3.6
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 812315bc2..59ea06c7c 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -24,7 +24,7 @@ jobs:
- task: PublishTestResults@2
inputs:
testResultsFiles: '**/test-*.xml'
- testRunTitle: 'Publish test results for Python 3.6-32 bit'
+ testRunTitle: 'Publish test results for Python 3.6-32 bit full Linux'
- job: macOS
pool:
# NOTE: at time of writing, there is a danger
@@ -81,7 +81,7 @@ jobs:
- task: PublishTestResults@2
inputs:
testResultsFiles: '**/test-*.xml'
- testRunTitle: 'Publish test results for Python $(python.version)'
+ testRunTitle: 'Publish test results for Python 3.6 64-bit full Mac OS'
- job: Windows
pool:
vmIMage: 'VS2017-Win2016'
@@ -105,12 +105,6 @@ jobs:
TEST_MODE: fast
OPENBLAS: $(OPENBLAS_32)
BITS: 32
- Python27-64bit-fast:
- PYTHON_VERSION: '2.7'
- PYTHON_ARCH: 'x64'
- TEST_MODE: fast
- OPENBLAS: $(OPENBLAS_64)
- BITS: 64
Python35-64bit-full:
PYTHON_VERSION: '3.5'
PYTHON_ARCH: 'x64'
@@ -137,14 +131,6 @@ jobs:
versionSpec: $(PYTHON_VERSION)
addToPath: true
architecture: $(PYTHON_ARCH)
- # as noted by numba project, currently need
- # specific VC install for Python 2.7
- - powershell: |
- $wc = New-Object net.webclient
- $wc.Downloadfile("https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi", "VCForPython27.msi")
- Start-Process "VCForPython27.msi" /qn -Wait
- displayName: 'Install VC 9.0'
- condition: eq(variables['PYTHON_VERSION'], '2.7')
- script: python -m pip install --upgrade pip setuptools wheel
displayName: 'Install tools'
- powershell: |
@@ -187,4 +173,4 @@ jobs:
- task: PublishTestResults@2
inputs:
testResultsFiles: '**/test-*.xml'
- testRunTitle: 'Publish test results for Python $(python.version)'
+ testRunTitle: 'Publish test results for Python $(PYTHON_VERSION) $(BITS)-bit $(TEST_MODE) Windows'
diff --git a/doc/Makefile b/doc/Makefile
index 667dbef29..d61d115f0 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,7 +1,7 @@
# Makefile for Sphinx documentation
#
-PYVER = 3.6
+PYVER = 3
PYTHON = python$(PYVER)
# You can set these variables from the command line.
diff --git a/doc/release/1.17.0-notes.rst b/doc/release/1.17.0-notes.rst
new file mode 100644
index 000000000..ec6f63945
--- /dev/null
+++ b/doc/release/1.17.0-notes.rst
@@ -0,0 +1,43 @@
+==========================
+NumPy 1.17.0 Release Notes
+==========================
+
+
+Highlights
+==========
+
+
+New functions
+=============
+
+
+Deprecations
+============
+
+
+Future Changes
+==============
+
+
+Expired deprecations
+====================
+
+
+Compatibility notes
+===================
+
+
+C API changes
+=============
+
+
+New Features
+============
+
+
+Improvements
+============
+
+
+Changes
+=======
diff --git a/doc/source/release.rst b/doc/source/release.rst
index 1cf215549..11a25d13e 100644
--- a/doc/source/release.rst
+++ b/doc/source/release.rst
@@ -2,6 +2,7 @@
Release Notes
*************
+.. include:: ../release/1.17.0-notes.rst
.. include:: ../release/1.16.0-notes.rst
.. include:: ../release/1.15.4-notes.rst
.. include:: ../release/1.15.3-notes.rst
diff --git a/doc/source/user/numpy-for-matlab-users.rst b/doc/source/user/numpy-for-matlab-users.rst
index 399237c21..45e40d011 100644
--- a/doc/source/user/numpy-for-matlab-users.rst
+++ b/doc/source/user/numpy-for-matlab-users.rst
@@ -693,19 +693,19 @@ this is just an example, not a statement of "best practices"):
::
- # Make all numpy available via shorter 'num' prefix
- import numpy as num
+ # Make all numpy available via shorter 'np' prefix
+ import numpy as np
# Make all matlib functions accessible at the top level via M.func()
import numpy.matlib as M
# Make some matlib functions accessible directly at the top level via, e.g. rand(3,3)
from numpy.matlib import rand,zeros,ones,empty,eye
# Define a Hermitian function
def hermitian(A, **kwargs):
- return num.transpose(A,**kwargs).conj()
+ return np.transpose(A,**kwargs).conj()
# Make some shortcuts for transpose,hermitian:
- # num.transpose(A) --> T(A)
+ # np.transpose(A) --> T(A)
# hermitian(A) --> H(A)
- T = num.transpose
+ T = np.transpose
H = hermitian
Links
diff --git a/numpy/core/src/multiarray/lowlevel_strided_loops.c.src b/numpy/core/src/multiarray/lowlevel_strided_loops.c.src
index 159bb4103..896e466c8 100644
--- a/numpy/core/src/multiarray/lowlevel_strided_loops.c.src
+++ b/numpy/core/src/multiarray/lowlevel_strided_loops.c.src
@@ -121,8 +121,8 @@ static void
{
#if @is_aligned@ && @elsize@ != 16
/* sanity check */
- assert(npy_is_aligned(dst, _ALIGN(@type@)));
- assert(npy_is_aligned(src, _ALIGN(@type@)));
+ assert(N == 0 || npy_is_aligned(dst, _ALIGN(@type@)));
+ assert(N == 0 || npy_is_aligned(src, _ALIGN(@type@)));
#endif
/*printf("fn @prefix@_@oper@_size@elsize@\n");*/
while (N > 0) {
@@ -201,8 +201,8 @@ static NPY_GCC_OPT_3 void
}
#if @is_aligned@ && @elsize@ != 16
/* sanity check */
- assert(npy_is_aligned(dst, _ALIGN(@type@)));
- assert(npy_is_aligned(src, _ALIGN(@type@)));
+ assert(N == 0 || npy_is_aligned(dst, _ALIGN(@type@)));
+ assert(N == 0 || npy_is_aligned(src, _ALIGN(@type@)));
#endif
#if @elsize@ == 1 && @dst_contig@
memset(dst, *src, N);
@@ -809,10 +809,10 @@ static NPY_GCC_OPT_3 void
#if @aligned@
/* sanity check */
# if !@is_complex1@
- assert(npy_is_aligned(src, _ALIGN(_TYPE1)));
+ assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
# endif
# if !@is_complex2@
- assert(npy_is_aligned(dst, _ALIGN(_TYPE2)));
+ assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
# endif
#endif
diff --git a/numpy/core/src/multiarray/methods.c b/numpy/core/src/multiarray/methods.c
index 231bd86dc..6254114cc 100644
--- a/numpy/core/src/multiarray/methods.c
+++ b/numpy/core/src/multiarray/methods.c
@@ -187,7 +187,7 @@ array_reshape(PyArrayObject *self, PyObject *args, PyObject *kwds)
}
if (n <= 1) {
- if (PyTuple_GET_ITEM(args, 0) == Py_None) {
+ if (n != 0 && PyTuple_GET_ITEM(args, 0) == Py_None) {
return PyArray_View(self, NULL, NULL);
}
if (!PyArg_ParseTuple(args, "O&:reshape", PyArray_IntpConverter,
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py
index cdacdabbe..32d49df02 100644
--- a/numpy/core/tests/test_multiarray.py
+++ b/numpy/core/tests/test_multiarray.py
@@ -7923,6 +7923,44 @@ def test_uintalignment_and_alignment():
dst = np.zeros((2,2), dtype='c8')
dst[:,1] = src[:,1] # assert in lowlevel_strided_loops fails?
+class TestAlignment(object):
+ # adapted from scipy._lib.tests.test__util.test__aligned_zeros
+ # Checks that unusual memory alignments don't trip up numpy.
+ # In particular, check RELAXED_STRIDES don't trip alignment assertions in
+ # NDEBUG mode for size-0 arrays (gh-12503)
+
+ def check(self, shape, dtype, order, align):
+ err_msg = repr((shape, dtype, order, align))
+ x = _aligned_zeros(shape, dtype, order, align=align)
+ if align is None:
+ align = np.dtype(dtype).alignment
+ assert_equal(x.__array_interface__['data'][0] % align, 0)
+ if hasattr(shape, '__len__'):
+ assert_equal(x.shape, shape, err_msg)
+ else:
+ assert_equal(x.shape, (shape,), err_msg)
+ assert_equal(x.dtype, dtype)
+ if order == "C":
+ assert_(x.flags.c_contiguous, err_msg)
+ elif order == "F":
+ if x.size > 0:
+ assert_(x.flags.f_contiguous, err_msg)
+ elif order is None:
+ assert_(x.flags.c_contiguous, err_msg)
+ else:
+ raise ValueError()
+
+ def test_various_alignments(self):
+ for align in [1, 2, 3, 4, 8, 16, 32, 64, None]:
+ for n in [0, 1, 3, 11]:
+ for order in ["C", "F", None]:
+ for dtype in np.typecodes["All"]:
+ if dtype == 'O':
+ # object dtype can't be misaligned
+ continue
+ for shape in [n, (1, 2, 3, n)]:
+ self.check(shape, np.dtype(dtype), order, align)
+
def test_getfield():
a = np.arange(32, dtype='uint16')
if sys.byteorder == 'little':
diff --git a/numpy/distutils/ccompiler.py b/numpy/distutils/ccompiler.py
index 5b7cb3fcf..100d0d069 100644
--- a/numpy/distutils/ccompiler.py
+++ b/numpy/distutils/ccompiler.py
@@ -17,7 +17,9 @@ from distutils.version import LooseVersion
from numpy.distutils import log
from numpy.distutils.compat import get_exception
-from numpy.distutils.exec_command import filepath_from_subprocess_output
+from numpy.distutils.exec_command import (
+ filepath_from_subprocess_output, forward_bytes_to_stdout
+)
from numpy.distutils.misc_util import cyg2win32, is_sequence, mingw32, \
get_num_build_jobs, \
_commandline_dep_string
@@ -159,11 +161,9 @@ def CCompiler_spawn(self, cmd, display=None):
if is_sequence(cmd):
cmd = ' '.join(list(cmd))
- try:
- print(o)
- except UnicodeError:
- # When installing through pip, `o` can contain non-ascii chars
- pass
+
+ forward_bytes_to_stdout(o)
+
if re.search(b'Too many open files', o):
msg = '\nTry rerunning setup command until build succeeds.'
else:
diff --git a/numpy/distutils/exec_command.py b/numpy/distutils/exec_command.py
index aaeca99ee..ede347b03 100644
--- a/numpy/distutils/exec_command.py
+++ b/numpy/distutils/exec_command.py
@@ -81,6 +81,29 @@ def filepath_from_subprocess_output(output):
output = output.encode('ascii', errors='replace')
return output
+
+def forward_bytes_to_stdout(val):
+ """
+ Forward bytes from a subprocess call to the console, without attempting to
+ decode them.
+
+ The assumption is that the subprocess call already returned bytes in
+ a suitable encoding.
+ """
+ if sys.version_info.major < 3:
+ # python 2 has binary output anyway
+ sys.stdout.write(val)
+ elif hasattr(sys.stdout, 'buffer'):
+ # use the underlying binary output if there is one
+ sys.stdout.buffer.write(val)
+ elif hasattr(sys.stdout, 'encoding'):
+ # round-trip the encoding if necessary
+ sys.stdout.write(val.decode(sys.stdout.encoding))
+ else:
+ # make a best-guess at the encoding
+ sys.stdout.write(val.decode('utf8', errors='replace'))
+
+
def temp_file_name():
fo, name = make_temp_file()
fo.close()
diff --git a/numpy/random/mtrand/mtrand.pyx b/numpy/random/mtrand/mtrand.pyx
index 21bc73e54..059a39e55 100644
--- a/numpy/random/mtrand/mtrand.pyx
+++ b/numpy/random/mtrand/mtrand.pyx
@@ -1,3 +1,5 @@
+# cython: language_level=3
+
# mtrand.pyx -- A Pyrex wrapper of Jean-Sebastien Roy's RandomKit
#
# Copyright 2005 Robert Kern (robert.kern@gmail.com)
diff --git a/numpy/random/mtrand/numpy.pxd b/numpy/random/mtrand/numpy.pxd
index 9092fa113..1b4fe6c10 100644
--- a/numpy/random/mtrand/numpy.pxd
+++ b/numpy/random/mtrand/numpy.pxd
@@ -1,3 +1,5 @@
+# cython: language_level=3
+
# :Author: Travis Oliphant
from cpython.exc cimport PyErr_Print
diff --git a/pavement.py b/pavement.py
index f2c56883b..2a5225f71 100644
--- a/pavement.py
+++ b/pavement.py
@@ -42,13 +42,12 @@ from paver.easy import Bunch, options, task, sh
#-----------------------------------
# Path to the release notes
-RELEASE_NOTES = 'doc/release/1.16.0-notes.rst'
+RELEASE_NOTES = 'doc/release/1.17.0-notes.rst'
#-------------------------------------------------------
# Hardcoded build/install dirs, virtualenv options, etc.
#-------------------------------------------------------
-DEFAULT_PYTHON = "2.7"
# Where to put the release installers
options(installers=Bunch(releasedir="release",
diff --git a/setup.py b/setup.py
index cc20fa61d..b9bbc08fb 100755
--- a/setup.py
+++ b/setup.py
@@ -27,15 +27,14 @@ import subprocess
import textwrap
-if sys.version_info[:2] < (2, 7) or (3, 0) <= sys.version_info[:2] < (3, 4):
- raise RuntimeError("Python version 2.7 or >= 3.4 required.")
+if sys.version_info[:2] < (3, 5):
+ raise RuntimeError("Python version >= 3.5 required.")
-if sys.version_info[0] >= 3:
- import builtins
-else:
- import __builtin__ as builtins
+import builtins
+python_requires = '>=3.5'
+
CLASSIFIERS = """\
Development Status :: 5 - Production/Stable
Intended Audience :: Science/Research
@@ -43,10 +42,7 @@ Intended Audience :: Developers
License :: OSI Approved
Programming Language :: C
Programming Language :: Python
-Programming Language :: Python :: 2
-Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
-Programming Language :: Python :: 3.4
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
@@ -60,7 +56,7 @@ Operating System :: MacOS
"""
MAJOR = 1
-MINOR = 16
+MINOR = 17
MICRO = 0
ISRELEASED = False
VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
diff --git a/shippable.yml b/shippable.yml
index 6a92c0f34..195972e60 100644
--- a/shippable.yml
+++ b/shippable.yml
@@ -6,12 +6,11 @@ language: python
python:
# use versions available for job image
- # aarch64_u16pytall:v6.7.4
+ # aarch64_u16pytall:v6.7.4
# (what we currently have access to by default)
# this is a bit restrictive in terms
# of version availability / control,
# but it is convenient
- - 2.7
- 3.7
runtime: