summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2008-03-02 17:47:51 +0000
committerMartin v. Löwis <martin@v.loewis.de>2008-03-02 17:47:51 +0000
commitc6225cf72284af6a591bddff0e3786cf2317feac (patch)
tree66e01acfdb7f06c5e571372dbd8c6ba2837635b0
parent9bcc89c7664d61a78fe17dac20a2cb034c8ceb08 (diff)
downloadcpython-c6225cf72284af6a591bddff0e3786cf2317feac.tar.gz
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
-rw-r--r--Doc/api/concrete.tex8
-rw-r--r--Doc/lib/libasyncore.tex8
-rw-r--r--Doc/lib/libcommands.tex9
-rw-r--r--Doc/lib/liblogging.tex13
-rw-r--r--Doc/lib/libos.tex23
-rw-r--r--Doc/lib/libpopen2.tex12
-rw-r--r--Doc/lib/libsubprocess.tex3
-rw-r--r--Lib/idlelib/EditorWindow.py2
-rw-r--r--Lib/logging/__init__.py10
-rw-r--r--Lib/logging/config.py10
-rw-r--r--Lib/logging/handlers.py21
-rw-r--r--Lib/random.py2
-rw-r--r--Lib/subprocess.py14
-rwxr-xr-xLib/test/test_dbm.py4
-rwxr-xr-xLib/test/test_gdbm.py4
-rw-r--r--Lib/test/test_multibytecodec.py15
-rw-r--r--Lib/test/test_sha.py19
-rw-r--r--Lib/trace.py2
-rwxr-xr-xLib/uu.py4
-rwxr-xr-xMac/BuildScript/build-installer.py67
-rw-r--r--Misc/NEWS18
-rw-r--r--Modules/cjkcodecs/multibytecodec.c6
-rw-r--r--Python/ceval.c8
23 files changed, 71 insertions, 211 deletions
diff --git a/Doc/api/concrete.tex b/Doc/api/concrete.tex
index 6b56844540..5e2b2e940b 100644
--- a/Doc/api/concrete.tex
+++ b/Doc/api/concrete.tex
@@ -2730,10 +2730,10 @@ rather than explicitly calling \cfunction{PyGen_New}.
Various date and time objects are supplied by the \module{datetime}
module. Before using any of these functions, the header file
\file{datetime.h} must be included in your source (note that this is
-not included by \file{Python.h}), and the macro
-\cfunction{PyDateTime_IMPORT} must be invoked. The macro puts a
-pointer to a C structure into a static variable,
-\code{PyDateTimeAPI}, that is used by the following macros.
+not include by \file{Python.h}), and macro \cfunction{PyDateTime_IMPORT()}
+must be invoked. The macro arranges to put a pointer to a C structure
+in a static variable \code{PyDateTimeAPI}, which is used by the following
+macros.
Type-check macros:
diff --git a/Doc/lib/libasyncore.tex b/Doc/lib/libasyncore.tex
index 131b549890..ee50d1889d 100644
--- a/Doc/lib/libasyncore.tex
+++ b/Doc/lib/libasyncore.tex
@@ -199,11 +199,9 @@ Most of these are nearly identical to their socket partners.
\end{methoddesc}
\begin{methoddesc}{bind}{address}
- Bind the socket to \var{address}. The socket must not already be
- bound. (The format of \var{address} depends on the address family
- --- see above.) To mark the socket as re-usable (setting the
- \constant{SO_REUSEADDR} option), call the \class{dispatcher}
- object's \method{set_reuse_addr()} method.
+ Bind the socket to \var{address}. The socket must not already
+ be bound. (The format of \var{address} depends on the address
+ family --- see above.)
\end{methoddesc}
\begin{methoddesc}{accept}{}
diff --git a/Doc/lib/libcommands.tex b/Doc/lib/libcommands.tex
index 53b8a20707..74e7023a79 100644
--- a/Doc/lib/libcommands.tex
+++ b/Doc/lib/libcommands.tex
@@ -12,11 +12,6 @@ The \module{commands} module contains wrapper functions for
return any output generated by the command and, optionally, the exit
status.
-The \module{subprocess} module provides more powerful facilities for
-spawning new processes and retrieving their results. Using the
-\module{subprocess} module is preferable to using the \module{commands}
-module.
-
The \module{commands} module defines the following functions:
@@ -56,7 +51,3 @@ Example:
>>> commands.getstatus('/bin/ls')
'-rwxr-xr-x 1 root 13352 Oct 14 1994 /bin/ls'
\end{verbatim}
-
-\begin{seealso}
- \seemodule{subprocess}{Module for spawning and managing subprocesses.}
-\end{seealso}
diff --git a/Doc/lib/liblogging.tex b/Doc/lib/liblogging.tex
index e00880d412..414555ad0e 100644
--- a/Doc/lib/liblogging.tex
+++ b/Doc/lib/liblogging.tex
@@ -429,10 +429,8 @@ Removes the specified handler \var{hdlr} from this logger.
\end{methoddesc}
\begin{methoddesc}{findCaller}{}
-Finds the caller's source filename and line number. Returns the filename,
-line number and function name as a 3-element tuple.
-\versionchanged[The function name was added. In earlier versions, the
-filename and line number were returned as a 2-element tuple.]{2.4}
+Finds the caller's source filename and line number. Returns the filename
+and line number as a 2-element tuple.
\end{methoddesc}
\begin{methoddesc}{handle}{record}
@@ -1082,11 +1080,8 @@ Returns a new instance of the \class{SysLogHandler} class intended to
communicate with a remote \UNIX{} machine whose address is given by
\var{address} in the form of a \code{(\var{host}, \var{port})}
tuple. If \var{address} is not specified, \code{('localhost', 514)} is
-used. The address is used to open a UDP socket. An alternative to providing
-a \code{(\var{host}, \var{port})} tuple is providing an address as a string,
-for example "/dev/log". In this case, a Unix domain socket is used to send
-the message to the syslog. If \var{facility} is not specified,
-\constant{LOG_USER} is used.
+used. The address is used to open a UDP socket. If \var{facility} is
+not specified, \constant{LOG_USER} is used.
\end{classdesc}
\begin{methoddesc}{close}{}
diff --git a/Doc/lib/libos.tex b/Doc/lib/libos.tex
index 9e8849f74b..e84402f7c7 100644
--- a/Doc/lib/libos.tex
+++ b/Doc/lib/libos.tex
@@ -357,10 +357,6 @@ object, except that when the exit status is zero (termination without
errors), \code{None} is returned.
Availability: Macintosh, \UNIX, Windows.
-The \module{subprocess} module provides more powerful facilities for
-spawning new processes and retrieving their results; using that module
-is preferable to using this function.
-
\versionchanged[This function worked unreliably under Windows in
earlier versions of Python. This was due to the use of the
\cfunction{_popen()} function from the libraries provided with
@@ -375,13 +371,8 @@ deleted once there are no file descriptors for the file.
Availability: Macintosh, \UNIX, Windows.
\end{funcdesc}
-There are a number of different \function{popen*()} functions that
-provide slightly different ways to create subprocesses. Note that the
-\module{subprocess} module is easier to use and more powerful;
-consider using that module before writing code using the
-lower-level \function{popen*()} functions.
-For each of the \function{popen*()} variants, if \var{bufsize} is
+For each of the following \function{popen()} variants, if \var{bufsize} is
specified, it specifies the buffer size for the I/O pipes.
\var{mode}, if provided, should be the string \code{'b'} or
\code{'t'}; on Windows this is needed to determine whether the file
@@ -1513,13 +1504,7 @@ functions are described in section \ref{os-newstreams}.
\funcline{spawnve}{mode, path, args, env}
\funcline{spawnvp}{mode, file, args}
\funcline{spawnvpe}{mode, file, args, env}
-Execute the program \var{path} in a new process.
-
-(Note that the \module{subprocess} module provides more powerful
-facilities for spawning new processes and retrieving their results;
-using that module is preferable to using these functions.)
-
-If \var{mode} is
+Execute the program \var{path} in a new process. If \var{mode} is
\constant{P_NOWAIT}, this function returns the process ID of the new
process; if \var{mode} is \constant{P_WAIT}, returns the process's
exit code if it exits normally, or \code{-\var{signal}}, where
@@ -1647,10 +1632,6 @@ and XP) this is the exit status of the command run; on systems using
a non-native shell, consult your shell documentation.
Availability: Macintosh, \UNIX, Windows.
-
-The \module{subprocess} module provides more powerful facilities for
-spawning new processes and retrieving their results; using that module
-is preferable to using this function.
\end{funcdesc}
\begin{funcdesc}{times}{}
diff --git a/Doc/lib/libpopen2.tex b/Doc/lib/libpopen2.tex
index fa0c1a60ed..985f580451 100644
--- a/Doc/lib/libpopen2.tex
+++ b/Doc/lib/libpopen2.tex
@@ -11,10 +11,10 @@ This module allows you to spawn processes and connect to their
input/output/error pipes and obtain their return codes under
\UNIX{} and Windows.
-The \module{subprocess} module provides more powerful facilities for
-spawning new processes and retrieving their results. Using the
-\module{subprocess} module is preferable to using the \module{popen2}
-module.
+Note that starting with Python 2.0, this functionality is available
+using functions from the \refmodule{os} module which have the same
+names as the factory functions here, but the order of the return
+values is more intuitive in the \refmodule{os} module variants.
The primary interface offered by this module is a trio of factory
functions. For each of these, if \var{bufsize} is specified,
@@ -184,7 +184,3 @@ integrate I/O over pipes with their \function{select()} loops, or use
separate threads to read each of the individual files provided by
whichever \function{popen*()} function or \class{Popen*} class was
used.
-
-\begin{seealso}
- \seemodule{subprocess}{Module for spawning and managing subprocesses.}
-\end{seealso}
diff --git a/Doc/lib/libsubprocess.tex b/Doc/lib/libsubprocess.tex
index ff50f24e4c..af7e157720 100644
--- a/Doc/lib/libsubprocess.tex
+++ b/Doc/lib/libsubprocess.tex
@@ -12,6 +12,9 @@ connect to their input/output/error pipes, and obtain their return
codes. This module intends to replace several other, older modules
and functions, such as:
+% XXX Should add pointers to this module to at least the popen2
+% and commands sections.
+
\begin{verbatim}
os.system
os.spawn*
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py
index 4883f2d3c0..0ab148a90f 100644
--- a/Lib/idlelib/EditorWindow.py
+++ b/Lib/idlelib/EditorWindow.py
@@ -703,7 +703,7 @@ class EditorWindow:
def close(self):
reply = self.maybesave()
- if str(reply) != "cancel":
+ if reply != "cancel":
self._close()
return reply
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index 6ff9b8ff8c..07f1add37a 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 2001-2007 by Vinay Sajip. All Rights Reserved.
+# Copyright 2001-2005 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
@@ -21,7 +21,7 @@ comp.lang.python, and influenced by Apache's log4j system.
Should work under Python versions >= 1.5.2, except that source line
information is not available unless 'sys._getframe()' is.
-Copyright (C) 2001-2007 Vinay Sajip. All Rights Reserved.
+Copyright (C) 2001-2004 Vinay Sajip. All Rights Reserved.
To use, simply 'import logging' and log away!
"""
@@ -68,7 +68,7 @@ def currentframe():
except:
return sys.exc_traceback.tb_frame.f_back
-if hasattr(sys, '_getframe'): currentframe = lambda: sys._getframe(3)
+if hasattr(sys, '_getframe'): currentframe = sys._getframe
# done filching
# _srcfile is only used in conjunction with sys._getframe().
@@ -1318,14 +1318,14 @@ def disable(level):
"""
root.manager.disable = level
-def shutdown(handlerList=_handlerList):
+def shutdown():
"""
Perform any cleanup actions in the logging system (e.g. flushing
buffers).
Should be called at application exit.
"""
- for h in handlerList[:]:
+ for h in _handlerList[:]: # was _handlers.keys():
#errors might occur, for example, if files are locked
#we just ignore them if raiseExceptions is not set
try:
diff --git a/Lib/logging/config.py b/Lib/logging/config.py
index d57fa37c04..2d4ec2e9a8 100644
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -78,7 +78,7 @@ def fileConfig(fname, defaults=None):
flist = string.split(flist, ",")
formatters = {}
for form in flist:
- sectname = "formatter_%s" % string.strip(form)
+ sectname = "formatter_%s" % form
opts = cp.options(sectname)
if "format" in opts:
fs = cp.get(sectname, "format", 1)
@@ -97,7 +97,6 @@ def fileConfig(fname, defaults=None):
try:
#first, lose the existing handlers...
logging._handlers.clear()
- del logging._handlerList[:]
#now set up the new ones...
hlist = cp.get("handlers", "keys")
if len(hlist):
@@ -106,7 +105,7 @@ def fileConfig(fname, defaults=None):
fixups = [] #for inter-handler references
for hand in hlist:
try:
- sectname = "handler_%s" % string.strip(hand)
+ sectname = "handler_%s" % hand
klass = cp.get(sectname, "class")
opts = cp.options(sectname)
if "formatter" in opts:
@@ -141,7 +140,6 @@ def fileConfig(fname, defaults=None):
#at last, the loggers...first the root...
llist = cp.get("loggers", "keys")
llist = string.split(llist, ",")
- llist = map(lambda x: string.strip(x), llist)
llist.remove("root")
sectname = "logger_root"
root = logging.root
@@ -156,7 +154,7 @@ def fileConfig(fname, defaults=None):
if len(hlist):
hlist = string.split(hlist, ",")
for hand in hlist:
- log.addHandler(handlers[string.strip(hand)])
+ log.addHandler(handlers[hand])
#and now the others...
#we don't want to lose the existing loggers,
#since other threads may have pointers to them.
@@ -190,7 +188,7 @@ def fileConfig(fname, defaults=None):
if len(hlist):
hlist = string.split(hlist, ",")
for hand in hlist:
- logger.addHandler(handlers[string.strip(hand)])
+ logger.addHandler(handlers[hand])
#Disable any old loggers. There's no point deleting
#them as other threads may continue to hold references
#and by disabling them, you stop them doing any logging.
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index ea42dd55d2..70bd5d4fae 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -1,4 +1,4 @@
-# Copyright 2001-2007 by Vinay Sajip. All Rights Reserved.
+# Copyright 2001-2005 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
@@ -22,7 +22,7 @@ Apache's log4j system.
Should work under Python versions >= 1.5.2, except that source line
information is not available unless 'sys._getframe()' is.
-Copyright (C) 2001-2007 Vinay Sajip. All Rights Reserved.
+Copyright (C) 2001-2004 Vinay Sajip. All Rights Reserved.
To use, simply 'import logging' and log away!
"""
@@ -231,11 +231,11 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
# of days in the next week until the rollover day (3).
if when.startswith('W'):
day = t[6] # 0 is Monday
- if day != self.dayOfWeek:
- if day < self.dayOfWeek:
- daysToWait = self.dayOfWeek - day - 1
- else:
- daysToWait = 6 - day + self.dayOfWeek
+ if day > self.dayOfWeek:
+ daysToWait = (day - self.dayOfWeek) - 1
+ self.rolloverAt = self.rolloverAt + (daysToWait * (60 * 60 * 24))
+ if day < self.dayOfWeek:
+ daysToWait = (6 - self.dayOfWeek) + day
self.rolloverAt = self.rolloverAt + (daysToWait * (60 * 60 * 24))
#print "Will rollover at %d, %d seconds from now" % (self.rolloverAt, self.rolloverAt - currentTime)
@@ -566,8 +566,7 @@ class SysLogHandler(logging.Handler):
"""
Initialize a handler.
- If address is specified as a string, a UNIX socket is used. To log to a
- local syslogd, "SysLogHandler(address="/dev/log")" can be used.
+ If address is specified as a string, UNIX socket is used.
If facility is not specified, LOG_USER is used.
"""
logging.Handler.__init__(self)
@@ -575,11 +574,11 @@ class SysLogHandler(logging.Handler):
self.address = address
self.facility = facility
if type(address) == types.StringType:
- self.unixsocket = 1
self._connect_unixsocket(address)
+ self.unixsocket = 1
else:
- self.unixsocket = 0
self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+ self.unixsocket = 0
self.formatter = None
diff --git a/Lib/random.py b/Lib/random.py
index c86e17a736..3795b4211d 100644
--- a/Lib/random.py
+++ b/Lib/random.py
@@ -205,7 +205,7 @@ class Random(_random.Random):
raise ValueError, "empty range for randrange()"
if n >= maxwidth:
- return istart + istep*self._randbelow(n)
+ return istart + self._randbelow(n)
return istart + istep*int(self.random() * n)
def randint(self, a, b):
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index f83108391f..e1b0c1f43d 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -346,7 +346,6 @@ mswindows = (sys.platform == "win32")
import os
import types
import traceback
-import gc
if mswindows:
import threading
@@ -900,16 +899,7 @@ class Popen(object):
errpipe_read, errpipe_write = os.pipe()
self._set_cloexec_flag(errpipe_write)
- gc_was_enabled = gc.isenabled()
- # Disable gc to avoid bug where gc -> file_dealloc ->
- # write to stderr -> hang. http://bugs.python.org/issue1336
- gc.disable()
- try:
- self.pid = os.fork()
- except:
- if gc_was_enabled:
- gc.enable()
- raise
+ self.pid = os.fork()
if self.pid == 0:
# Child
try:
@@ -968,8 +958,6 @@ class Popen(object):
os._exit(255)
# Parent
- if gc_was_enabled:
- gc.enable()
os.close(errpipe_write)
if p2cread and p2cwrite:
os.close(p2cread)
diff --git a/Lib/test/test_dbm.py b/Lib/test/test_dbm.py
index b93e72eb72..e5757c9501 100755
--- a/Lib/test/test_dbm.py
+++ b/Lib/test/test_dbm.py
@@ -6,11 +6,11 @@ import os
import random
import dbm
from dbm import error
-from test.test_support import verbose, verify, TestSkipped, TESTFN
+from test.test_support import verbose, verify, TestSkipped
# make filename unique to allow multiple concurrent tests
# and to minimize the likelihood of a problem from an old file
-filename = TESTFN
+filename = '/tmp/delete_me_' + str(random.random())[-6:]
def cleanup():
for suffix in ['', '.pag', '.dir', '.db']:
diff --git a/Lib/test/test_gdbm.py b/Lib/test/test_gdbm.py
index 8e6f76f170..03a47d9c24 100755
--- a/Lib/test/test_gdbm.py
+++ b/Lib/test/test_gdbm.py
@@ -5,9 +5,9 @@
import gdbm
from gdbm import error
-from test.test_support import verbose, verify, TestFailed, TESTFN
+from test.test_support import verbose, verify, TestFailed
-filename = TESTFN
+filename= '/tmp/delete_me'
g = gdbm.open(filename, 'c')
verify(g.keys() == [])
diff --git a/Lib/test/test_multibytecodec.py b/Lib/test/test_multibytecodec.py
index ff88dbabf5..3fcc8ba81a 100644
--- a/Lib/test/test_multibytecodec.py
+++ b/Lib/test/test_multibytecodec.py
@@ -7,19 +7,7 @@
from test import test_support
from test import test_multibytecodec_support
-from test.test_support import TESTFN
-import unittest, StringIO, codecs, sys, os
-
-class Test_StreamReader(unittest.TestCase):
- def test_bug1728403(self):
- try:
- open(TESTFN, 'w').write('\xa1')
- f = codecs.open(TESTFN, encoding='cp949')
- self.assertRaises(UnicodeDecodeError, f.read, 2)
- finally:
- try: f.close()
- except: pass
- os.unlink(TESTFN)
+import unittest, StringIO, codecs, sys
class Test_StreamWriter(unittest.TestCase):
if len(u'\U00012345') == 2: # UCS2
@@ -111,7 +99,6 @@ class Test_ISO2022(unittest.TestCase):
def test_main():
suite = unittest.TestSuite()
- suite.addTest(unittest.makeSuite(Test_StreamReader))
suite.addTest(unittest.makeSuite(Test_StreamWriter))
suite.addTest(unittest.makeSuite(Test_ISO2022))
test_support.run_suite(suite)
diff --git a/Lib/test/test_sha.py b/Lib/test/test_sha.py
index ea224e439c..c438cc6417 100644
--- a/Lib/test/test_sha.py
+++ b/Lib/test/test_sha.py
@@ -11,23 +11,9 @@ from test import test_support
class SHATestCase(unittest.TestCase):
def check(self, data, digest):
- # Check digest matches the expected value
- obj = sha.new(data)
- computed = obj.hexdigest()
+ computed = sha.new(data).hexdigest()
self.assert_(computed == digest)
- # Verify that the value doesn't change between two consecutive
- # digest operations.
- computed_again = obj.hexdigest()
- self.assert_(computed == computed_again)
-
- # Check hexdigest() output matches digest()'s output
- digest = obj.digest()
- hexd = ""
- for c in digest:
- hexd += '%02x' % ord(c)
- self.assert_(computed == hexd)
-
def test_case_1(self):
self.check("abc",
"a9993e364706816aba3e25717850c26c9cd0d89d")
@@ -40,9 +26,6 @@ class SHATestCase(unittest.TestCase):
self.check("a" * 1000000,
"34aa973cd4c4daa4f61eeb2bdbad27316534016f")
- def test_case_4(self):
- self.check(chr(0xAA) * 80,
- '4ca0ef38f1794b28a8f8ee110ee79d48ce13be25')
def test_main():
test_support.run_unittest(SHATestCase)
diff --git a/Lib/trace.py b/Lib/trace.py
index 967dfd0413..799c302808 100644
--- a/Lib/trace.py
+++ b/Lib/trace.py
@@ -583,7 +583,7 @@ class Trace:
"""
if why == 'call':
code = frame.f_code
- filename = frame.f_globals.get('__file__', None)
+ filename = code.co_filename
if filename:
# XXX modname() doesn't work right for packages, so
# the ignore support won't work right for packages
diff --git a/Lib/uu.py b/Lib/uu.py
index fd3e32731f..f5917983f6 100755
--- a/Lib/uu.py
+++ b/Lib/uu.py
@@ -115,7 +115,6 @@ def decode(in_file, out_file=None, mode=None, quiet=0):
#
# Open the output file
#
- opened = False
if out_file == '-':
out_file = sys.stdout
elif isinstance(out_file, StringType):
@@ -125,7 +124,6 @@ def decode(in_file, out_file=None, mode=None, quiet=0):
except AttributeError:
pass
out_file = fp
- opened = True
#
# Main decoding loop
#
@@ -143,8 +141,6 @@ def decode(in_file, out_file=None, mode=None, quiet=0):
s = in_file.readline()
if not s:
raise Error, 'Truncated input file'
- if opened:
- out_file.close()
def test():
"""uuencode/uudecode main program"""
diff --git a/Mac/BuildScript/build-installer.py b/Mac/BuildScript/build-installer.py
index 51f240845a..3609eb0feb 100755
--- a/Mac/BuildScript/build-installer.py
+++ b/Mac/BuildScript/build-installer.py
@@ -10,7 +10,7 @@ bootstrap issues (/usr/bin/python is Python 2.3 on OSX 10.4)
Usage: see USAGE variable in the script.
"""
import platform, os, sys, getopt, textwrap, shutil, urllib2, stat, time, pwd
-import grp, md5
+import grp
INCLUDE_TIMESTAMP=1
VERBOSE=1
@@ -33,7 +33,7 @@ except ImportError:
def shellQuote(value):
"""
- Return the string value in a form that can safely be inserted into
+ Return the string value in a form that can savely be inserted into
a shell command.
"""
return "'%s'"%(value.replace("'", "'\"'\"'"))
@@ -56,13 +56,13 @@ def getFullVersion():
raise RuntimeError, "Cannot find full version??"
-# The directory we'll use to create the build (will be erased and recreated)
+# The directory we'll use to create the build, will be erased and recreated
WORKDIR="/tmp/_py24"
-# The directory we'll use to store third-party sources. Set this to something
+# The directory we'll use to store third-party sources, set this to something
# else if you don't want to re-fetch required libraries every time.
DEPSRC=os.path.join(WORKDIR, 'third-party')
-DEPSRC=os.path.expanduser('/tmp/other-sources')
+DEPSRC=os.path.expanduser('~/Universal/other-sources')
# Location of the preferred SDK
SDKPATH="/Developer/SDKs/MacOSX10.4u.sdk"
@@ -94,9 +94,8 @@ USAGE=textwrap.dedent("""\
# batteries included python.
LIBRARY_RECIPES=[
dict(
- name="Bzip2 1.0.4",
- url="http://www.bzip.org/1.0.4/bzip2-1.0.4.tar.gz",
- checksum="fc310b254f6ba5fbb5da018f04533688",
+ name="Bzip2 1.0.3",
+ url="http://www.bzip.org/1.0.3/bzip2-1.0.3.tar.gz",
configure=None,
install='make install PREFIX=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%(
shellQuote(os.path.join(WORKDIR, 'libraries')),
@@ -107,7 +106,6 @@ LIBRARY_RECIPES=[
dict(
name="ZLib 1.2.3",
url="http://www.gzip.org/zlib/zlib-1.2.3.tar.gz",
- checksum="debc62758716a169df9f62e6ab2bc634",
configure=None,
install='make install prefix=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%(
shellQuote(os.path.join(WORKDIR, 'libraries')),
@@ -119,7 +117,6 @@ LIBRARY_RECIPES=[
# Note that GNU readline is GPL'd software
name="GNU Readline 5.1.4",
url="http://ftp.gnu.org/pub/gnu/readline/readline-5.1.tar.gz" ,
- checksum="7ee5a692db88b30ca48927a13fd60e46",
patchlevel='0',
patches=[
# The readline maintainers don't do actual micro releases, but
@@ -134,7 +131,6 @@ LIBRARY_RECIPES=[
dict(
name="NCurses 5.5",
url="http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.5.tar.gz",
- checksum='e73c1ac10b4bfc46db43b2ddfd6244ef',
configure_pre=[
"--without-cxx",
"--without-ada",
@@ -163,7 +159,6 @@ LIBRARY_RECIPES=[
dict(
name="Sleepycat DB 4.4",
url="http://downloads.sleepycat.com/db-4.4.20.tar.gz",
- checksum='d84dff288a19186b136b0daf7067ade3',
#name="Sleepycat DB 4.3.29",
#url="http://downloads.sleepycat.com/db-4.3.29.tar.gz",
buildDir="build_unix",
@@ -193,7 +188,7 @@ PKG_RECIPES=[
long_name="GUI Applications",
source="/Applications/MacPython %(VER)s",
readme="""\
- This package installs IDLE (an interactive Python IDE),
+ This package installs IDLE (an interactive Python IDLE),
Python Launcher and Build Applet (create application bundles
from python scripts).
@@ -249,7 +244,8 @@ PKG_RECIPES=[
readme="""\
This package updates the system python installation on
Mac OS X 10.3 to ensure that you can build new python extensions
- using that copy of python after installing this version.
+ using that copy of python after installing this version of
+ python.
""",
postflight="../OSX/fixapplepython23.py",
topdir="/Library/Frameworks/Python.framework",
@@ -313,19 +309,6 @@ def checkEnvironment():
fatal("Please install the latest version of Xcode and the %s SDK"%(
os.path.basename(SDKPATH[:-4])))
- if os.path.exists('/sw'):
- fatal("Detected Fink, please remove before building Python")
-
- if os.path.exists('/opt/local'):
- fatal("Detected MacPorts, please remove before building Python")
-
- if not os.path.exists('/Library/Frameworks/Tcl.framework') or \
- not os.path.exists('/Library/Frameworks/Tk.framework'):
-
- fatal("Please install a Universal Tcl/Tk framework in /Library from\n\thttp://tcltkaqua.sourceforge.net/")
-
-
-
def parseOptions(args = None):
@@ -462,17 +445,6 @@ def downloadURL(url, fname):
except:
pass
-def verifyChecksum(path, checksum):
- summer = md5.md5()
- fp = open(path, 'rb')
- block = fp.read(10240)
- while block:
- summer.update(block)
- block = fp.read(10240)
-
- return summer.hexdigest() == checksum
-
-
def buildRecipe(recipe, basedir, archList):
"""
Build software using a recipe. This function does the
@@ -494,16 +466,13 @@ def buildRecipe(recipe, basedir, archList):
os.mkdir(DEPSRC)
- if os.path.exists(sourceArchive) and verifyChecksum(sourceArchive, recipe['checksum']):
+ if os.path.exists(sourceArchive):
print "Using local copy of %s"%(name,)
else:
print "Downloading %s"%(name,)
downloadURL(url, sourceArchive)
print "Archive for %s stored as %s"%(name, sourceArchive)
- if not verifyChecksum(sourceArchive, recipe['checksum']):
- fatal("Download for %s failed: bad checksum"%(url,))
-
print "Extracting archive for %s"%(name,)
buildDir=os.path.join(WORKDIR, '_bld')
@@ -655,15 +624,15 @@ def buildPython():
print "Running make"
runCommand("make")
- print "Running make frameworkinstall"
+ print "Runing make frameworkinstall"
runCommand("make frameworkinstall DESTDIR=%s"%(
shellQuote(rootDir)))
- print "Running make frameworkinstallextras"
+ print "Runing make frameworkinstallextras"
runCommand("make frameworkinstallextras DESTDIR=%s"%(
shellQuote(rootDir)))
- print "Copying required shared libraries"
+ print "Copy required shared libraries"
if os.path.exists(os.path.join(WORKDIR, 'libraries', 'Library')):
runCommand("mv %s/* %s"%(
shellQuote(os.path.join(
@@ -751,8 +720,8 @@ def patchScript(inPath, outPath):
def packageFromRecipe(targetDir, recipe):
curdir = os.getcwd()
try:
- # The major version (such as 2.5) is included in the package name
- # because having two version of python installed at the same time is
+ # The major version (such as 2.5) is included in the pacakge name
+ # because haveing two version of python installed at the same time is
# common.
pkgname = '%s-%s'%(recipe['name'], getVersion())
srcdir = recipe.get('source')
@@ -926,7 +895,7 @@ def installSize(clear=False, _saved=[]):
def buildDMG():
"""
- Create DMG containing the rootDir.
+ Create DMG containing the rootDir
"""
outdir = os.path.join(WORKDIR, 'diskimage')
if os.path.exists(outdir):
@@ -940,7 +909,7 @@ def buildDMG():
os.mkdir(outdir)
time.sleep(1)
- runCommand("hdiutil create -volname 'Universal MacPython %s' -srcfolder %s %s"%(
+ runCommand("hdiutil create -volname 'Univeral MacPython %s' -srcfolder %s %s"%(
getFullVersion(),
shellQuote(os.path.join(WORKDIR, 'installer')),
shellQuote(imagepath)))
diff --git a/Misc/NEWS b/Misc/NEWS
index 5f674fec75..234854b793 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -15,31 +15,16 @@ Core and builtins
- patch #1630975: Fix crash when replacing sys.stdout in sitecustomize.py
-- Bug #1590891: random.randrange don't return correct value for big number
-
-- Bug #1542016: make sys.callstats() match its docstring and return an
- 11-tuple (only relevant when Python is compiled with -DCALL_PROFILE).
-
Extension Modules
-----------------
Library
-------
-- Issue #1336: fix a race condition in subprocess.Popen if the garbage
- collector kicked in at the wrong time that would cause the process
- to hang when the child wrote to stderr.
-
-- Bug #1728403: Fix a bug that CJKCodecs StreamReader hangs when it
- reads a file that ends with incomplete sequence and sizehint argument
- for .read() is specified.
-
- HTML-escape the plain traceback in cgitb's HTML output, to prevent
the traceback inadvertently or maliciously closing the comment and
injecting HTML into the error page.
-- idle: Honor the "Cancel" action in the save dialog (Debian bug #299092).
-
Tests
-----
@@ -204,9 +189,6 @@ Extension Modules
Library
-------
-- Patch 1571379: Make trace's --ignore-dir facility work in the face of
- relative directory names.
-
- Bug #1545341: The 'classifier' keyword argument to the Distutils setup()
function now accepts tuples as well as lists.
diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c
index b69eefff0a..7d2d15ebfb 100644
--- a/Modules/cjkcodecs/multibytecodec.c
+++ b/Modules/cjkcodecs/multibytecodec.c
@@ -705,8 +705,6 @@ mbstreamreader_iread(MultibyteStreamReaderObject *self,
cres = NULL;
for (;;) {
- int endoffile;
-
if (sizehint < 0)
cres = PyObject_CallMethod(self->stream,
(char *)method, NULL);
@@ -723,8 +721,6 @@ mbstreamreader_iread(MultibyteStreamReaderObject *self,
goto errorexit;
}
- endoffile = (PyString_GET_SIZE(cres) == 0);
-
if (self->pendingsize > 0) {
PyObject *ctr;
char *ctrdata;
@@ -776,7 +772,7 @@ mbstreamreader_iread(MultibyteStreamReaderObject *self,
goto errorexit;
}
- if (endoffile || sizehint < 0) { /* end of file */
+ if (rsize == 0 || sizehint < 0) { /* end of file */
if (buf.inbuf < buf.inbuf_end &&
multibytecodec_decerror(self->codec, &self->state,
&buf, self->errors, MBERR_TOOFEW))
diff --git a/Python/ceval.c b/Python/ceval.c
index 358346c968..04dda2552c 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -179,10 +179,10 @@ static int pcall[PCALL_NUM];
PyObject *
PyEval_GetCallStats(PyObject *self)
{
- return Py_BuildValue("iiiiiiiiiii",
+ return Py_BuildValue("iiiiiiiiii",
pcall[0], pcall[1], pcall[2], pcall[3],
pcall[4], pcall[5], pcall[6], pcall[7],
- pcall[8], pcall[9], pcall[10]);
+ pcall[8], pcall[9]);
}
#else
#define PCALL(O)
@@ -4073,10 +4073,8 @@ import_all_from(PyObject *locals, PyObject *v)
value = PyObject_GetAttr(v, name);
if (value == NULL)
err = -1;
- else if (PyDict_CheckExact(locals))
- err = PyDict_SetItem(locals, name, value);
else
- err = PyObject_SetItem(locals, name, value);
+ err = PyDict_SetItem(locals, name, value);
Py_DECREF(name);
Py_XDECREF(value);
if (err != 0)