Skip to content

Commit c6225cf

Browse files
committed
Revert the following revisions, as they don't fix security
problems: 52448, 52468, 52472, 52475, 52646, 52797, 52802, 52863, 52999, 53001, 53101, 53371, 53373, 53383, 53384, 53736, 53812, 53921, 55578, 55580, 55581, 55772, 55775, 56557, 57093, 57094, 58630, 60114
1 parent 9bcc89c commit c6225cf

23 files changed

+71
-211
lines changed

Doc/api/concrete.tex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2730,10 +2730,10 @@ \subsection{DateTime Objects \label{datetime-objects}}
27302730
Various date and time objects are supplied by the \module{datetime}
27312731
module. Before using any of these functions, the header file
27322732
\file{datetime.h} must be included in your source (note that this is
2733-
not included by \file{Python.h}), and the macro
2734-
\cfunction{PyDateTime_IMPORT} must be invoked. The macro puts a
2735-
pointer to a C structure into a static variable,
2736-
\code{PyDateTimeAPI}, that is used by the following macros.
2733+
not include by \file{Python.h}), and macro \cfunction{PyDateTime_IMPORT()}
2734+
must be invoked. The macro arranges to put a pointer to a C structure
2735+
in a static variable \code{PyDateTimeAPI}, which is used by the following
2736+
macros.
27372737

27382738
Type-check macros:
27392739

Doc/lib/libasyncore.tex

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,9 @@ \section{\module{asyncore} ---
199199
\end{methoddesc}
200200

201201
\begin{methoddesc}{bind}{address}
202-
Bind the socket to \var{address}. The socket must not already be
203-
bound. (The format of \var{address} depends on the address family
204-
--- see above.) To mark the socket as re-usable (setting the
205-
\constant{SO_REUSEADDR} option), call the \class{dispatcher}
206-
object's \method{set_reuse_addr()} method.
202+
Bind the socket to \var{address}. The socket must not already
203+
be bound. (The format of \var{address} depends on the address
204+
family --- see above.)
207205
\end{methoddesc}
208206

209207
\begin{methoddesc}{accept}{}

Doc/lib/libcommands.tex

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ \section{\module{commands} ---
1212
return any output generated by the command and, optionally, the exit
1313
status.
1414

15-
The \module{subprocess} module provides more powerful facilities for
16-
spawning new processes and retrieving their results. Using the
17-
\module{subprocess} module is preferable to using the \module{commands}
18-
module.
19-
2015
The \module{commands} module defines the following functions:
2116

2217

@@ -56,7 +51,3 @@ \section{\module{commands} ---
5651
>>> commands.getstatus('/bin/ls')
5752
'-rwxr-xr-x 1 root 13352 Oct 14 1994 /bin/ls'
5853
\end{verbatim}
59-
60-
\begin{seealso}
61-
\seemodule{subprocess}{Module for spawning and managing subprocesses.}
62-
\end{seealso}

Doc/lib/liblogging.tex

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -429,10 +429,8 @@ \subsection{Logger Objects}
429429
\end{methoddesc}
430430

431431
\begin{methoddesc}{findCaller}{}
432-
Finds the caller's source filename and line number. Returns the filename,
433-
line number and function name as a 3-element tuple.
434-
\versionchanged[The function name was added. In earlier versions, the
435-
filename and line number were returned as a 2-element tuple.]{2.4}
432+
Finds the caller's source filename and line number. Returns the filename
433+
and line number as a 2-element tuple.
436434
\end{methoddesc}
437435

438436
\begin{methoddesc}{handle}{record}
@@ -1082,11 +1080,8 @@ \subsubsection{SysLogHandler}
10821080
communicate with a remote \UNIX{} machine whose address is given by
10831081
\var{address} in the form of a \code{(\var{host}, \var{port})}
10841082
tuple. If \var{address} is not specified, \code{('localhost', 514)} is
1085-
used. The address is used to open a UDP socket. An alternative to providing
1086-
a \code{(\var{host}, \var{port})} tuple is providing an address as a string,
1087-
for example "/dev/log". In this case, a Unix domain socket is used to send
1088-
the message to the syslog. If \var{facility} is not specified,
1089-
\constant{LOG_USER} is used.
1083+
used. The address is used to open a UDP socket. If \var{facility} is
1084+
not specified, \constant{LOG_USER} is used.
10901085
\end{classdesc}
10911086

10921087
\begin{methoddesc}{close}{}

Doc/lib/libos.tex

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -357,10 +357,6 @@ \subsection{File Object Creation \label{os-newstreams}}
357357
errors), \code{None} is returned.
358358
Availability: Macintosh, \UNIX, Windows.
359359

360-
The \module{subprocess} module provides more powerful facilities for
361-
spawning new processes and retrieving their results; using that module
362-
is preferable to using this function.
363-
364360
\versionchanged[This function worked unreliably under Windows in
365361
earlier versions of Python. This was due to the use of the
366362
\cfunction{_popen()} function from the libraries provided with
@@ -375,13 +371,8 @@ \subsection{File Object Creation \label{os-newstreams}}
375371
Availability: Macintosh, \UNIX, Windows.
376372
\end{funcdesc}
377373

378-
There are a number of different \function{popen*()} functions that
379-
provide slightly different ways to create subprocesses. Note that the
380-
\module{subprocess} module is easier to use and more powerful;
381-
consider using that module before writing code using the
382-
lower-level \function{popen*()} functions.
383374

384-
For each of the \function{popen*()} variants, if \var{bufsize} is
375+
For each of the following \function{popen()} variants, if \var{bufsize} is
385376
specified, it specifies the buffer size for the I/O pipes.
386377
\var{mode}, if provided, should be the string \code{'b'} or
387378
\code{'t'}; on Windows this is needed to determine whether the file
@@ -1513,13 +1504,7 @@ \subsection{Process Management \label{os-process}}
15131504
\funcline{spawnve}{mode, path, args, env}
15141505
\funcline{spawnvp}{mode, file, args}
15151506
\funcline{spawnvpe}{mode, file, args, env}
1516-
Execute the program \var{path} in a new process.
1517-
1518-
(Note that the \module{subprocess} module provides more powerful
1519-
facilities for spawning new processes and retrieving their results;
1520-
using that module is preferable to using these functions.)
1521-
1522-
If \var{mode} is
1507+
Execute the program \var{path} in a new process. If \var{mode} is
15231508
\constant{P_NOWAIT}, this function returns the process ID of the new
15241509
process; if \var{mode} is \constant{P_WAIT}, returns the process's
15251510
exit code if it exits normally, or \code{-\var{signal}}, where
@@ -1647,10 +1632,6 @@ \subsection{Process Management \label{os-process}}
16471632
a non-native shell, consult your shell documentation.
16481633

16491634
Availability: Macintosh, \UNIX, Windows.
1650-
1651-
The \module{subprocess} module provides more powerful facilities for
1652-
spawning new processes and retrieving their results; using that module
1653-
is preferable to using this function.
16541635
\end{funcdesc}
16551636

16561637
\begin{funcdesc}{times}{}

Doc/lib/libpopen2.tex

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ \section{\module{popen2} ---
1111
input/output/error pipes and obtain their return codes under
1212
\UNIX{} and Windows.
1313

14-
The \module{subprocess} module provides more powerful facilities for
15-
spawning new processes and retrieving their results. Using the
16-
\module{subprocess} module is preferable to using the \module{popen2}
17-
module.
14+
Note that starting with Python 2.0, this functionality is available
15+
using functions from the \refmodule{os} module which have the same
16+
names as the factory functions here, but the order of the return
17+
values is more intuitive in the \refmodule{os} module variants.
1818

1919
The primary interface offered by this module is a trio of factory
2020
functions. For each of these, if \var{bufsize} is specified,
@@ -184,7 +184,3 @@ \subsection{Flow Control Issues \label{popen2-flow-control}}
184184
separate threads to read each of the individual files provided by
185185
whichever \function{popen*()} function or \class{Popen*} class was
186186
used.
187-
188-
\begin{seealso}
189-
\seemodule{subprocess}{Module for spawning and managing subprocesses.}
190-
\end{seealso}

Doc/lib/libsubprocess.tex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ \section{\module{subprocess} --- Subprocess management}
1212
codes. This module intends to replace several other, older modules
1313
and functions, such as:
1414

15+
% XXX Should add pointers to this module to at least the popen2
16+
% and commands sections.
17+
1518
\begin{verbatim}
1619
os.system
1720
os.spawn*

Lib/idlelib/EditorWindow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ def maybesave(self):
703703

704704
def close(self):
705705
reply = self.maybesave()
706-
if str(reply) != "cancel":
706+
if reply != "cancel":
707707
self._close()
708708
return reply
709709

Lib/logging/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2001-2007 by Vinay Sajip. All Rights Reserved.
1+
# Copyright 2001-2005 by Vinay Sajip. All Rights Reserved.
22
#
33
# Permission to use, copy, modify, and distribute this software and its
44
# documentation for any purpose and without fee is hereby granted,
@@ -21,7 +21,7 @@
2121
Should work under Python versions >= 1.5.2, except that source line
2222
information is not available unless 'sys._getframe()' is.
2323
24-
Copyright (C) 2001-2007 Vinay Sajip. All Rights Reserved.
24+
Copyright (C) 2001-2004 Vinay Sajip. All Rights Reserved.
2525
2626
To use, simply 'import logging' and log away!
2727
"""
@@ -68,7 +68,7 @@ def currentframe():
6868
except:
6969
return sys.exc_traceback.tb_frame.f_back
7070

71-
if hasattr(sys, '_getframe'): currentframe = lambda: sys._getframe(3)
71+
if hasattr(sys, '_getframe'): currentframe = sys._getframe
7272
# done filching
7373

7474
# _srcfile is only used in conjunction with sys._getframe().
@@ -1318,14 +1318,14 @@ def disable(level):
13181318
"""
13191319
root.manager.disable = level
13201320

1321-
def shutdown(handlerList=_handlerList):
1321+
def shutdown():
13221322
"""
13231323
Perform any cleanup actions in the logging system (e.g. flushing
13241324
buffers).
13251325
13261326
Should be called at application exit.
13271327
"""
1328-
for h in handlerList[:]:
1328+
for h in _handlerList[:]: # was _handlers.keys():
13291329
#errors might occur, for example, if files are locked
13301330
#we just ignore them if raiseExceptions is not set
13311331
try:

Lib/logging/config.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def fileConfig(fname, defaults=None):
7878
flist = string.split(flist, ",")
7979
formatters = {}
8080
for form in flist:
81-
sectname = "formatter_%s" % string.strip(form)
81+
sectname = "formatter_%s" % form
8282
opts = cp.options(sectname)
8383
if "format" in opts:
8484
fs = cp.get(sectname, "format", 1)
@@ -97,7 +97,6 @@ def fileConfig(fname, defaults=None):
9797
try:
9898
#first, lose the existing handlers...
9999
logging._handlers.clear()
100-
del logging._handlerList[:]
101100
#now set up the new ones...
102101
hlist = cp.get("handlers", "keys")
103102
if len(hlist):
@@ -106,7 +105,7 @@ def fileConfig(fname, defaults=None):
106105
fixups = [] #for inter-handler references
107106
for hand in hlist:
108107
try:
109-
sectname = "handler_%s" % string.strip(hand)
108+
sectname = "handler_%s" % hand
110109
klass = cp.get(sectname, "class")
111110
opts = cp.options(sectname)
112111
if "formatter" in opts:
@@ -141,7 +140,6 @@ def fileConfig(fname, defaults=None):
141140
#at last, the loggers...first the root...
142141
llist = cp.get("loggers", "keys")
143142
llist = string.split(llist, ",")
144-
llist = map(lambda x: string.strip(x), llist)
145143
llist.remove("root")
146144
sectname = "logger_root"
147145
root = logging.root
@@ -156,7 +154,7 @@ def fileConfig(fname, defaults=None):
156154
if len(hlist):
157155
hlist = string.split(hlist, ",")
158156
for hand in hlist:
159-
log.addHandler(handlers[string.strip(hand)])
157+
log.addHandler(handlers[hand])
160158
#and now the others...
161159
#we don't want to lose the existing loggers,
162160
#since other threads may have pointers to them.
@@ -190,7 +188,7 @@ def fileConfig(fname, defaults=None):
190188
if len(hlist):
191189
hlist = string.split(hlist, ",")
192190
for hand in hlist:
193-
logger.addHandler(handlers[string.strip(hand)])
191+
logger.addHandler(handlers[hand])
194192
#Disable any old loggers. There's no point deleting
195193
#them as other threads may continue to hold references
196194
#and by disabling them, you stop them doing any logging.

0 commit comments

Comments
 (0)