Mercurial > cpython-lru_cache-weakref
diff Python/import.c @ 68737:238cbd559e9c
Fix imp.cache_from_source() if the directory name contains a dot
If the directory name contains a dot but not the filename, don't strip at the
dot.
| author | Victor Stinner <victor.stinner@haypocalc.com> |
|---|---|
| date | Mon, 14 Mar 2011 15:05:12 -0400 |
| parents | c17bc2026145 |
| children | c4361bab6914 |
line wrap: on
line diff
--- a/Python/import.c Mon Mar 14 14:53:28 2011 -0400 +++ b/Python/import.c Mon Mar 14 15:05:12 2011 -0400 @@ -943,12 +943,12 @@ Py_UNICODE_strcat(buf, CACHEDIR_UNICODE); i += Py_UNICODE_strlen(CACHEDIR_UNICODE) - 1; buf[i++] = sep; - buf[i++] = '\0'; + buf[i] = '\0'; /* Add the base filename, but remove the .py or .pyw extension, since the tag name must go before the extension. */ Py_UNICODE_strcat(buf, pathname + save); - pos = Py_UNICODE_strrchr(buf, '.'); + pos = Py_UNICODE_strrchr(buf + i, '.'); if (pos != NULL) *++pos = '\0'; Py_UNICODE_strcat(buf, PYC_TAG_UNICODE);
