Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.
Merged
Prev Previous commit
Next Next commit
Move getting list size to if_ok block
  • Loading branch information
akharche committed May 28, 2020
commit 99e92694c747f4d4947557e4df8100602d9579d8
4 changes: 2 additions & 2 deletions sdc/hiframes/boxing.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ def unbox_dataframe(typ, val, c):

col_list_type = types.List(string_type)
ok, inst = listobj.ListInstance.allocate_ex(c.context, c.builder, col_list_type, n_cols)
inst.size = c.context.get_constant(types.intp, n_cols)

with c.builder.if_else(ok, likely=True) as (if_ok, if_not_ok):
with if_ok:
inst.size = c.context.get_constant(types.intp, n_cols)
for i, column_str in enumerate(column_strs):
inst.setitem(c.context.get_constant(types.intp, i), column_str, incref=True)
dataframe.columns = inst.value
Expand All @@ -116,10 +116,10 @@ def unbox_dataframe(typ, val, c):
n_type_cols = len(col_indices)
list_type = types.List(col_typ)
ok, inst = listobj.ListInstance.allocate_ex(c.context, c.builder, list_type, n_type_cols)
inst.size = c.context.get_constant(types.intp, n_type_cols)

with c.builder.if_else(ok, likely=True) as (if_ok, if_not_ok):
with if_ok:
inst.size = c.context.get_constant(types.intp, n_type_cols)
for i, col_idx in enumerate(col_indices):
series_obj = c.pyapi.object_getattr_string(val, typ.columns[col_idx])
arr_obj = c.pyapi.object_getattr_string(series_obj, "values")
Expand Down