Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
eriknw committed Apr 13, 2022
1 parent 260cabb commit 2aa415d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions graphblas/_ss/matrix.py
Expand Up @@ -274,7 +274,7 @@ def _concat_mn(tiles, *, is_matrix=None):
raise TypeError(f"tiles argument must be list or tuple; got: {type(tiles)}")
if not tiles:
raise ValueError("tiles argument must not be empty")
dummy = Matrix.__new__(Matrix)
dummy = object.__new__(Matrix)
m = len(tiles)
n = None
new_tiles = []
Expand Down Expand Up @@ -957,7 +957,7 @@ def _export(self, format=None, *, sort=False, give_ownership=False, raw=False, m
rv["format"] += "c"
if give_ownership:
if method == "export":
parent.gb_obj = NULL
parent.gb_obj[0] = NULL
else:
parent.clear()
elif format == "coor":
Expand Down Expand Up @@ -1289,7 +1289,7 @@ def _export(self, format=None, *, sort=False, give_ownership=False, raw=False, m
rv["format"] = format
rv["values"] = values
if method == "export":
parent.gb_obj = NULL
parent.gb_obj[0] = NULL
if parent.dtype._is_udt:
rv["dtype"] = parent.dtype
return rv
Expand Down
2 changes: 1 addition & 1 deletion graphblas/_ss/vector.py
Expand Up @@ -589,7 +589,7 @@ def _export(self, format=None, *, sort=False, give_ownership=False, raw=False, m
values=values,
)
if method == "export":
parent.gb_obj = NULL
parent.gb_obj[0] = NULL
if parent.dtype._is_udt:
rv["dtype"] = parent.dtype
return rv
Expand Down
4 changes: 2 additions & 2 deletions graphblas/tests/test_matrix.py
Expand Up @@ -1613,15 +1613,15 @@ def test_del(capsys):
import gc

# shell_A does not have `gb_obj` attribute
shell_A = Matrix.__new__(Matrix)
shell_A = object.__new__(Matrix)
del shell_A
# A has `gb_obj` of NULL
A = Matrix.from_values([0, 1], [0, 1], [0, 1])
gb_obj = A.gb_obj
A.gb_obj = graphblas.ffi.NULL
del A
# let's clean up so we don't have a memory leak
A2 = Matrix.__new__(Matrix)
A2 = object.__new__(Matrix)
A2.gb_obj = gb_obj
del A2
gc.collect()
Expand Down
4 changes: 2 additions & 2 deletions graphblas/tests/test_vector.py
Expand Up @@ -892,15 +892,15 @@ def test_del(capsys):
import gc

# shell_v does not have `gb_obj` attribute
shell_v = Vector.__new__(Vector)
shell_v = object.__new__(Vector)
del shell_v
# v has `gb_obj` of NULL
v = Vector.from_values([0, 1], [0, 1])
gb_obj = v.gb_obj
v.gb_obj = graphblas.ffi.NULL
del v
# let's clean up so we don't have a memory leak
v2 = Vector.__new__(Vector)
v2 = object.__new__(Vector)
v2.gb_obj = gb_obj
del v2
gc.collect()
Expand Down

0 comments on commit 2aa415d

Please sign in to comment.