Skip to content

Commit ee185b1

Browse files
committed
minor hpy translation
1 parent aa1f135 commit ee185b1

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

numpy/core/src/multiarray/multiarraymodule.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4946,15 +4946,15 @@ static HPy init__multiarray_umath_impl(HPyContext *ctx) {
49464946
49474947
* This is for backward compatibility with existing code.
49484948
*/
4949-
PyDict_SetItemString (d, "error", PyExc_Exception);
4949+
HPy_SetItem_s(ctx, h_d, "error", ctx->h_Exception);
49504950

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);
49544954

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);
49584958

49594959
h_s = npy_cpu_features_dict(ctx);
49604960
if (HPy_IsNull(h_s)) {
@@ -4994,9 +4994,9 @@ static HPy init__multiarray_umath_impl(HPyContext *ctx) {
49944994
Py_DECREF(s);
49954995

49964996
#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)
50005000

50015001

50025002
ADDCONST(ALLOW_THREADS);

0 commit comments

Comments
 (0)