[issue23657] Don't do isinstance checks in zipapp

2015-03-22 Thread Roundup Robot
Roundup Robot added the comment: New changeset 0b2993742650 by Paul Moore in branch 'default': #23657 Don't explicitly do an isinstance check for str in zipapp https://hg.python.org/cpython/rev/0b2993742650 -- nosy: +python-dev ___ Python tracker

[issue23657] Don't do isinstance checks in zipapp

2015-03-22 Thread Paul Moore
Changes by Paul Moore p.f.mo...@gmail.com: -- resolution: - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23657 ___

[issue23657] Don't do isinstance checks in zipapp

2015-03-21 Thread Paul Moore
Paul Moore added the comment: Updated patch with fixes for review comments. I did remove the tests for the exact error messages, as testing for a non-zero exit code was actually what I was trying to do, and I found a better way of doing that. -- Added file:

[issue23657] Don't do isinstance checks in zipapp

2015-03-20 Thread Paul Moore
Paul Moore added the comment: Updated patch. Added the requested test and a set of tests for the command line API. This also highlighted a bug in the command line --info option, which is also fixed. Coverage now: Name Stmts Miss Cover Missing

[issue23657] Don't do isinstance checks in zipapp

2015-03-16 Thread Paul Moore
Paul Moore added the comment: Updated version of the patch with tests, plus doc update noting that path objects are explicitly supported. -- Added file: http://bugs.python.org/file38513/duck_typed_zipapp.patch ___ Python tracker

[issue23657] Don't do isinstance checks in zipapp

2015-03-14 Thread Brett Cannon
Brett Cannon added the comment: Depends on whether you want to support pathlib.Path objects explicitly. =) If so then yes, we should add tests. Which reminds me, it might be time for you to request commit privileges so you can commit patches like this yourself. --

[issue23657] Don't do isinstance checks in zipapp

2015-03-14 Thread Paul Moore
Paul Moore added the comment: Cool, I'll look at sorting it out. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23657 ___ ___ Python-bugs-list

[issue23657] Don't do isinstance checks in zipapp

2015-03-13 Thread Brett Cannon
New submission from Brett Cannon: As it stand, zipapp's code checks for str and then otherwise assumes an object is a file-like object. It might work out better to do some duck typing and simply check if an object has 'read' and 'readline' attributes then it's a file-like object and otherwise

[issue23657] Don't do isinstance checks in zipapp

2015-03-13 Thread Paul Moore
Paul Moore added the comment: That sounds reasonable. I'll have a look at this. The code was originally based on a similar pattern in the zipfile module, so maybe zipfile should be changed in the same way? -- ___ Python tracker

[issue23657] Don't do isinstance checks in zipapp

2015-03-13 Thread Paul Moore
Paul Moore added the comment: Looks good. Would it be worth adding tests for providing pathlib.Path objects, or is that overkill? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23657 ___

[issue23657] Don't do isinstance checks in zipapp

2015-03-13 Thread Brett Cannon
Brett Cannon added the comment: Here is a proposed patch that does what I was thinking. What do you think? As for updating zipfile, it's possible but slightly risky because of backwards-compatibility. Since this is all-new code there is no worry about breaking someone's pre-existing code