Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b60f3c5

Browse files
committed
Don't shadow builtins anymore.
1 parent 07a2484 commit b60f3c5

4 files changed

Lines changed: 38 additions & 20 deletions

File tree

THANKS.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ Pearu Peterson for f2py and distutils
44
Eric Jones for weave
55
Robert Kern for mtrand, bug fixes and help with distutils.
66
Fernando Perez for code snippets and ideas
7+
John Hunter for code snippets (from matplotlib)
8+

scipy/base/numeric.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ def cross(a, b, axisa=-1, axisb=-1, axisc=-1):
179179
#Use numarray's printing function
180180
from arrayprint import array2string, get_printoptions, set_printoptions
181181

182-
_typelessdata = [int, float, complex]
183-
if issubclass(intc, pyint):
182+
_typelessdata = [aint, afloat, acomplex]
183+
if issubclass(intc, int):
184184
_typelessdata.append(intc)
185185

186186
def array_repr(arr, max_line_width=None, precision=None, suppress_small=None):

scipy/base/numerictypes.py

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,33 @@
2020
2121
c-based names
2222
23-
bool
23+
abool
2424
25-
object
25+
aobject
2626
27-
void, string, unicode
27+
void, astr, aunicode
2828
2929
byte, ubyte,
3030
short, ushort
3131
intc, uintc,
3232
intp, uintp,
33-
int, uint,
33+
aint, uint,
3434
longlong, ulonglong,
3535
3636
single, csingle,
37-
float, complex,
37+
afloat, acomplex,
3838
longfloat, clongfloat,
3939
4040
As part of the type-hierarchy: xx -- is bit-width
4141
4242
generic
43-
bool
43+
abool
4444
numeric
4545
integer
4646
signedinteger (intxx)
4747
byte
4848
short
49-
int
49+
aint
5050
intp int0
5151
longint
5252
longlong
@@ -59,20 +59,20 @@
5959
ulonglong
6060
floating (floatxx)
6161
single
62-
float (double)
62+
afloat (double)
6363
longfloat
6464
complexfloating (complexxx)
6565
csingle
66-
complex (cfloat, cdouble)
66+
acomplex (cfloat, cdouble)
6767
clongfloat
6868
6969
flexible
7070
character
71-
string
72-
unicode
71+
astr (string)
72+
aunicode
7373
void
7474
75-
object
75+
aobject
7676
7777
$Id: numerictypes.py,v 1.17 2005/09/09 22:20:06 teoliphant Exp $
7878
"""
@@ -176,22 +176,34 @@ def bitname(obj):
176176
# Rework the Python names (so that float and complex and int are consistent
177177
# with Python usage)
178178
#
179-
complex = cdouble
179+
acomplex = cdouble
180180
int0 = intp
181181
uint0 = uintp
182182
single = float
183183
csingle = cfloat
184-
float = double
184+
afloat = double
185185
intc = int
186186
uintc = uint
187-
int = long
187+
aint = long
188188
uint = ulong
189189
cfloat = cdouble
190190
longfloat = longdouble
191191
clongfloat = clongdouble
192+
193+
abool = bool
194+
aunicode = unicode
195+
astr = string
196+
aobject = object
197+
198+
object = pyobject
199+
unicode = pyunicode
200+
int = pyint
192201
long = pylong
202+
float = pyfloat
203+
complex = pycomplex
204+
bool = pybool
193205

194-
del pylong, ulong
206+
del ulong, pyobject, pyunicode, pyint, pylong, pyfloat, pycomplex, pybool
195207

196208
del _thisdict, _tocheck, a, name, typeobj
197209
del base, bit, char
@@ -209,7 +221,7 @@ def bitname(obj):
209221
'uint':[],
210222
'float':[],
211223
'complex':[],
212-
'others':[bool,object,string,unicode,void]}
224+
'others':[abool,aobject,string,aunicode,void]}
213225

214226
_ibytes = [1,2,4,8,16,32,64]
215227
_fbytes = [2,4,8,10,12,16,32,64]

scipy/base/src/multiarraymodule.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2838,13 +2838,17 @@ PyArray_TypecodeConverter(PyObject *obj, PyArray_Typecode *at)
28382838
else if (PyType_Check(obj)) {
28392839
check_num = PyArray_OBJECT;
28402840
if (obj == (PyObject *)(&PyInt_Type))
2841-
check_num = PyArray_INTP;
2841+
check_num = PyArray_LONG;
28422842
else if (obj == (PyObject *)(&PyBool_Type))
28432843
check_num = PyArray_BOOL;
28442844
else if (obj == (PyObject *)(&PyFloat_Type))
28452845
check_num = PyArray_DOUBLE;
28462846
else if (obj == (PyObject *)(&PyComplex_Type))
28472847
check_num = PyArray_CDOUBLE;
2848+
else if (obj == (PyObject *)(&PyString_Type))
2849+
check_num = PyArray_STRING;
2850+
else if (obj == (PyObject *)(&PyUnicode_Type))
2851+
check_num = PyArray_UNICODE;
28482852
}
28492853
else { /* Default -- try integer conversion */
28502854
check_num = PyInt_AsLong(obj);

0 commit comments

Comments
 (0)