Skip to content

Commit

Permalink
Blind fix for #281
Browse files Browse the repository at this point in the history
I don't understand why the bug is happening, and why this get a
FrozenImporter as it was never getting one before, but this should fix
the bug.
  • Loading branch information
Carreau committed Jan 23, 2024
1 parent 5d06d73 commit a49c917
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/python/pyflyby/_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import ast
from functools import total_ordering
from importlib.machinery import FrozenImporter
import itertools
import os
import re
Expand Down Expand Up @@ -250,6 +251,9 @@ def filename(self):
# Get the filename using loader.get_filename(). Note that this does
# more than just loader.filename: for example, it adds /__init__.py
# for packages.
if isinstance(loader, FrozenImporter):
assert not hasattr(loader, 'get_filename')
return None
filename = loader.get_filename()
if not filename:
return None
Expand Down

0 comments on commit a49c917

Please sign in to comment.