Discussion:
[issue25596] regular files handled as directories in the glob module
Xavier de Gaye
2015-11-10 11:18:07 UTC
Permalink
New submission from Xavier de Gaye:

The glob module happily joins names of regular files together with os.path.join() or attempts to list the files contained into a regular file (sic). The same 'except os.error' statement is used to handle both these cases and the case of a non readable directory.

The attached patch makes the code more correct and easier to understand.

----------
components: Library (Lib)
files: glob_isdir.patch
keywords: patch
messages: 254440
nosy: xdegaye
priority: normal
severity: normal
status: open
title: regular files handled as directories in the glob module
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file40996/glob_isdir.patch

_______________________________________
Python tracker <***@bugs.python.org>
<http://bugs.python.org/issue25596>
_______________________________________
Xavier de Gaye
2015-11-10 15:35:35 UTC
Permalink
Xavier de Gaye added the comment:

This second patch rewrites the conditionals that decide whether to call _iglob() recursively, in a more natural way and without changing the behavior from the first patch.
Note that when 'dirname == pathname', then basename is empty and glob2() or glob1() are not called.

The patch also refactors the code with a new _listdir() function.

----------
Added file: http://bugs.python.org/file40999/glob_isdir_2.patch

_______________________________________
Python tracker <***@bugs.python.org>
<http://bugs.python.org/issue25596>
_______________________________________
Serhiy Storchaka
2015-11-10 15:58:18 UTC
Permalink
Changes by Serhiy Storchaka <***@gmail.com>:


----------
assignee: -> serhiy.storchaka
nosy: +serhiy.storchaka
priority: normal -> low
stage: -> patch review

_______________________________________
Python tracker <***@bugs.python.org>
<http://bugs.python.org/issue25596>
_______________________________________

Loading...