8000 Merge pull request #15417 from sethtroisi/python2_easy · numpy/numpy@05cb43b · GitHub
[go: up one dir, main page]

Skip to content

Commit 05cb43b

Browse files
authored
Merge pull request #15417 from sethtroisi/python2_easy
MAINT: Cleanup references to python2
2 parents 29873a0 + 9ef5f37 commit 05cb43b

File tree

5 files changed

+7
-20
lines changed

5 files changed

+7
-20
lines changed

numpy/core/src/multiarray/arrayobject.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,9 +1329,8 @@ _failed_comparison_workaround(PyArrayObject *self, PyObject *other, int cmp_op)
13291329
/*
13301330
* For LE, LT, GT, GE and a flexible self or other, we return
13311331
* NotImplemented, which is the correct answer since the ufuncs do
1332-
* not in fact implement loops for those. On python 3 this will
1333-
* get us the desired TypeError, but on python 2, one gets strange
1334-
* ordering, so we emit a warning.
1332+
* not in fact implement loops for those. This will get us the
1333+
* desired TypeError.
13351334
*/
13361335
Py_XDECREF(exc);
13371336
Py_XDECREF(val);
@@ -1539,8 +1538,7 @@ array_richcompare(PyArrayObject *self, PyObject *other, int cmp_op)
15391538
* (MHvK, 2018-06-18: not sure about this, but it's what we have).
15401539
*
15411540
* However, for backwards compatibility, we cannot yet return arrays,
1542-
* so we raise warnings instead. Furthermore, we warn on python2
1543-
* for LT, LE, GE, GT, since fall-back behaviour is poorly defined.
1541+
* so we raise warnings instead.
15441542
*/
15451543
result = _failed_comparison_workaround(self, other, cmp_op);
15461544
}

numpy/core/src/multiarray/typeinfo.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
*/
66
#include "typeinfo.h"
77

8-
/* In python 2, this is not exported from Python.h */
8+
#if (defined(PYPY_VERSION_NUM) && (PYPY_VERSION_NUM <= 0x07030000))
9+
/* PyPy issue 3160 */
910
#include <structseq.h>
11+
#endif
1012

1113
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
1214
#define _MULTIARRAYMODULE

numpy/linalg/lapack_lite/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The routines that ``lapack_litemodule.c`` wraps are listed in
2020
properly. Assuming that you have an unpacked LAPACK source tree in
2121
``~/LAPACK``, you generate the new routines in this directory with::
2222

23-
$ python2 ./make_lite.py wrapped_routines ~/LAPACK
23+
$ python ./make_lite.py wrapped_routines ~/LAPACK
2424

2525
This will grab the right routines, with dependencies, put them into the
2626
appropriate ``f2c_*.f`` files, run ``f2c`` over them, then do some scrubbing

numpy/linalg/linalg.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,6 @@
3737
overrides.array_function_dispatch, module='numpy.linalg')
3838

3939

40-
# For Python2/3 compatibility
41-
_N = b'N'
42-
_V = b'V'
43-
_A = b'A'
44-
_S = b'S'
45-
_L = b'L'
46-
4740
fortran_int = intc
4841

4942

tools/refguide_check.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,6 @@ class Checker(doctest.OutputChecker):
656656
Check the docstrings
657657
"""
658658
obj_pattern = re.compile('at 0x[0-9a-fA-F]+>')
659-
int_pattern = re.compile('^[0-9]+L?$')
660659
vanilla = doctest.OutputChecker()
661660
rndm_markers = {'# random', '# Random', '#random', '#Random', "# may vary",
662661
"# uninitialized", "#uninitialized"}
@@ -695,11 +694,6 @@ def check_output(self, want, got, optionflags):
695694
if want.lstrip().startswith("#"):
696695
return True
697696

698-
# python 2 long integers are equal to python 3 integers
699-
if self.int_pattern.match(want) and self.int_pattern.match(got):
700-
if want.rstrip("L\r\n") == got.rstrip("L\r\n"):
701-
return True
702-
703697
# try the standard doctest
704698
try:
705699
if self.vanilla.check_output(want, got, optionflags):

0 commit comments

Comments
 (0)
0