mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[python] PY-91830 handle the case when __file__ is pyc
- Python 3 - `__file__` is always `*.py` - Python 2 - `__file__` could be `*.pyc` if the file is `*.pyc` - `... in step_files` will fail, hence why the relevant test `test_only_step_modules_are_reimported` fails on Python 2 (cherry picked from commit 1ab51b37debb41df12b04a10ff0945b996b8c0ec) IJ-MR-220056 GitOrigin-RevId: 9ff1aa5ffce90cc3eee4fa7b71ffa85bceadcd21
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0d5ce4a978
commit
a140cb8113
@@ -107,7 +107,11 @@ def _modules_to_reimport(old_modules, step_files):
|
||||
if name in old_modules or module is None:
|
||||
continue
|
||||
path = getattr(module, '__file__', None)
|
||||
if not path or os.path.normcase(os.path.abspath(path)) not in step_files:
|
||||
if not path:
|
||||
continue
|
||||
if path.endswith('.pyc'): # Python 2
|
||||
path = path[:-1]
|
||||
if os.path.normcase(os.path.abspath(path)) not in step_files:
|
||||
continue
|
||||
subtree = [name]
|
||||
prefix = name + '.'
|
||||
|
||||
Reference in New Issue
Block a user