]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-29770: remove outdated PYO related info (GH-590) (GH-613)
authorXiang Zhang <angwerzx@126.com>
Sat, 11 Mar 2017 06:12:29 +0000 (14:12 +0800)
committerGitHub <noreply@github.com>
Sat, 11 Mar 2017 06:12:29 +0000 (14:12 +0800)
Doc/glossary.rst
Doc/library/zipfile.rst
Doc/library/zipimport.rst
Doc/using/cmdline.rst
Modules/main.c
Modules/zipimport.c
PC/getpathp.c
PCbuild/rmpyc.py
PCbuild/rt.bat
Python/pylifecycle.c

index 45b794f48ef7c9eed1045170fce13bb3d04f297e..4a8bb8e633b3aa4f0235122b93b7b62c858eaa41 100644 (file)
@@ -127,7 +127,7 @@ Glossary
    bytecode
       Python source code is compiled into bytecode, the internal representation
       of a Python program in the CPython interpreter.  The bytecode is also
-      cached in ``.pyc`` and ``.pyo`` files so that executing the same file is
+      cached in ``.pyc`` files so that executing the same file is
       faster the second time (recompilation from source to bytecode can be
       avoided).  This "intermediate language" is said to run on a
       :term:`virtual machine` that executes the machine code corresponding to
index d144ae36f1e7cbc7b3bbd6bf4eb117f3d85765dd..629b7ed55a145ad88ad06bd7a85f2bc31ba127c7 100644 (file)
@@ -418,12 +418,12 @@ The :class:`PyZipFile` constructor takes the same parameters as the
       added to the archive, compiling if necessary.
 
       If *pathname* is a file, the filename must end with :file:`.py`, and
-      just the (corresponding :file:`\*.py[co]`) file is added at the top level
+      just the (corresponding :file:`\*.pyc`) file is added at the top level
       (no path information).  If *pathname* is a file that does not end with
       :file:`.py`, a :exc:`RuntimeError` will be raised.  If it is a directory,
       and the directory is not a package directory, then all the files
-      :file:`\*.py[co]` are added at the top level.  If the directory is a
-      package directory, then all :file:`\*.py[co]` are added under the package
+      :file:`\*.pyc` are added at the top level.  If the directory is a
+      package directory, then all :file:`\*.pyc` are added under the package
       name as a file path, and if any subdirectories are package directories,
       all of these are added recursively.
 
index 46b8c245f7b3fe2568e766c24cfc253a4386cdf4..eaae2bb04b74822a0de2ef85706cb819426ea76a 100644 (file)
@@ -9,7 +9,7 @@
 --------------
 
 This module adds the ability to import Python modules (:file:`\*.py`,
-:file:`\*.py[co]`) and packages from ZIP-format archives. It is usually not
+:file:`\*.pyc`) and packages from ZIP-format archives. It is usually not
 needed to use the :mod:`zipimport` module explicitly; it is automatically used
 by the built-in :keyword:`import` mechanism for :data:`sys.path` items that are paths
 to ZIP archives.
index 611779618e71d6e9cefc30cad60a9e8e9eced04c..906d31f3859245f96898c4820cc1e98d825b5ecc 100644 (file)
@@ -518,8 +518,8 @@ conflict.
 
 .. envvar:: PYTHONDONTWRITEBYTECODE
 
-   If this is set to a non-empty string, Python won't try to write ``.pyc`` or
-   ``.pyo`` files on the import of source modules.  This is equivalent to
+   If this is set to a non-empty string, Python won't try to write ``.pyc``
+   files on the import of source modules.  This is equivalent to
    specifying the :option:`-B` option.
 
 
index 75ee2f607ca83d1ada94f340961a52ee01292a83..d36db6d8b511af43291a1d7b102949f78c96884e 100644 (file)
@@ -50,7 +50,7 @@ static char *usage_1 = "\
 Options and arguments (and corresponding environment variables):\n\
 -b     : issue warnings about str(bytes_instance), str(bytearray_instance)\n\
          and comparing bytes/bytearray with str. (-bb: issue errors)\n\
--B     : don't write .py[co] files on import; also PYTHONDONTWRITEBYTECODE=x\n\
+-B     : don't write .pyc files on import; also PYTHONDONTWRITEBYTECODE=x\n\
 -c cmd : program passed in as string (terminates option list)\n\
 -d     : debug output from parser; also PYTHONDEBUG=x\n\
 -E     : ignore PYTHON* environment variables (such as PYTHONPATH)\n\
index a693fbbf6e280ee580d2e317bc4e1fc96408eb51..feef98f582b580809713c40218268d81ea96de87 100644 (file)
@@ -1104,7 +1104,7 @@ get_decompress_func(void)
     _Py_IDENTIFIER(decompress);
 
     if (importing_zlib != 0)
-        /* Someone has a zlib.py[co] in their Zip file;
+        /* Someone has a zlib.pyc in their Zip file;
            let's avoid a stack overflow. */
         return NULL;
     importing_zlib = 1;
@@ -1264,11 +1264,11 @@ eq_mtime(time_t t1, time_t t2)
 }
 
 /* Issue #29537: handle issue27286 bytecode incompatibility
- *   See Lib/importlib/_bootstrap_external.py for general discussion
+ * See Lib/importlib/_bootstrap_external.py for general discussion
  */
 extern PY_UINT32_T _Py_BACKCOMPAT_MAGIC_NUMBER;
 
-/* Given the contents of a .py[co] file in a buffer, unmarshal the data
+/* Given the contents of a .pyc file in a buffer, unmarshal the data
    and return the code object. Return None if it the magic word doesn't
    match (we do this instead of raising an exception as we fall back
    to .py if available and we don't want to mask other errors).
@@ -1414,7 +1414,7 @@ get_mtime_of_source(ZipImporter *self, PyObject *path)
     PyObject *toc_entry, *stripped;
     time_t mtime;
 
-    /* strip 'c' or 'o' from *.py[co] */
+    /* strip 'c' from *.pyc */
     if (PyUnicode_READY(path) == -1)
         return (time_t)-1;
     stripped = PyUnicode_FromKindAndData(PyUnicode_KIND(path),
index c7ddf1ea6b33eb6d55457eab82f9802a2512b0cd..47a571e272b00dd9d1b2154d565dcada8b4668d5 100644 (file)
@@ -133,7 +133,7 @@ exists(wchar_t *filename)
    may extend 'filename' by one character.
 */
 static int
-ismodule(wchar_t *filename, int update_filename) /* Is module -- check for .pyc/.pyo too */
+ismodule(wchar_t *filename, int update_filename) /* Is module -- check for .pyc too */
 {
     int n;
 
@@ -144,7 +144,7 @@ ismodule(wchar_t *filename, int update_filename) /* Is module -- check for .pyc/
     n = wcsnlen_s(filename, MAXPATHLEN+1);
     if (n < MAXPATHLEN) {
         int exist = 0;
-        filename[n] = Py_OptimizeFlag ? L'o' : L'c';
+        filename[n] = L'c';
         filename[n + 1] = L'\0';
         exist = exists(filename);
         if (!update_filename)
index a1e75bb7ae5b4ba1706f47c7b373da9763f11243..0b58f687729f7e7a581e0653720115a496e9b114 100644 (file)
@@ -1,25 +1,19 @@
-# Remove all the .pyc and .pyo files under ../Lib.
+# Remove all the .pyc files under ../Lib.
 
 
 def deltree(root):
     import os
     from os.path import join
 
-    npyc = npyo = 0
+    npyc = 0
     for root, dirs, files in os.walk(root):
         for name in files:
-            delete = False
-            if name.endswith('.pyc'):
-                delete = True
+            # to be thorough
+            if name.endswith(('.pyc', '.pyo')):
                 npyc += 1
-            elif name.endswith('.pyo'):
-                delete = True
-                npyo += 1
-
-            if delete:
                 os.remove(join(root, name))
 
-    return npyc, npyo
+    return npyc
 
-npyc, npyo = deltree("../Lib")
-print(npyc, ".pyc deleted,", npyo, ".pyo deleted")
+npyc = deltree("../Lib")
+print(npyc, ".pyc deleted")
index 2d93b80a499fa5ee43a3c851cf8d1a102c6bab4c..20568549b1599d9cab28b933044142a25854a07a 100644 (file)
@@ -4,8 +4,8 @@ rem Usage:  rt [-d] [-O] [-q] [-x64] regrtest_args
 rem -d   Run Debug build (python_d.exe).  Else release build.\r
 rem -O   Run python.exe or python_d.exe (see -d) with -O.\r
 rem -q   "quick" -- normally the tests are run twice, the first time\r
-rem      after deleting all the .py[co] files reachable from Lib/.\r
-rem      -q runs the tests just once, and without deleting .py[co] files.\r
+rem      after deleting all the .pyc files reachable from Lib/.\r
+rem      -q runs the tests just once, and without deleting .pyc files.\r
 rem -x64 Run the 64-bit build of python (or python_d if -d was specified)\r
 rem      from the 'amd64' dir instead of the 32-bit build in this dir.\r
 rem All leading instances of these switches are shifted off, and\r
@@ -45,14 +45,14 @@ set exe=%prefix%python%suffix%.exe
 set cmd="%exe%" %dashO% -Wd -E -bb "%pcbuild%..\lib\test\regrtest.py" %regrtestargs%\r
 if defined qmode goto Qmode\r
 \r
-echo Deleting .pyc/.pyo files ...\r
+echo Deleting .pyc files ...\r
 "%exe%" "%pcbuild%rmpyc.py"\r
 \r
 echo on\r
 %cmd%\r
 @echo off\r
 \r
-echo About to run again without deleting .pyc/.pyo first:\r
+echo About to run again without deleting .pyc first:\r
 pause\r
 \r
 :Qmode\r
index ce52990496931ca13937dbfd3e7f8c1defec070e..87dadc164c264570a8ce50ac5a6c5185295adc62 100644 (file)
@@ -85,7 +85,7 @@ int Py_BytesWarningFlag; /* Warn on str(bytes) and str(buffer) */
 int Py_UseClassExceptionsFlag = 1; /* Needed by bltinmodule.c: deprecated */
 int Py_FrozenFlag; /* Needed by getpath.c */
 int Py_IgnoreEnvironmentFlag; /* e.g. PYTHONPATH, PYTHONHOME */
-int Py_DontWriteBytecodeFlag; /* Suppress writing bytecode files (*.py[co]) */
+int Py_DontWriteBytecodeFlag; /* Suppress writing bytecode files (*.pyc) */
 int Py_NoUserSiteDirectory = 0; /* for -s and site.py */
 int Py_UnbufferedStdioFlag = 0; /* Unbuffered binary std{in,out,err} */
 int Py_HashRandomizationFlag = 0; /* for -R and PYTHONHASHSEED */