Skip to content

Commit a28e702

Browse files
committed
Merged revisions 77185-77188,77262,77313,77317,77331-77333,77337-77338 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r77185 | andrew.kuchling | 2009-12-31 10:17:05 -0600 (Thu, 31 Dec 2009) | 1 line Add some items ........ r77186 | benjamin.peterson | 2009-12-31 10:28:24 -0600 (Thu, 31 Dec 2009) | 1 line update expat comment ........ r77187 | andrew.kuchling | 2009-12-31 10:38:53 -0600 (Thu, 31 Dec 2009) | 1 line Add various items ........ r77188 | benjamin.peterson | 2009-12-31 10:49:37 -0600 (Thu, 31 Dec 2009) | 1 line add another advancement ........ r77262 | andrew.kuchling | 2010-01-02 19:15:21 -0600 (Sat, 02 Jan 2010) | 1 line Add a few items ........ r77313 | benjamin.peterson | 2010-01-04 18:04:19 -0600 (Mon, 04 Jan 2010) | 1 line add a test about hashing array.array ........ r77317 | georg.brandl | 2010-01-05 12:14:52 -0600 (Tue, 05 Jan 2010) | 1 line Add Stefan. ........ r77331 | georg.brandl | 2010-01-06 11:43:06 -0600 (Wed, 06 Jan 2010) | 1 line Small fixes to test_cmd: fix signature of do_shell, remove duplicate import, add option to run the custom Cmd class. ........ r77332 | georg.brandl | 2010-01-06 12:02:16 -0600 (Wed, 06 Jan 2010) | 7 lines python#5991: let completion for the "help" command include help topics. This also simplifies the Cmd.get_names() method implementation; it was written at a time where dir() didn't consider base class attributes. ........ r77333 | georg.brandl | 2010-01-06 12:26:08 -0600 (Wed, 06 Jan 2010) | 1 line python#5950: document that zip files with comments are unsupported in zipimport. ........ r77337 | r.david.murray | 2010-01-06 21:09:08 -0600 (Wed, 06 Jan 2010) | 3 lines Add -W to the 'basics', 'opt', and 'all' test runs so that we get verbose information if a failure happens. ........ r77338 | r.david.murray | 2010-01-06 22:04:28 -0600 (Wed, 06 Jan 2010) | 2 lines Fix inadvertent checkin of debug line. ........
1 parent 46a9900 commit a28e702

File tree

8 files changed

+111
-45
lines changed

8 files changed

+111
-45
lines changed

Doc/library/zipimport.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ Any files may be present in the ZIP archive, but only files :file:`.py` and
2626
corresponding :file:`.pyc` or :file:`.pyo` file, meaning that if a ZIP archive
2727
doesn't contain :file:`.pyc` files, importing may be rather slow.
2828

29+
ZIP archives with an archive comment are currently not supported.
30+
2931
.. seealso::
3032

3133
`PKZIP Application Note <http://www.pkware.com/documents/casestudies/APPNOTE.TXT>`_

Doc/whatsnew/2.7.rst

Lines changed: 73 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,9 @@ Some smaller changes made to the core Python language are:
264264
Windows, and on Unix platforms using the gcc, icc, or suncc
265265
compilers. There may be a small number of platforms where correct
266266
operation of this code cannot be guaranteed, so the code is not
267-
used on such systems.
267+
used on such systems. You can find out which code is being used
268+
by checking :data:`sys.float_repr_style`, which will be ``short``
269+
if the new code is in use and ``legacy`` if it isn't.
268270

269271
Implemented by Eric Smith and Mark Dickinson, using David Gay's
270272
:file:`dtoa.c` library; :issue:`7117`.
@@ -358,6 +360,11 @@ Some smaller changes made to the core Python language are:
358360
on the :exc:`IOError` exception when trying to open a directory
359361
on POSIX platforms. (Noted by Jan Kaliszewski; :issue:`4764`.)
360362

363+
* The Python tokenizer now translates line endings itself, so the
364+
:func:`compile` built-in function can now accept code using any
365+
line-ending convention. Additionally, it no longer requires that the
366+
code end in a newline.
367+
361368
* Extra parentheses in function definitions are illegal in Python 3.x,
362369
meaning that you get a syntax error from ``def f((x)): pass``. In
363370
Python3-warning mode, Python 2.7 will now warn about this odd usage.
@@ -433,6 +440,8 @@ Several performance enhancements have been added:
433440
Various benchmarks show speedups of between 50% and 150% for long
434441
integer divisions and modulo operations.
435442
(Contributed by Mark Dickinson; :issue:`5512`.)
443+
Bitwise operations are also significantly faster (initial patch by
444+
Gregory Smith; :issue:`1087418`).
436445

437446
* The implementation of ``%`` checks for the left-side operand being
438447
a Python string and special-cases it; this results in a 1-3%
@@ -444,6 +453,16 @@ Several performance enhancements have been added:
444453
faster bytecode. (Patch by Antoine Pitrou, back-ported to 2.7
445454
by Jeffrey Yasskin; :issue:`4715`.)
446455

456+
* Converting an integer or long integer to a decimal string was made
457+
faster by special-casing base 10 instead of using a generalized
458+
conversion function that supports arbitrary bases.
459+
(Patch by Gawain Bolton; :issue:`6713`.)
460+
461+
* The :meth:`rindex`, :meth:`rpartition`, and :meth:`rsplit` methods
462+
of string objects now uses a fast reverse-search algorithm instead of
463+
a character-by-character scan. This is often faster by a factor of 10.
464+
(Added by Florent Xicluna; :issue:`7462`.)
465+
447466
* The :mod:`pickle` and :mod:`cPickle` modules now automatically
448467
intern the strings used for attribute names, reducing memory usage
449468
of the objects resulting from unpickling. (Contributed by Jake
@@ -453,11 +472,6 @@ Several performance enhancements have been added:
453472
nearly halving the time required to pickle them.
454473
(Contributed by Collin Winter; :issue:`5670`.)
455474

456-
* Converting an integer or long integer to a decimal string was made
457-
faster by special-casing base 10 instead of using a generalized
458-
conversion function that supports arbitrary bases.
459-
(Patch by Gawain Bolton; :issue:`6713`.)
460-
461475
.. ======================================================================
462476
463477
New and Improved Modules
@@ -602,6 +616,10 @@ changes, or look through the Subversion logs for all the details.
602616
XXX link to file:///MacDev/svn.python.org/python-trunk/Doc/build/html/distutils/examples.html#reading-the-metadata
603617
(Contributed by Tarek Ziade; :issue:`7457`.)
604618

619+
:file:`setup.py` files will now accept a :option:`--no-user-cfg` switch
620+
to skip reading the :file:`~/.pydistutils.cfg` file. (Suggested by
621+
by Michael Hoffman, and implemented by Paul Winkler; :issue:`1180`.)
622+
605623
* The :class:`Fraction` class now accepts two rational numbers
606624
as arguments to its constructor.
607625
(Implemented by Mark Dickinson; :issue:`5812`.)
@@ -625,14 +643,6 @@ changes, or look through the Subversion logs for all the details.
625643
recorded in a gzipped file by providing an optional timestamp to
626644
the constructor. (Contributed by Jacques Frechet; :issue:`4272`.)
627645

628-
* The :mod:`hashlib` module was inconsistent about accepting
629-
input as a Unicode object or an object that doesn't support
630-
the buffer protocol. The behavior was different depending on
631-
whether :mod:`hashlib` was using an external OpenSSL library
632-
or its built-in implementations. Python 2.7 makes the
633-
behavior consistent, always rejecting such objects by raising a
634-
:exc:`TypeError`. (Fixed by Gregory P. Smith; :issue:`3745`.)
635-
636646
* The default :class:`HTTPResponse` class used by the :mod:`httplib` module now
637647
supports buffering, resulting in much faster reading of HTTP responses.
638648
(Contributed by Kristjan Valur Jonsson; :issue:`4879`.)
@@ -745,6 +755,10 @@ changes, or look through the Subversion logs for all the details.
745755
to store data.
746756
(Contributed by Tarek Ziade; :issue:`6693`.)
747757

758+
* The :mod:`socket` module's :class:`SSL` objects now support the
759+
buffer API, which fixed a test suite failure. (Fixed by Antoine Pitrou;
760+
:issue:`7133`.)
761+
748762
* The :mod:`SocketServer` module's :class:`TCPServer` class now
749763
has a :attr:`disable_nagle_algorithm` class attribute.
750764
The default value is False; if overridden to be True,
@@ -858,6 +872,10 @@ GvR worked on merging them into Python's version of :mod:`unittest`.
858872
whether the two values evaluate to the same object or not.
859873
(Added by Michael Foord; :issue:`2578`.)
860874

875+
* :meth:`assertIsInstance` and :meth:`assertNotIsInstance` check whether
876+
the resulting object is an instance of a particular class, or of
877+
one of a tuple of classes. (Added by Georg Brandl; :issue:`7031`.)
878+
861879
* :meth:`assertGreater`, :meth:`assertGreaterEqual`,
862880
:meth:`assertLess`, and :meth:`assertLessEqual` compare
863881
two quantities.
@@ -1025,6 +1043,11 @@ Changes to Python's build process and to the C API include:
10251043
a :ctype:`long`, an *overflow* flag is set and returned to the caller.
10261044
(Contributed by Case Van Horsen; :issue:`7528`.)
10271045

1046+
* New function: stemming from the rewrite of string-to-float conversion,
1047+
a new :cfunc:`PyOS_string_to_double` function was added. The old
1048+
:cfunc:`PyOS_ascii_strtod` and :cfunc:`PyOS_ascii_atof` functions
1049+
are now deprecated.
1050+
10281051
* New macros: the Python header files now define the following macros:
10291052
:cmacro:`Py_ISALNUM`,
10301053
:cmacro:`Py_ISALPHA`,
@@ -1067,10 +1090,30 @@ Changes to Python's build process and to the C API include:
10671090

10681091
(Fixed by Thomas Wouters; :issue:`1590864`.)
10691092

1093+
* The :cfunc:`Py_Finalize` function now calls the internal
1094+
:func:`threading._shutdown` function; this prevents some exceptions from
1095+
being raised when an interpreter shuts down.
1096+
(Patch by Adam Olsen; :issue:`1722344`.)
1097+
10701098
* Global symbols defined by the :mod:`ctypes` module are now prefixed
10711099
with ``Py``, or with ``_ctypes``. (Implemented by Thomas
10721100
Heller; :issue:`3102`.)
10731101

1102+
* New configure option: the :option:`--with-system-expat` switch allows
1103+
building the :mod:`pyexpat` module to use the system Expat library.
1104+
(Contributed by Arfrever Frehtes Taifersar Arahesis; :issue:`7609`.)
1105+
1106+
* New configure option: Compiling Python with the
1107+
:option:`--with-valgrind` option will now disable the pymalloc
1108+
allocator, which is difficult for the Valgrind to analyze correctly.
1109+
Valgrind will therefore be better at detecting memory leaks and
1110+
overruns. (Contributed by James Henstridge; :issue:`2422`.)
1111+
1112+
* New configure option: you can now supply no arguments to
1113+
:option:`--with-dbmliborder=` in order to build none of the various
1114+
DBM modules. (Added by Arfrever Frehtes Taifersar Arahesis;
1115+
:issue:`6491`.)
1116+
10741117
* The :program:`configure` script now checks for floating-point rounding bugs
10751118
on certain 32-bit Intel chips and defines a :cmacro:`X87_DOUBLE_ROUNDING`
10761119
preprocessor definition. No code currently uses this definition,
@@ -1083,11 +1126,6 @@ Changes to Python's build process and to the C API include:
10831126
* The build process now supports Subversion 1.7. (Contributed by
10841127
Arfrever Frehtes Taifersar Arahesis; :issue:`6094`.)
10851128

1086-
* Compiling Python with the :option:`--with-valgrind` option will now
1087-
disable the pymalloc allocator, which is difficult for the Valgrind to
1088-
analyze correctly. Valgrind will therefore be better at detecting
1089-
memory leaks and overruns. (Contributed by James Henstridge; :issue:`2422`.)
1090-
10911129

10921130
.. ======================================================================
10931131
@@ -1139,12 +1177,14 @@ Other Changes and Fixes
11391177
The :option:`-r` option also reports the seed that was used
11401178
(Added by Collin Winter.)
11411179

1142-
* The :file:`regrtest.py` script now takes a :option:`-j` switch
1143-
that takes an integer specifying how many tests run in parallel. This
1180+
* Another :file:`regrtest.py` switch is :option:`-j`, which
1181+
takes an integer specifying how many tests run in parallel. This
11441182
allows reducing the total runtime on multi-core machines.
11451183
This option is compatible with several other options, including the
11461184
:option:`-R` switch which is known to produce long runtimes.
1147-
(Added by Antoine Pitrou, :issue:`6152`.)
1185+
(Added by Antoine Pitrou, :issue:`6152`.) This can also be used
1186+
with a new :option:`-F` switch that runs selected tests in a loop
1187+
until they fail. (Added by Antoine Pitrou; :issue:`7312`.)
11481188

11491189
.. ======================================================================
11501190
@@ -1175,6 +1215,17 @@ that may require changes to your code:
11751215
nothing when a negative length is requested, as other file-like
11761216
objects do. (:issue:`7348`).
11771217

1218+
For C extensions:
1219+
1220+
* C extensions that use integer format codes with the ``PyArg_Parse*``
1221+
family of functions will now raise a :exc:`TypeError` exception
1222+
instead of triggering a :exc:`DeprecationWarning` (:issue:`5080`).
1223+
1224+
* Use the new :cfunc:`PyOS_string_to_double` function instead of the old
1225+
:cfunc:`PyOS_ascii_strtod` and :cfunc:`PyOS_ascii_atof` functions,
1226+
which are now deprecated.
1227+
1228+
11781229
.. ======================================================================
11791230
11801231

Lib/cmd.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -278,19 +278,15 @@ def complete(self, text, state):
278278
return None
279279

280280
def get_names(self):
281-
# Inheritance says we have to look in class and
282-
# base classes; order is not important.
283-
names = []
284-
classes = [self.__class__]
285-
while classes:
286-
aclass = classes.pop(0)
287-
if aclass.__bases__:
288-
classes = classes + list(aclass.__bases__)
289-
names = names + dir(aclass)
290-
return names
281+
# This method used to pull in base class attributes
282+
# at a time dir() didn't do it yet.
283+
return dir(self.__class__)
291284

292285
def complete_help(self, *args):
293-
return self.completenames(*args)
286+
commands = set(self.completenames(*args))
287+
topics = set(a[5:] for a in self.get_names()
288+
if a.startswith('help_' + args[0]))
289+
return list(commands | topics)
294290

295291
def do_help(self, arg):
296292
if arg:

Lib/test/test_cmd.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,17 @@ class samplecmdclass(cmd.Cmd):
6060
>>> mycmd.completenames("12")
6161
[]
6262
>>> mycmd.completenames("help")
63-
['help', 'help']
63+
['help']
6464
6565
Test for the function complete_help():
6666
>>> mycmd.complete_help("a")
6767
['add']
6868
>>> mycmd.complete_help("he")
69-
['help', 'help']
69+
['help']
7070
>>> mycmd.complete_help("12")
7171
[]
72+
>>> sorted(mycmd.complete_help(""))
73+
['add', 'exit', 'help', 'shell']
7274
7375
Test for the function do_help():
7476
>>> mycmd.do_help("testet")
@@ -144,7 +146,7 @@ def completedefault(self, *ignored):
144146
def complete_command(self):
145147
print("complete command")
146148

147-
def do_shell(self):
149+
def do_shell(self, s):
148150
pass
149151

150152
def do_add(self, s):
@@ -171,6 +173,7 @@ def test_main(verbose=None):
171173
support.run_doctest(test_cmd, verbose)
172174

173175
def test_coverage(coverdir):
176+
import trace
174177
tracer=trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix,],
175178
trace=0, count=1)
176179
tracer.run('reload(cmd);test_main()')
@@ -181,5 +184,7 @@ def test_coverage(coverdir):
181184
if __name__ == "__main__":
182185
if "-c" in sys.argv:
183186
test_coverage('/tmp/cmd.cover')
187+
elif "-i" in sys.argv:
188+
samplecmdclass().cmdloop()
184189
else:
185190
test_main()

