Skip to content

TypeError when accessing an object with a None __file__ attributes #2082

@diekhans

Description

@diekhans

I will provide a pull request

TypeError: Traceback (most recent call last):
  File "/cluster/home/markd/opt/miniforge3/envs/markd/lib/python3.12/site-packages/jedi/inference/compiled/subprocess/__init__.py", line 459, in listen
    result = False, None, self._run(*payload)
                          ^^^^^^^^^^^^^^^^^^^
  File "/cluster/home/markd/opt/miniforge3/envs/markd/lib/python3.12/site-packages/jedi/inference/compiled/subprocess/__init__.py", line 440, in _run
    return function(inference_state, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/cluster/home/markd/opt/miniforge3/envs/markd/lib/python3.12/site-packages/jedi/inference/compiled/subprocess/functions.py", line 26, in get_compiled_method_return
    return getattr(handle.access, attribute)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/cluster/home/markd/opt/miniforge3/envs/markd/lib/python3.12/site-packages/jedi/inference/compiled/access.py", line 186, in py__file__
    return Path(self._obj.__file__)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/cluster/home/markd/opt/miniforge3/envs/markd/lib/python3.12/pathlib.py", line 1162, in __init__
    super().__init__(*args)
  File "/cluster/home/markd/opt/miniforge3/envs/markd/lib/python3.12/pathlib.py", line 373, in __init__
    raise TypeError(
TypeError: argument should be a str or an os.PathLike object where __fspath__ returns a str, not 'NoneType'


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions