FIX Remove memoryview reference in nested closure function
@@ -150,7 +150,13 @@ def get_dense_row_string(
x_inds[x_nz_used] = k
x_vals[x_nz_used] = <double_or_longlong> val
x_nz_used += 1
- return " ".join(value_pattern % (j+one_based, val) for i, (j, val) in enumerate(zip(x_inds, x_vals)) if i < x_nz_used)
+
+ reprs = [
+ value_pattern % (x_inds[i] + one_based, x_vals[i])
+ for i in range(x_nz_used)
+ ]
+
+ return " ".join(reprs)
def get_sparse_row_string(
int_or_float[:] X_data,
@@ -164,7 +170,12 @@ def get_sparse_row_string(
Py_ssize_t row_start = X_indptr[row]
Py_ssize_t row_end = X_indptr[row+1]
- return " ".join(value_pattern % (X_indices[i]+one_based, X_data[i]) for i in range(row_start, row_end))
+ reprs = [
+ value_pattern % (X_indices[i] + one_based, X_data[i])
+ for i in range(row_start, row_end)
+ ]
+
+ return " ".join(reprs)
def _dump_svmlight_file(
X,
