Skip to content

Commit 0710d75

Browse files
authored
bpo-29770: remove outdated PYO related info (pythonGH-590)
1 parent 70ee0cd commit 0710d75

File tree

10 files changed

+25
-31
lines changed

10 files changed

+25
-31
lines changed

Doc/glossary.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ Glossary
155155
bytecode
156156
Python source code is compiled into bytecode, the internal representation
157157
of a Python program in the CPython interpreter. The bytecode is also
158-
cached in ``.pyc`` and ``.pyo`` files so that executing the same file is
158+
cached in ``.pyc`` files so that executing the same file is
159159
faster the second time (recompilation from source to bytecode can be
160160
avoided). This "intermediate language" is said to run on a
161161
:term:`virtual machine` that executes the machine code corresponding to

Doc/library/zipfile.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -464,12 +464,12 @@ The :class:`PyZipFile` constructor takes the same parameters as the
464464
added to the archive, compiling if necessary.
465465

466466
If *pathname* is a file, the filename must end with :file:`.py`, and
467-
just the (corresponding :file:`\*.py[co]`) file is added at the top level
467+
just the (corresponding :file:`\*.pyc`) file is added at the top level
468468
(no path information). If *pathname* is a file that does not end with
469469
:file:`.py`, a :exc:`RuntimeError` will be raised. If it is a directory,
470470
and the directory is not a package directory, then all the files
471-
:file:`\*.py[co]` are added at the top level. If the directory is a
472-
package directory, then all :file:`\*.py[co]` are added under the package
471+
:file:`\*.pyc` are added at the top level. If the directory is a
472+
package directory, then all :file:`\*.pyc` are added under the package
473473
name as a file path, and if any subdirectories are package directories,
474474
all of these are added recursively.
475475

Doc/library/zipimport.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
--------------
1010

1111
This module adds the ability to import Python modules (:file:`\*.py`,
12-
:file:`\*.py[co]`) and packages from ZIP-format archives. It is usually not
12+
:file:`\*.pyc`) and packages from ZIP-format archives. It is usually not
1313
needed to use the :mod:`zipimport` module explicitly; it is automatically used
1414
by the built-in :keyword:`import` mechanism for :data:`sys.path` items that are paths
1515
to ZIP archives.

Doc/using/cmdline.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -532,8 +532,8 @@ conflict.
532532

533533
.. envvar:: PYTHONDONTWRITEBYTECODE
534534

535-
If this is set to a non-empty string, Python won't try to write ``.pyc`` or
536-
``.pyo`` files on the import of source modules. This is equivalent to
535+
If this is set to a non-empty string, Python won't try to write ``.pyc``
536+
files on the import of source modules. This is equivalent to
537537
specifying the :option:`-B` option.
538538

539539

Modules/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static const char usage_1[] = "\
5353
Options and arguments (and corresponding environment variables):\n\
5454
-b : issue warnings about str(bytes_instance), str(bytearray_instance)\n\
5555
and comparing bytes/bytearray with str. (-bb: issue errors)\n\
56-
-B : don't write .py[co] files on import; also PYTHONDONTWRITEBYTECODE=x\n\
56+
-B : don't write .pyc files on import; also PYTHONDONTWRITEBYTECODE=x\n\
5757
-c cmd : program passed in as string (terminates option list)\n\
5858
-d : debug output from parser; also PYTHONDEBUG=x\n\
5959
-E : ignore PYTHON* environment variables (such as PYTHONPATH)\n\

Modules/zipimport.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,7 @@ get_decompress_func(void)
11011101
_Py_IDENTIFIER(decompress);
11021102

11031103
if (importing_zlib != 0)
1104-
/* Someone has a zlib.py[co] in their Zip file;
1104+
/* Someone has a zlib.pyc in their Zip file;
11051105
let's avoid a stack overflow. */
11061106
return NULL;
11071107
importing_zlib = 1;
@@ -1260,7 +1260,7 @@ eq_mtime(time_t t1, time_t t2)
12601260
return d <= 1;
12611261
}
12621262

1263-
/* Given the contents of a .py[co] file in a buffer, unmarshal the data
1263+
/* Given the contents of a .pyc file in a buffer, unmarshal the data
12641264
and return the code object. Return None if it the magic word doesn't
12651265
match (we do this instead of raising an exception as we fall back
12661266
to .py if available and we don't want to mask other errors).
@@ -1400,7 +1400,7 @@ get_mtime_of_source(ZipImporter *self, PyObject *path)
14001400
PyObject *toc_entry, *stripped;
14011401
time_t mtime;
14021402

1403-
/* strip 'c' or 'o' from *.py[co] */
1403+
/* strip 'c' from *.pyc */
14041404
if (PyUnicode_READY(path) == -1)
14051405
return (time_t)-1;
14061406
stripped = PyUnicode_FromKindAndData(PyUnicode_KIND(path),

PC/getpathp.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ exists(wchar_t *filename)
185185
may extend 'filename' by one character.
186186
*/
187187
static int
188-
ismodule(wchar_t *filename, int update_filename) /* Is module -- check for .pyc/.pyo too */
188+
ismodule(wchar_t *filename, int update_filename) /* Is module -- check for .pyc too */
189189
{
190190
size_t n;
191191

@@ -196,7 +196,7 @@ ismodule(wchar_t *filename, int update_filename) /* Is module -- check for .pyc/
196196
n = wcsnlen_s(filename, MAXPATHLEN+1);
197197
if (n < MAXPATHLEN) {
198198
int exist = 0;
199-
filename[n] = Py_OptimizeFlag ? L'o' : L'c';
199+
filename[n] = L'c';
200200
filename[n + 1] = L'\0';
201201
exist = exists(filename);
202202
if (!update_filename)

PCbuild/rmpyc.py

+7-13
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
1-
# Remove all the .pyc and .pyo files under ../Lib.
1+
# Remove all the .pyc files under ../Lib.
22

33

44
def deltree(root):
55
import os
66
from os.path import join
77

8-
npyc = npyo = 0
8+
npyc = 0
99
for root, dirs, files in os.walk(root):
1010
for name in files:
11-
delete = False
12-
if name.endswith('.pyc'):
13-
delete = True
11+
# to be thorough
12+
if name.endswith(('.pyc', '.pyo')):
1413
npyc += 1
15-
elif name.endswith('.pyo'):
16-
delete = True
17-
npyo += 1
18-
19-
if delete:
2014
os.remove(join(root, name))
2115

22-
return npyc, npyo
16+
return npyc
2317

24-
npyc, npyo = deltree("../Lib")
25-
print(npyc, ".pyc deleted,", npyo, ".pyo deleted")
18+
npyc = deltree("../Lib")
19+
print(npyc, ".pyc deleted")

PCbuild/rt.bat

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ rem Usage: rt [-d] [-O] [-q] [-x64] regrtest_args
44
rem -d Run Debug build (python_d.exe). Else release build.
55
rem -O Run python.exe or python_d.exe (see -d) with -O.
66
rem -q "quick" -- normally the tests are run twice, the first time
7-
rem after deleting all the .py[co] files reachable from Lib/.
8-
rem -q runs the tests just once, and without deleting .py[co] files.
7+
rem after deleting all the .pyc files reachable from Lib/.
8+
rem -q runs the tests just once, and without deleting .pyc files.
99
rem -x64 Run the 64-bit build of python (or python_d if -d was specified)
1010
rem from the 'amd64' dir instead of the 32-bit build in this dir.
1111
rem All leading instances of these switches are shifted off, and
@@ -45,7 +45,7 @@ set exe=%prefix%python%suffix%.exe
4545
set cmd="%exe%" %dashO% -u -Wd -E -bb -m test %regrtestargs%
4646
if defined qmode goto Qmode
4747

48-
echo Deleting .pyc/.pyo files ...
48+
echo Deleting .pyc files ...
4949
"%exe%" "%pcbuild%rmpyc.py"
5050

5151
echo Cleaning _pth files ...
@@ -55,7 +55,7 @@ echo on
5555
%cmd%
5656
@echo off
5757

58-
echo About to run again without deleting .pyc/.pyo first:
58+
echo About to run again without deleting .pyc first:
5959
pause
6060

6161
:Qmode

Python/pylifecycle.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ int Py_BytesWarningFlag; /* Warn on str(bytes) and str(buffer) */
8888
int Py_UseClassExceptionsFlag = 1; /* Needed by bltinmodule.c: deprecated */
8989
int Py_FrozenFlag; /* Needed by getpath.c */
9090
int Py_IgnoreEnvironmentFlag; /* e.g. PYTHONPATH, PYTHONHOME */
91-
int Py_DontWriteBytecodeFlag; /* Suppress writing bytecode files (*.py[co]) */
91+
int Py_DontWriteBytecodeFlag; /* Suppress writing bytecode files (*.pyc) */
9292
int Py_NoUserSiteDirectory = 0; /* for -s and site.py */
9393
int Py_UnbufferedStdioFlag = 0; /* Unbuffered binary std{in,out,err} */
9494
int Py_HashRandomizationFlag = 0; /* for -R and PYTHONHASHSEED */

0 commit comments

Comments
 (0)