Lib/test/test_hashlib.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
# Licensed to PSF under a Contributor Agreement.
77
#
88

9+
import array
910
import hashlib
1011
from io import StringIO
12+
import itertools
1113
import sys
1214
try:
1315
import threading
@@ -93,6 +95,13 @@ def _test_algorithm_via_hashlib_new(data=None, _alg=algorithm):
9395

9496
super(HashLibTestCase, self).__init__(*args, **kwargs)
9597

98+
def test_hash_array(self):
99+
a = array.array("b", range(10))
100+
constructors = self.constructors_to_test.values()
101+
for cons in itertools.chain.from_iterable(constructors):
102+
c = cons(a)
103+
c.hexdigest()
104+
96105
def test_unknown_hash(self):
97106
try:
98107
hashlib.new('spam spam spam spam spam')

Misc/build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,15 +214,15 @@ if [ $err = 0 -a "$BUILD_DISABLED" != "yes" ]; then
214214
## make and run basic tests
215215
F=make-test.out
216216
start=`current_time`
217-
$PYTHON $REGRTEST_ARGS -u urlfetch >& build/$F
217+
$PYTHON $REGRTEST_ARGS -W -u urlfetch >& build/$F
218218
NUM_FAILURES=`count_failures build/$F`
219219
place_summary_first build/$F
220220
update_status "Testing basics ($NUM_FAILURES failures)" "$F" $start
221221
mail_on_failure "basics" build/$F
222222

