Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4139)

#14905: zipimport.c needs to support namespace packages when no 'directory' entry exists

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 months, 2 weeks ago by eric
Modified:
3 months ago
Reviewers:
berker.peksag, ericsnowcurrently, stephen, storchaka
CC:
PJ Eby, ronaldoussoren, Nick Coghlan, jerub, eric.smith, Arfrever.FTA_GMail.Com, eric.snow, storchaka, jpaugh, pconnell, isoschiz
Visibility:
Public.

Patch Set 1 #

Total comments: 25

Patch Set 2 #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Lib/test/test_namespace_pkgs.py View 1 2 chunks +3 lines, -4 lines 0 comments Download
Misc/NEWS View 1 1 chunk +3 lines, -0 lines 0 comments Download
Modules/zipimport.c View 1 3 chunks +48 lines, -7 lines 6 comments Download

Messages

Total messages: 6
berkerpeksag
http://bugs.python.org/review/14905/diff/5345/Modules/zipimport.c File Modules/zipimport.c (right): http://bugs.python.org/review/14905/diff/5345/Modules/zipimport.c#newcode979 Modules/zipimport.c:979: dirnameobj = PyUnicode_Substring(nameobj, 0, i+1); i + 1 http://bugs.python.org/review/14905/diff/5345/Modules/zipimport.c#newcode991 ...
9 months, 2 weeks ago #1
eric.snow
While no expert in C or the C-API, a few things jumped out at me. ...
9 months, 2 weeks ago #2
jerub
I've responded to the review points. Am uploading a new patch now. http://bugs.python.org/review/14905/diff/5345/Modules/zipimport.c File Modules/zipimport.c ...
9 months ago #3
storchaka
http://bugs.python.org/review/14905/diff/5772/Modules/zipimport.c File Modules/zipimport.c (right): http://bugs.python.org/review/14905/diff/5772/Modules/zipimport.c#newcode484 Modules/zipimport.c:484: if (err == -1) This is an unrelated change. ...
3 months ago #4
storchaka
3 months ago #5
eric.smith
3 months ago #6
http://bugs.python.org/review/14905/diff/5772/Modules/zipimport.c
File Modules/zipimport.c (right):

http://bugs.python.org/review/14905/diff/5772/Modules/zipimport.c#newcode973
Modules/zipimport.c:973: 
Some comments here about why this loop exists would be helpful. If I stumbled
across this code, it would take me a while to figure out what it's doing.

In fact, maybe moving this entire inner loop out into a function
add_missing_dirs(files, nameobj) (or whatever params are needed) might be a good
idea.

http://bugs.python.org/review/14905/diff/5772/Modules/zipimport.c#newcode979
Modules/zipimport.c:979: Py_UCS4 c = PyUnicode_READ_CHAR(nameobj, i);
I think using PyUnicode_FindChar would be better than looping over every
individual character. Speed probably won't make a difference (and might be
worse), but it would improve readability.

http://bugs.python.org/review/14905/diff/5772/Modules/zipimport.c#newcode998
Modules/zipimport.c:998: toc_entry = Py_BuildValue("Ohllnhhl", path, 0, 0, 0, 0,
0, 0, 0);
On 2013/02/16 23:36:26, storchaka wrote:
> Use "N" format for path and don't decref path.

I think creating a function new_toc_entry(path, ...) would be a good idea.
Having 2 calls to Py_BuildValue that must be in sync is a maintenance problem
waiting to happen.
Sign in to reply to this message.

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7