Skip to content

Commit

Permalink
Merge #624
Browse files Browse the repository at this point in the history
624: Fix asset caching r=pathunstrom a=AstraLuma

Closes #623

Co-authored-by: Jamie Bliss <[email protected]>
  • Loading branch information
bors[bot] and AstraLuma authored May 19, 2021
2 parents 3e0d7a5 + e316a73 commit d1c41f7
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions ppb/assetlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,11 @@ def __new__(cls, name):
try:
return _asset_cache[(clsname, name)]
except KeyError:
inst = super().__new__(cls)
_asset_cache[(clsname, name)] = inst
return inst

def __init__(self, name):
self.name = str(name)
self._start()
self = super().__new__(cls)
self.name = str(name)
_asset_cache[(clsname, name)] = self
self._start()
return self

def __repr__(self):
return f"<{type(self).__name__} name={self.name!r}{' loaded' if self.is_loaded() else ''} at 0x{id(self):x}>"
Expand Down

0 comments on commit d1c41f7

Please sign in to comment.