
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2014-10-29 15:30 byh.venev, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| py.patch | h.venev,2014-10-29 15:30 | |||
| path_exists_enotdir.patch | pitrou,2014-10-30 19:30 | |||
| path_exists_enotdir2.patch | pitrou,2014-10-30 19:40 | |||
| Messages (11) | |||
|---|---|---|---|
| msg230214 -(view) | Author: Hristo Venev (h.venev)* | Date: 2014-10-29 15:30 | |
$ touch ac: stat("a/x", ...) -> errno=ENOTDIR$ python>>> pathlib.Path('a/x').exists()This should return False and not throw an exception.Patch not tested. | |||
| msg230221 -(view) | Author: Hristo Venev (h.venev)* | Date: 2014-10-29 15:55 | |
Tested and works. | |||
| msg230222 -(view) | Author: Georg Brandl (georg.brandl)*![]() | Date: 2014-10-29 16:00 | |
os.path.exists() ignores *all* OSErrors from stat. This is probably too broad, but only ignoring ENOENT is probably too narrow. | |||
| msg230225 -(view) | Author: Hristo Venev (h.venev)* | Date: 2014-10-29 16:13 | |
ENAMETOOLONG and possibly ELOOP should also return False.EACCES, EOVERFLOW and ENOMEM should probably be forwarded.EFAULT should not happen. | |||
| msg230292 -(view) | Author: Antoine Pitrou (pitrou)*![]() | Date: 2014-10-30 19:25 | |
ENAMETOOLONG: that doesn't mean the file doesn't exist. For example, it could be accessed by changing the current directory and shortening the residual path name.ELOOP: unfortunately it doesn't guarantee that there is a real symlink loop, just that the OS decided to bail out after a certain number of indirections.So in both cases I think we should let the errors bubble up. | |||
| msg230293 -(view) | Author: Antoine Pitrou (pitrou)*![]() | Date: 2014-10-30 19:30 | |
Here is a patch with tests. | |||
| msg230294 -(view) | Author: Hristo Venev (h.venev)* | Date: 2014-10-30 19:36 | |
Should I file bugs for is_dir, is_file, is_symlink, is_socket, is_fifo, is_block_device and is_char_device? | |||
| msg230295 -(view) | Author: Antoine Pitrou (pitrou)*![]() | Date: 2014-10-30 19:37 | |
Le 30/10/2014 20:36, Hristo Venev a écrit :> > Hristo Venev added the comment:> > Should I file bugs for is_dir, is_file, is_symlink, is_socket, is_fifo, is_block_device and is_char_device?Hmm... good catch. No, this issue will do. | |||
| msg230297 -(view) | Author: Antoine Pitrou (pitrou)*![]() | Date: 2014-10-30 19:40 | |
Updated patch for other querying function. | |||
| msg230303 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2014-10-30 22:15 | |
New changeset40497cc445f4 by Antoine Pitrou in branch '3.4':Issue#22759: Query methods on pathlib.Path() (exists(), is_dir(), etc.) now return False when the underlying stat call raises NotADirectoryError.https://hg.python.org/cpython/rev/40497cc445f4New changesetff5f5fd230d3 by Antoine Pitrou in branch 'default':Issue#22759: Query methods on pathlib.Path() (exists(), is_dir(), etc.) now return False when the underlying stat call raises NotADirectoryError.https://hg.python.org/cpython/rev/ff5f5fd230d3 | |||
| msg230304 -(view) | Author: Antoine Pitrou (pitrou)*![]() | Date: 2014-10-30 22:16 | |
This is now fixed. Thanks for the report! | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:09 | admin | set | github: 66948 |
| 2014-10-30 22:16:28 | pitrou | set | status: open -> closed resolution: fixed messages: +msg230304 stage: patch review -> resolved |
| 2014-10-30 22:15:42 | python-dev | set | nosy: +python-dev messages: +msg230303 |
| 2014-10-30 19:40:37 | pitrou | set | files: +path_exists_enotdir2.patch messages: +msg230297 |
| 2014-10-30 19:37:34 | pitrou | set | messages: +msg230295 |
| 2014-10-30 19:36:53 | h.venev | set | messages: +msg230294 |
| 2014-10-30 19:30:55 | pitrou | set | files: +path_exists_enotdir.patch messages: +msg230293 stage: test needed -> patch review |
| 2014-10-30 19:25:55 | pitrou | set | messages: +msg230292 |
| 2014-10-29 16:13:34 | h.venev | set | messages: +msg230225 |
| 2014-10-29 16:00:23 | georg.brandl | set | nosy: +georg.brandl messages: +msg230222 |
| 2014-10-29 15:58:17 | pitrou | set | nosy: +pitrou stage: test needed type: behavior versions: + Python 3.4, Python 3.5 |
| 2014-10-29 15:55:08 | h.venev | set | messages: +msg230221 |
| 2014-10-29 15:30:32 | h.venev | create | |