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.

classification
Title: Hack in `genericpath.commonprefix()` crashes if `m` argument is not indexable
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: christian.heimes, jonathanhogg
Priority: normal Keywords:

Created on 2016-10-25 10:23 by jonathanhogg, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg279386 - (view) Author: Jonathan Hogg (jonathanhogg) Date: 2016-10-25 10:23
If `genericpath.commonprefix()` is called with a non-indexable argument, then the check for passing in a list of lists/tuples will raise an exception due to the `m[0]` test.
msg279387 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2016-10-25 10:27
That's correct. The function raises a TypeError when you pass in a wrong type.
msg279389 - (view) Author: Jonathan Hogg (jonathanhogg) Date: 2016-10-25 10:36
While I agree that the documentation specifies that this function takes a list, the previous version did not require a list, just any object that is iterable.

Unfortunately, this change is causing a break in real code (`xon.sh` in this case, which appears to pass a `set()` to this function).

Given the `os.fspath` change could have been made to not require an indexable argument, I would argue that this change is an unnecessary regression.
History
Date User Action Args
2022-04-11 14:58:38adminsetgithub: 72713
2016-10-25 10:36:30jonathanhoggsetmessages: + msg279389
2016-10-25 10:27:15christian.heimessetstatus: open -> closed

type: crash -> behavior

nosy: + christian.heimes
messages: + msg279387
resolution: not a bug
stage: resolved
2016-10-25 10:23:40jonathanhoggcreate