@@ -4946,15 +4946,15 @@ static HPy init__multiarray_umath_impl(HPyContext *ctx) {
4946
4946
4947
4947
* This is for backward compatibility with existing code.
4948
4948
*/
4949
- PyDict_SetItemString ( d , "error" , PyExc_Exception );
4949
+ HPy_SetItem_s ( ctx , h_d , "error" , ctx -> h_Exception );
4950
4950
4951
- s = PyLong_FromLong ( NPY_TRACE_DOMAIN );
4952
- PyDict_SetItemString ( d , "tracemalloc_domain" , s );
4953
- Py_DECREF ( s );
4951
+ h_s = HPyLong_FromLong ( ctx , NPY_TRACE_DOMAIN );
4952
+ HPy_SetItem_s ( ctx , h_d , "tracemalloc_domain" , h_s );
4953
+ HPy_Close ( ctx , h_s );
4954
4954
4955
- s = PyUnicode_FromString ( "3.1" );
4956
- PyDict_SetItemString ( d , "__version__" , s );
4957
- Py_DECREF ( s );
4955
+ h_s = HPyUnicode_FromString ( ctx , "3.1" );
4956
+ HPy_SetItem_s ( ctx , h_d , "__version__" , h_s );
4957
+ HPy_Close ( ctx , h_s );
4958
4958
4959
4959
h_s = npy_cpu_features_dict (ctx );
4960
4960
if (HPy_IsNull (h_s )) {
@@ -4994,9 +4994,9 @@ static HPy init__multiarray_umath_impl(HPyContext *ctx) {
4994
4994
Py_DECREF (s );
4995
4995
4996
4996
#define ADDCONST (NAME ) \
4997
- s = PyLong_FromLong( NPY_##NAME); \
4998
- PyDict_SetItemString(d, #NAME, s); \
4999
- Py_DECREF(s )
4997
+ h_s = HPyLong_FromLong(ctx, NPY_##NAME); \
4998
+ HPy_SetItem_s(ctx, h_d, #NAME, h_s); \
4999
+ HPy_Close(ctx, h_s )
5000
5000
5001
5001
5002
5002
ADDCONST (ALLOW_THREADS );
0 commit comments