diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2011-10-23 16:41:56 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2011-10-23 16:41:56 (GMT) |
commit | 2cc0cc54a2542a448801df61f9429112256676bf (patch) | |
tree | 43afe4e103bace1cdb94fedfb6bc6cb01895d779 /Python | |
parent | fadcd317fa3df387a009afc4137e2b14ed8905e4 (diff) | |
download | cpython-2cc0cc54a2542a448801df61f9429112256676bf.zip cpython-2cc0cc54a2542a448801df61f9429112256676bf.tar.gz cpython-2cc0cc54a2542a448801df61f9429112256676bf.tar.bz2 |
Fix off-by-one error.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/import.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/import.c b/Python/import.c index ebaaeac..736ce77 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, |