223223
F=make-test-opt.out
224224
start=`current_time`
225-
$PYTHON -O $REGRTEST_ARGS -u urlfetch >& build/$F
225+
$PYTHON -O $REGRTEST_ARGS -W -u urlfetch >& build/$F
226226
NUM_FAILURES=`count_failures build/$F`
227227
place_summary_first build/$F
228228
update_status "Testing opt ($NUM_FAILURES failures)" "$F" $start
@@ -245,7 +245,7 @@ if [ $err = 0 -a "$BUILD_DISABLED" != "yes" ]; then
245245
start=`current_time`
246246
## skip curses when running from cron since there's no terminal
247247
## skip sound since it's not setup on the PSF box (/dev/dsp)
248-
$PYTHON $REGRTEST_ARGS -uall -x test_curses test_linuxaudiodev test_ossaudiodev $_ALWAYS_SKIP >& build/$F
248+
$PYTHON $REGRTEST_ARGS -W -uall -x test_curses test_linuxaudiodev test_ossaudiodev &_ALWAYS_SKIP >& build/$F
249249
NUM_FAILURES=`count_failures build/$F`
250250
place_summary_first build/$F
251251
update_status "Testing all except curses and sound ($NUM_FAILURES failures)" "$F" $start

Misc/developers.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ for details. When the agreement is signed, please note it in this log.
2020
Permissions History
2121
-------------------
2222

23+
- Stefan Krah was given SVN access on January 5 2010 by GFB, at
24+
suggestion of Mark Dickinson, for work on the decimal module.
25+
2326
- Doug Hellmann was given SVN access on September 19 2009 by GFB, at
2427
suggestion of Jesse Noller, for documentation work.
2528

setup.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,12 +1108,12 @@ class db_found(Exception): pass
11081108

11091109
# Interface to the Expat XML parser
11101110
#
1111-
# Expat was written by James Clark and is now maintained by a
1112-
# group of developers on SourceForge; see www.libexpat.org for
1113-
# more information. The pyexpat module was written by Paul
1114-
# Prescod after a prototype by Jack Jansen. The Expat source
1115-
# is included in Modules/expat/. Usage of a system
1116-
# shared libexpat.so/expat.dll is not advised.
1111+
# Expat was written by James Clark and is now maintained by a group of
1112+
# developers on SourceForge; see www.libexpat.org for more information.
1113+
# The pyexpat module was written by Paul Prescod after a prototype by
1114+
# Jack Jansen. The Expat source is included in Modules/expat/. Usage
1115+
# of a system shared libexpat.so is possible with --with-system-expat
1116+
# cofigure option.
11171117
#
11181118
# More information on Expat can be found at www.libexpat.org.
11191119
#

0 commit comments

Comments
 (0)