summaryrefslogtreecommitdiff
path: root/Python/import.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2011-10-23 18:41:56 +0200
committerMartin v. Löwis <martin@v.loewis.de>2011-10-23 18:41:56 +0200
commit012400c9fe4281ff97e7dee256cd2a05649a54ce (patch)
treea36a4f3b563ff5192bb3d3ae5ccd8f1624afd059 /Python/import.c
parentc7e9dd65640704b9ef0174a6c5fc9d82fbebf492 (diff)
downloadcpython-012400c9fe4281ff97e7dee256cd2a05649a54ce.tar.gz
Fix off-by-one error.
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/import.c b/Python/import.c
index ebaaeacebd..736ce7717c 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -955,7 +955,7 @@ make_compiled_pathname(PyObject *pathstr, int debug)
/* result = pathstr[:fname] + "__pycache__" + SEP +
pathstr[fname:ext] + tag + ".py[co]" */
taglen = strlen(pyc_tag);
- result = PyUnicode_New(ext + pycache_len + taglen + 4,
+ result = PyUnicode_New(ext + pycache_len + 1 + taglen + 4,
PyUnicode_MAX_CHAR_VALUE(pathstr));
if (!result)
return NULL;
@@ -963,7 +963,7 @@ make_compiled_pathname(PyObject *pathstr, int debug)
data = PyUnicode_DATA(result);
PyUnicode_CopyCharacters(result, 0, pathstr, 0, fname);
pos = fname;
- for (i = 0; i < pycache_len - 1; i++)
+ for (i = 0; i < pycache_len; i++)
PyUnicode_WRITE(kind, data, pos++, CACHEDIR[i]);
PyUnicode_WRITE(kind, data, pos++, SEP);
PyUnicode_CopyCharacters(result, pos, pathstr,