You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd would like to use this package, but I can't because of this - that's because even if I don't want to use the maxsize_bytes functionality, CircularDict calls sys.getsizeof(...) in several places.
I think the solution could be to "hide" these calls behind a is maxsize_bytes specified? condition, for example something like this:
def __setitem__(self, key: Any, value: Any):
...
- item_size = sys.getsizeof(key) + sys.getsizeof(value)
# If the element could not fit in the empty dictionary, raise an error
if self.maxsize_bytes is not None:
+ item_size = sys.getsizeof(key) + sys.getsizeof(value)
if item_size > self.maxsize_bytes:
raise MemoryError(f"Item size {item_size} is larger than maxsize {self.maxsize_bytes}")
...
That way this package could be also used in PyPy - if one sacrifices the maxsize_bytes functionality when using PyPy.
What do you think? :)
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
PyPy doesn't implement
sys.getsizeof(...)
and fails when it's used. Similarly to pandas-dev/pandas#17228.Reference:
I'd would like to use this package, but I can't because of this - that's because even if I don't want to use the
maxsize_bytes
functionality,CircularDict
callssys.getsizeof(...)
in several places.I think the solution could be to "hide" these calls behind a
is maxsize_bytes specified?
condition, for example something like this:That way this package could be also used in PyPy - if one sacrifices the
maxsize_bytes
functionality when using PyPy.What do you think? :)
The text was updated successfully, but these errors were encountered: