This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author andrei.avk
Recipients andrei.avk, brett.cannon, graingert
Date 2022-03-21.00:11:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1647821510.86.0.0164872299596.issue47026@roundup.psfhosted.org>
In-reply-to
Content
This warning can be fixed by changing the following line:

https://github.com/python/cpython/blob/9d1c4d69dbc800ac344565119337fcf490cdc800/Lib/importlib/_bootstrap_external.py#L1419

to:

        if not path and str(path) == '':

and running `make regen-importlib; make`

Alternatively the change can be:

        if not path and isinstance(path, (str,bytes)):

I'm not sure which is preferable or if some other fix would be better (I don't know much about importlib).

===
Adding Brett as the expert -- Brett, can you take a look?

Adding a full traceback with -bb argument:

Traceback (most recent call last):
  File "/Users/ak/temp2/zipfile_demo.py", line 29, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/ak/opensource/cpython4/Lib/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ak/temp2/zipfile_demo.py", line 12, in _tmp_path
    yield pathlib.Path(tmp_dir)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ak/temp2/zipfile_demo.py", line 24, in main
    import module
    ^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1080, in _find_spec
  File "<frozen importlib._bootstrap_external>", line 1493, in find_spec
  File "<frozen importlib._bootstrap_external>", line 1462, in _get_spec
  File "<frozen importlib._bootstrap_external>", line 1418, in _path_importer_cache
BytesWarning: Comparison between bytes and string
History
Date User Action Args
2022-03-21 00:11:50andrei.avksetrecipients: + andrei.avk, brett.cannon, graingert
2022-03-21 00:11:50andrei.avksetmessageid: <1647821510.86.0.0164872299596.issue47026@roundup.psfhosted.org>
2022-03-21 00:11:50andrei.avklinkissue47026 messages
2022-03-21 00:11:50andrei.avkcreate