mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Fix off-by-one error.
This commit is contained in:
parent
fadcd317fa
commit
2cc0cc54a2
1 changed files with 2 additions and 2 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue