Skip to content

Commit

Permalink
Support loaders which don't set the filename on the ModuleSpec.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 712999091
  • Loading branch information
SiegeLordEx authored and tensorflower-gardener committed Jan 7, 2025
1 parent 2f1383c commit fe99149
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion spinoffs/fun_mc/fun_mc/backends/rewrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ def __init__(self, orig_module_name, orig_loader, orig_filename,

def get_filename(self, fullname):
del fullname
return self._orig_filename
try:
return self._orig_loader.get_filename(self._orig_module_name)
except: # pylint: disable=bare-except
return self._orig_filename

def get_data(self, path):
if DEBUG:
Expand Down
5 changes: 4 additions & 1 deletion spinoffs/inference_gym/inference_gym/backends/rewrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ def __init__(self, orig_module_name, orig_loader, orig_filename,

def get_filename(self, fullname):
del fullname
return self._orig_filename
try:
return self._orig_loader.get_filename(self._orig_module_name)
except: # pylint: disable=bare-except
return self._orig_filename

def get_data(self, path):
if DEBUG:
Expand Down

0 comments on commit fe99149

Please sign in to comment.