summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2015-04-13 18:21:02 (GMT)
committerBrett Cannon <brett@python.org>2015-04-13 18:21:02 (GMT)
commitf299abdafa0f2b6eb7abae274861b19b361c96bc (patch)
treeafc3a2bf560e30c7725510eda3b57d71ceddba00 /Modules
parenta63cc212348e276c8ede32773313c60ff7fda651 (diff)
downloadcpython-f299abdafa0f2b6eb7abae274861b19b361c96bc.zip
cpython-f299abdafa0f2b6eb7abae274861b19b361c96bc.tar.gz
cpython-f299abdafa0f2b6eb7abae274861b19b361c96bc.tar.bz2
Issue #23731: Implement PEP 488.
The concept of .pyo files no longer exists. Now .pyc files have an optional `opt-` tag which specifies if any extra optimizations beyond the peepholer were applied.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/getpath.c5
-rw-r--r--Modules/zipimport.c17
2 files changed, 4 insertions, 18 deletions
diff --git a/Modules/getpath.c b/Modules/getpath.c
index 429bef3..03d292c 100644
--- a/Modules/getpath.c
+++ b/Modules/getpath.c
@@ -170,14 +170,14 @@ isfile(wchar_t *filename) /* Is file, not directory */
static int
-ismodule(wchar_t *filename) /* Is module -- check for .pyc/.pyo too */
+ismodule(wchar_t *filename) /* Is module -- check for .pyc too */
{
if (isfile(filename))
return 1;
/* Check for the compiled version of prefix. */
if (wcslen(filename) < MAXPATHLEN) {
- wcscat(filename, Py_OptimizeFlag ? L"o" : L"c");
+ wcscat(filename, L"c");
if (isfile(filename))
return 1;
}
@@ -891,4 +891,3 @@ Py_GetProgramFullPath(void)
#ifdef __cplusplus
}
#endif
-
diff --git a/Modules/zipimport.c b/Modules/zipimport.c
index 38dc0c4..06abb31 100644
--- a/Modules/zipimport.c
+++ b/Modules/zipimport.c
@@ -20,15 +20,13 @@ _Py_IDENTIFIER(replace);
/* zip_searchorder defines how we search for a module in the Zip
archive: we first search for a package __init__, then for
- non-package .pyc, .pyo and .py entries. The .pyc and .pyo entries
+ non-package .pyc, and .py entries. The .pyc entries
are swapped by initzipimport() if we run in optimized mode. Also,
'/' is replaced by SEP there. */
static struct st_zip_searchorder zip_searchorder[] = {
{"/__init__.pyc", IS_PACKAGE | IS_BYTECODE},
- {"/__init__.pyo", IS_PACKAGE | IS_BYTECODE},
{"/__init__.py", IS_PACKAGE | IS_SOURCE},
{".pyc", IS_BYTECODE},
- {".pyo", IS_BYTECODE},
{".py", IS_SOURCE},
{"", 0}
};
@@ -1318,7 +1316,7 @@ parse_dostime(int dostime, int dosdate)
return mktime(&stm);
}
-/* Given a path to a .pyc or .pyo file in the archive, return the
+/* Given a path to a .pyc file in the archive, return the
modification time of the matching .py file, or 0 if no source
is available. */
static time_t
@@ -1481,17 +1479,6 @@ PyInit_zipimport(void)
/* Correct directory separator */
zip_searchorder[0].suffix[0] = SEP;
zip_searchorder[1].suffix[0] = SEP;
- zip_searchorder[2].suffix[0] = SEP;
- if (Py_OptimizeFlag) {
- /* Reverse *.pyc and *.pyo */
- struct st_zip_searchorder tmp;
- tmp = zip_searchorder[0];
- zip_searchorder[0] = zip_searchorder[1];
- zip_searchorder[1] = tmp;
- tmp = zip_searchorder[3];
- zip_searchorder[3] = zip_searchorder[4];
- zip_searchorder[4] = tmp;
- }
mod = PyModule_Create(&zipimportmodule);
if (mod == NULL)