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

Skip to content

Commit bce31b0

Browse files
committed
Added compatibility information
1 parent 3dc10e0 commit bce31b0

2 files changed

Lines changed: 59 additions & 1 deletion

File tree

COMPATIBILITY

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
2+
3+
X.flat returns an indexable 1-D iterator (mostly similar to an array but always 1-d)
4+
5+
long(<>) --> pylong(<>) if from Numeric * was changed to from scipy.base import *
6+
7+
.typecode() --> .dtypechar
8+
9+
.iscontiguous() --> .flags['CONTIGUOUS']
10+
11+
.byteswapped() -> .byteswap()
12+
13+
.itemsize() -> .itemsize
14+
15+
If you used typecode characters:
16+
17+
'c' -> 'S1'
18+
'b' -> 'B'
19+
'1' -> 'b'
20+
's' -> 'h'
21+
'w' -> 'H'
22+
'u' -> 'I'
23+
24+
25+
C -level
26+
27+
some API calls that used to take PyObject * now take PyArrayObject * (this should only cause warnings during compile and not actual problems).
28+
PyArray_Take
29+
30+
These commands now return a buffer that must be freed once it is used
31+
using PyMemData_FREE(ptr) or PyMemData_XFREE(ptr);
32+
33+
a->descr->zero --> PyArray_Zero(a)
34+
a->descr->one --> PyArray_One(a)
35+
36+
Numeric/arrayobject.h --> scipy/arrayobject.h
37+
38+
39+
# These will actually work and are defines for PyArray_BYTE,
40+
# but you really should change it in your code
41+
PyArray_CHAR --> PyArray_BYTE (or PyArray_STRING which is more flexible)
42+
PyArray_SBYTE --> PyArray_BYTE
43+
44+
Any uses of character codes will need adjusting....
45+
use PyArray_XXXLTR where XXX is the name of the type.
46+
47+
48+
If you used function pointers directly (why did you do that?),
49+
the arguments have changed.
50+
51+
a->descr->cast[i](fromdata, fromstep, todata, tostep, n)
52+
a->descr->cast[i](fromdata, todata, n, PyArrayObject *in, PyArrayObject *out)
53+
54+

scipy/base/include/scipy/arrayobject.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,8 +1099,11 @@ typedef struct {
10991099
#define PyTypeNum_ISUSERDEF(type) ((type >= PyArray_USERDEF) && \
11001100
(type < PyArray_USERDEF+\
11011101
PyArray_NUMUSERTYPES))
1102-
11031102

1103+
#define PyTypeNum_ISEXTENDED(type) (((type >= PyArray_STRING) && \
1104+
(type <= PyArray_VOID)) || \
1105+
(type >= PyArray_USERDEF))
1106+
11041107
#define PyTypeNum_ISOBJECT(type) ((type) == PyArray_OBJECT)
11051108

11061109
#define PyArray_ISBOOL(obj) PyTypeNum_ISBOOL(PyArray_TYPE(obj))
@@ -1114,6 +1117,7 @@ typedef struct {
11141117
#define PyArray_ISPYTHONTYPE(obj) PyTypeNum_ISPYTHONTYPE(PyArray_TYPE(obj))
11151118
#define PyArray_ISFLEXIBLE(obj) PyTypeNum_ISFLEXIBLE(PyArray_TYPE(obj))
11161119
#define PyArray_ISUSERDEF(obj) PyTypeNum_ISUSERDEF(PyArray_TYPE(obj))
1120+
#define PyArray_ISEXTENDED(obj) PyTypeNum_ISEXTENDED(PyArray_TYPE(obj))
11171121
#define PyArray_ISOBJECT(obj) PyTypeNum_ISOBJECT(PyArray_TYPE(obj))
11181122

11191123
/* Object arrays ignore notswapped flag */

0 commit comments

Comments
 (0)