@@ -7,20 +7,26 @@ string_to_string_resolve_descriptors(PyObject *NPY_UNUSED(self),
7
7
PyArray_DTypeMeta * NPY_UNUSED (dtypes [2 ]),
8
8
PyArray_Descr * given_descrs [2 ],
9
9
PyArray_Descr * loop_descrs [2 ],
10
- npy_intp * NPY_UNUSED ( view_offset ) )
10
+ npy_intp * view_offset )
11
11
{
12
- Py_INCREF (given_descrs [0 ]);
13
- loop_descrs [0 ] = given_descrs [0 ];
14
-
15
12
if (given_descrs [1 ] == NULL ) {
16
- loop_descrs [1 ] = (PyArray_Descr * )new_stringdtype_instance ();
13
+ StringDTypeObject * new = new_stringdtype_instance ();
14
+ if (new == NULL ) {
15
+ return (NPY_CASTING )- 1 ;
16
+ }
17
+ loop_descrs [1 ] = (PyArray_Descr * )new ;
17
18
}
18
19
else {
19
20
Py_INCREF (given_descrs [1 ]);
20
21
loop_descrs [1 ] = given_descrs [1 ];
21
22
}
22
23
23
- return NPY_SAFE_CASTING ;
24
+ Py_INCREF (given_descrs [0 ]);
25
+ loop_descrs [0 ] = given_descrs [0 ];
26
+
27
+ * view_offset = 0 ;
28
+
29
+ return NPY_NO_CASTING ;
24
30
}
25
31
26
32
static int
@@ -59,7 +65,7 @@ PyArrayMethod_Spec StringToStringCastSpec = {
59
65
.name = "cast_StringDType_to_StringDType" ,
60
66
.nin = 1 ,
61
67
.nout = 1 ,
62
- .casting = NPY_UNSAFE_CASTING ,
68
+ .casting = NPY_NO_CASTING ,
63
69
.flags = NPY_METH_SUPPORTS_UNALIGNED ,
64
70
.dtypes = s2s_dtypes ,
65
71
.slots = s2s_slots ,
0 commit comments