classification
Title: fwalk: incorrect boolean test for non-fd arguments
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: dubiousjim
Priority: normal Keywords:

Created on 2020-10-16 17:31 by dubiousjim, last changed 2020-10-16 17:31 by dubiousjim.

Messages (1)
msg378725 - (view) Author: (dubiousjim) Date: 2020-10-16 17:31
`Lib/os.py` has at line 464, in definition of `fwalk`:

```
if not isinstance(top, int) or not hasattr(top, '__index__'):
```

If I understand this test correctly, it should be requiring that the name/fd is NEITHER an int NOR has an __index__ method. As written, anything which fails the left-hand side (and so is an int) will probably have an __index__ method, so the right-hand side is idle.

Proposed fix: change `or` to `and`.
History
Date User Action Args
2020-10-16 17:31:45dubiousjimcreate