Issue 31920: pygettext ignores directories as inputfile argument (original) (raw)
Issue31920
Created on 2017-11-02 08:37 by Oleg Krasnikov, last changed 2022-04-11 14:58 by admin. This issue is now closed.
Pull Requests | |||
---|---|---|---|
URL | Status | Linked | Edit |
PR 4225 | closed | Oleg Krasnikov,2017-11-02 08:55 | |
PR 6259 | merged | serhiy.storchaka,2018-03-26 15:59 | |
PR 6431 | merged | miss-islington,2018-04-09 17:09 | |
PR 6432 | merged | miss-islington,2018-04-09 17:10 | |
PR 6436 | merged | serhiy.storchaka,2018-04-09 19:08 |
Messages (7) | ||
---|---|---|
msg305406 - (view) | Author: Oleg Krasnikov (Oleg Krasnikov) * | Date: 2017-11-02 08:37 |
This happens because pygettext's `getFilesForName` calls `os.walk` as if it was `os.path.walk`. But the `walk` function has changed signature when moved from `os.path` to `os`. So now `_visit_pyfiles` is passed to `walk` as `topdown` argument which is obviously wrong and therefore `_visit_pyfiles` is never called. | ||
msg305479 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2017-11-03 13:15 |
Thank you for your patch Oleg. 3.4 and 3.5 are in security fixes only mode now. Good catch, the usage of os.walk() in pygettext.py is incorrect. But your change is not enough. In _visit_pyfiles() the name 'CVS' is removed from the names list. If names is a list of directories emitted by os.walk(), this would exclude the whole directory CVS from searching. But if it is a new list "dirs + files", this doesn't have any effect. And directories with the ".py" extension shouldn't be added to the list of Python files. Hence _visit_pyfiles should take two separate lists for directories and files. And since it no longer is a callback, it would be better to inline its code. There are tests for pygettext in Lib/test/test_tools/test_i18n.py. It would be nice to add a new test for the fixed feature. | ||
msg305488 - (view) | Author: Oleg Krasnikov (Oleg Krasnikov) * | Date: 2017-11-03 15:36 |
Thanks for quite sensible notes Serhiy. I've fixed all that in recent commit and added a regression test. Still not sure about "testing conventions" here cause this is my first PR to python repository, so please let me know if something is wrong and I'll fix that. | ||
msg315140 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2018-04-09 17:09 |
New changeset c93938b5beea4c3f592119ebee6d4029558db8de by Serhiy Storchaka in branch 'master': bpo-31920: Fixed handling directories as arguments in the ``pygettext`` script. (GH-6259) https://github.com/python/cpython/commit/c93938b5beea4c3f592119ebee6d4029558db8de | ||
msg315143 - (view) | Author: miss-islington (miss-islington) | Date: 2018-04-09 17:57 |
New changeset 9b25bd6e26b50ade8d52a85c78d957b1f6f9131c by Miss Islington (bot) in branch '3.7': bpo-31920: Fixed handling directories as arguments in the ``pygettext`` script. (GH-6259) https://github.com/python/cpython/commit/9b25bd6e26b50ade8d52a85c78d957b1f6f9131c | ||
msg315144 - (view) | Author: miss-islington (miss-islington) | Date: 2018-04-09 18:06 |
New changeset e0dbc57e116516f6ca1ef021f71e1a98773d57ed by Miss Islington (bot) in branch '3.6': bpo-31920: Fixed handling directories as arguments in the ``pygettext`` script. (GH-6259) https://github.com/python/cpython/commit/e0dbc57e116516f6ca1ef021f71e1a98773d57ed | ||
msg315162 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2018-04-10 08:04 |
New changeset a61f5da54772b0ea6a7eccf21df08e61585ef712 by Serhiy Storchaka in branch '2.7': [2.7] bpo-31920: Fixed handling directories as arguments in the ``pygettext`` script. (GH-6259) (GH-6436) https://github.com/python/cpython/commit/a61f5da54772b0ea6a7eccf21df08e61585ef712 |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:58:53 | admin | set | github: 76101 |
2018-04-10 08:04:26 | serhiy.storchaka | set | status: open -> closedstage: patch review -> resolvedresolution: fixedversions: + Python 3.8 |
2018-04-10 08:04:01 | serhiy.storchaka | set | messages: + |
2018-04-09 19:08:02 | serhiy.storchaka | set | pull_requests: + <pull%5Frequest6131> |
2018-04-09 18:06:11 | miss-islington | set | messages: + |
2018-04-09 17:57:55 | miss-islington | set | nosy: + miss-islingtonmessages: + |
2018-04-09 17:10:27 | miss-islington | set | pull_requests: + <pull%5Frequest6128> |
2018-04-09 17:09:38 | miss-islington | set | pull_requests: + <pull%5Frequest6127> |
2018-04-09 17:09:23 | serhiy.storchaka | set | messages: + |
2018-03-26 15:59:23 | serhiy.storchaka | set | stage: needs patch -> patch reviewpull_requests: + <pull%5Frequest5982> |
2017-11-03 15:36:15 | Oleg Krasnikov | set | messages: + |
2017-11-03 13:15:42 | serhiy.storchaka | set | versions: + Python 2.7, Python 3.6, Python 3.7, - Python 3.4nosy: + serhiy.storchakamessages: + stage: patch review -> needs patch |
2017-11-02 08:55:34 | Oleg Krasnikov | set | keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest4193> |
2017-11-02 08:37:20 | Oleg Krasnikov | create |