
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2015-07-28 16:11 bysleepycal, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 1926 | merged | CuriousLearner,2017-06-03 07:58 | |
| Messages (8) | |||
|---|---|---|---|
| msg247529 -(view) | Author: Cal Leeming (sleepycal) | Date: 2015-07-28 16:11 | |
The documentation states that pkgutil.walk_packages() path must be None or a list of paths [1]. After passing in a string, the result was a blank list rather than a type error or automatic conversion to a list.If this method is documented that it must only accept a list or None, then there should surely be type checks to this effect? This was a bit of a gotcha that left me head scratching for 30 minutes (after not realising it only took a list, not an str, which in itself seems a bit odd) | |||
| msg247531 -(view) | Author: R. David Murray (r.david.murray)*![]() | Date: 2015-07-28 17:01 | |
Well, normally no, we don't use type checks. On the other hand, having it produce an incorrect result rather than an error of *some* sort is not so good (the problem is that it is ultimately calling map(func, path), and map happily iterates the string applying func to each character in turn), so in this case I think it is worth the explicit check for string. | |||
| msg295070 -(view) | Author: Sanyam Khurana (CuriousLearner)*![]() | Date: 2017-06-03 07:27 | |
Hi r.david.murray,What error do you think should be raised in this case, when path is an instance of str?I'll issue a PR once I know what end results are expected. | |||
| msg295076 -(view) | Author: R. David Murray (r.david.murray)*![]() | Date: 2017-06-03 13:49 | |
As I mentioned on the PR I think it should be a ValueError, and that the PR also needs tests. | |||
| msg295125 -(view) | Author: Sanyam Khurana (CuriousLearner)*![]() | Date: 2017-06-04 14:14 | |
I've updated the PR with required changes along with the test. Please have a look and let me know if any changes are needed. | |||
| msg295260 -(view) | Author: R. David Murray (r.david.murray)*![]() | Date: 2017-06-06 13:14 | |
In thinking about merging this, I realize something I should have thought about earlier: we are proposing to raise an error where none was previously raised. Now, any code that would hit this would be broken, but nonetheless, by our backward compatibility policy we should do this only in 3.7, and we should add a note to the porting section of What's New. And the PR needs a news entry. | |||
| msg295941 -(view) | Author: R. David Murray (r.david.murray)*![]() | Date: 2017-06-13 17:11 | |
New changesetb9c3da5c89c66dcccf382e8f196746da2a06d4cc by R. David Murray (Sanyam Khurana) in branch 'master':bpo-24744: Raises error in pkgutil.walk_packages if path is str (#1926)https://github.com/python/cpython/commit/b9c3da5c89c66dcccf382e8f196746da2a06d4cc | |||
| msg295942 -(view) | Author: R. David Murray (r.david.murray)*![]() | Date: 2017-06-13 17:12 | |
Thanks, Sanyam. | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:19 | admin | set | github: 68932 |
| 2022-01-06 23:56:53 | iritkatriel | link | issue30337 superseder |
| 2017-06-13 17:12:32 | r.david.murray | set | status: open -> closed resolution: fixed messages: +msg295942 stage: needs patch -> resolved |
| 2017-06-13 17:11:16 | r.david.murray | set | messages: +msg295941 |
| 2017-06-06 13:14:54 | r.david.murray | set | type: behavior messages: +msg295260 components: + Library (Lib), - Interpreter Core versions: + Python 3.7, - Python 3.4, Python 3.5, Python 3.6 |
| 2017-06-04 14:14:35 | CuriousLearner | set | messages: +msg295125 |
| 2017-06-03 13:49:33 | r.david.murray | set | messages: +msg295076 |
| 2017-06-03 07:58:25 | CuriousLearner | set | pull_requests: +pull_request2006 |
| 2017-06-03 07:27:39 | CuriousLearner | set | nosy: +CuriousLearner messages: +msg295070 |
| 2015-07-28 17:01:11 | r.david.murray | set | versions: + Python 3.5, Python 3.6 nosy: +r.david.murray messages: +msg247531 stage: needs patch |
| 2015-07-28 16:11:28 | sleepycal | create | |