Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
2169ee20
Commit
2169ee20
authored
Jan 05, 2011
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RC1 updates to whatsnew
parent
be41a48f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
86 additions
and
26 deletions
+86
-26
Doc/whatsnew/3.2.rst
Doc/whatsnew/3.2.rst
+86
-26
No files found.
Doc/whatsnew/3.2.rst
View file @
2169ee20
...
@@ -394,13 +394,13 @@ Some smaller changes made to the core Python language are:
...
@@ -394,13 +394,13 @@ Some smaller changes made to the core Python language are:
(Contributed by Marcin Wojdyr in issue:`1772833`).
(Contributed by Marcin Wojdyr in issue:`1772833`).
* The :func:`hasattr` function
used to catch and suppress any Exception. Now,
* The :func:`hasattr` function
works by calling :func:`getattr` and detecting
it only catches :exc:`AttributeError`. Under the hood, :func:`hasattr` work
s
whether an exception is raised. This technique allows it to detect method
s
by calling :func:`getattr` and throwing away the results. This is necessary
created dynamically by :meth:`__getattr__` or :meth:`__getattribute__` which
because dynamic attribute creation is possible using :meth:`__getattribute__`
would be absent from the class dictionary. Formerly, *hasattr* would catch
or :meth:`__getattr__`. If :func:`hasattr` were to just scan instance and class
any exception, possibly masking genuine errors in those methods. Now,
dictionaries it would miss the dynamic methods and make it difficult to
*hasattr* has been tightened to only catch :exc:`AttributeError` and let
implement proxy objects
.
other exceptions pass through
.
(Discovered by Yury Selivanov and fixed by Benjamin Peterson; :issue:`9666`.)
(Discovered by Yury Selivanov and fixed by Benjamin Peterson; :issue:`9666`.)
...
@@ -682,9 +682,10 @@ functools
...
@@ -682,9 +682,10 @@ functools
return ((self.lastname.lower(), self.firstname.lower()) <
return ((self.lastname.lower(), self.firstname.lower()) <
(other.lastname.lower(), other.firstname.lower()))
(other.lastname.lower(), other.firstname.lower()))
(Contributed by Raymond Hettinger.)
With the *total_ordering* decorator, the remaining comparison methods
are filled-in automatically.
.. XXX clarify what the example does
(Contributed by Raymond Hettinger.)
* To aid in porting programs from Python 2, the :func:`~functools.cmp_to_key`
* To aid in porting programs from Python 2, the :func:`~functools.cmp_to_key`
function converts an old-style comparison function to
function converts an old-style comparison function to
...
@@ -787,12 +788,10 @@ datetime
...
@@ -787,12 +788,10 @@ datetime
* Also, :class:`~datetime.timedelta` objects can now be multiplied by
* Also, :class:`~datetime.timedelta` objects can now be multiplied by
:class:`float` and divided by :class:`float` and :class:`int` objects.
:class:`float` and divided by :class:`float` and :class:`int` objects.
And :class:`~datetime.timedelta` objects can now divide one another.
.. XXX Describe added support for dividing a timedelta by another timedelta.
(Contributed by Alexander Belopolsky in :issue:`1289118`, :issue:`5094`,
See revision 80290 and issue #2706.
:issue:`6641`, and :issue:`2706`.)
(Contributed by Alexander Belopolsky in :issue:`1289118`, :issue:`5094` and
:issue:`6641`.)
abc
abc
---
---
...
@@ -861,7 +860,7 @@ body of enclosed statements.
...
@@ -861,7 +860,7 @@ body of enclosed statements.
(Contributed by Michael Foord in :issue:`9110`.)
(Contributed by Michael Foord in :issue:`9110`.)
decimal and fractions
decimal and fractions
---------------------
---------------------
-
Mark Dickinson crafted an elegant and efficient scheme for assuring that
Mark Dickinson crafted an elegant and efficient scheme for assuring that
different numeric datatypes will have the same hash value whenever their actual
different numeric datatypes will have the same hash value whenever their actual
...
@@ -902,6 +901,16 @@ contexts that correspond to the decimal interchange formats specified in IEEE
...
@@ -902,6 +901,16 @@ contexts that correspond to the decimal interchange formats specified in IEEE
(Contributed by Mark Dickinson and Raymond Hettinger.)
(Contributed by Mark Dickinson and Raymond Hettinger.)
codecs
------
In an effort to keep codec aliases solely focused on bytes-to-text encodings,
the *base64*, *bz2*, *hex*, *quopri*, *rot13*, *uu* and *zlib* codecs have been
removed from the codec aliases. These bytes-to-bytes conversion are still
accessible via codecs.lookup().
(see :issue:`10807`.)
ftp
ftp
---
---
...
@@ -930,7 +939,11 @@ also grew auto-closing context managers::
...
@@ -930,7 +939,11 @@ also grew auto-closing context managers::
(Contributed by Tarek Ziadé and Giampaolo Rodolà in :issue:`4972`, and
(Contributed by Tarek Ziadé and Giampaolo Rodolà in :issue:`4972`, and
by Georg Brandl in :issue:`8046` and :issue:`1286`.)
by Georg Brandl in :issue:`8046` and :issue:`1286`.)
.. XXX mention os.popen and subprocess.Popen auto-closing of fds
popen
-----
The :func:`os.popen` and :func:`subprocess.Popen` functions now support
the :keyword:`with`-statement` for auto-closing of the file descriptors.
gzip and zipfile
gzip and zipfile
----------------
----------------
...
@@ -1077,6 +1090,11 @@ as recommended in public uses of HTTPS.
...
@@ -1077,6 +1090,11 @@ as recommended in public uses of HTTPS.
unittest
unittest
--------
--------
The unittest module has a number of improvements supporting test discovery for
packages, easier experimentation at the interactive prompt, new testcase
methods, improved diagnostic messages for test failures, and better method
names.
* The command-line call, ``python -m unittest`` can now accept file paths
* The command-line call, ``python -m unittest`` can now accept file paths
instead of module names for running specific tests (:issue:`10620`). The new
instead of module names for running specific tests (:issue:`10620`). The new
test discovery can find tests within packages, locating any test importable
test discovery can find tests within packages, locating any test importable
...
@@ -1088,14 +1106,24 @@ unittest
...
@@ -1088,14 +1106,24 @@ unittest
(Contributed by Michael Foord.)
(Contributed by Michael Foord.)
* Experimentation at the interactive prompt is now easier because the
:class:`unittest.case.TestCase` class can now be instantiated without
arguments:
>>> TestCase().assertEqual(pow(2, 3), 8)
(Contributed by Michael Foord.)
* The :mod:`unittest` module has two new methods,
* The :mod:`unittest` module has two new methods,
:meth:`~unittest.TestCase.assertWarns` and
:meth:`~unittest.TestCase.assertWarns` and
:meth:`~unittest.TestCase.assertWarnsRegex` to
check
that a given warning type
:meth:`~unittest.TestCase.assertWarnsRegex` to
verify
that a given warning type
is triggered by the code under test:
is triggered by the code under test:
>>> with self.assertWarns(DeprecationWarning):
>>> with self.assertWarns(DeprecationWarning):
... legacy_function('XYZ')
... legacy_function('XYZ')
(Contributed by Michael Foord and Ezio Melotti.)
Another new method, :meth:`~unittest.TestCase.assertCountEqual` is used to
Another new method, :meth:`~unittest.TestCase.assertCountEqual` is used to
compare two iterables to determine if their element counts are equal (whether
compare two iterables to determine if their element counts are equal (whether
the same elements are present with the same number of occurrences regardless
the same elements are present with the same number of occurrences regardless
...
@@ -1104,23 +1132,28 @@ unittest
...
@@ -1104,23 +1132,28 @@ unittest
def test_anagram(self):
def test_anagram(self):
self.assertCountEqual('algorithm', 'logarithm')
self.assertCountEqual('algorithm', 'logarithm')
A principal feature of the unittest module is an effort to produce meaningful
(Contributed by Raymond Hettinger.)
* A principal feature of the unittest module is an effort to produce meaningful
diagnostics when a test fails. When possible the failure is recorded along
diagnostics when a test fails. When possible the failure is recorded along
with a diff of the output. This is especially helpful for analyzing log files
with a diff of the output. This is especially helpful for analyzing log files
of failed test runs. However, since diffs can sometime be voluminous, there is
of failed test runs. However, since diffs can sometime be voluminous, there is
a new :attr:`~unittest.TestCase.maxDiff` attribute which sets maximum length of
a new :attr:`~unittest.TestCase.maxDiff` attribute which sets maximum length of
diffs.
diffs.
In addition the naming in the module has undergone a number of clean-ups. For
* In addition, the method names in the module have undergone a number of clean-ups.
example, :meth:`~unittest.TestCase.assertRegex` is the new name for
For example, :meth:`~unittest.TestCase.assertRegex` is the new name for
:meth:`~unittest.TestCase.assertRegexpMatches` which was misnamed because the
:meth:`~unittest.TestCase.assertRegexpMatches` which was misnamed because the
test uses :func:`re.search`, not :func:`re.match`. Other methods using
test uses :func:`re.search`, not :func:`re.match`. Other methods using
regular expressions are now named using short form "Regex" in preference
regular expressions are now named using short form "Regex" in preference
to
to
"Regexp" -- this matches the names used in other unittest implementations,
"Regexp" -- this matches the names used in other unittest implementations,
matches Python's old name for the :mod:`re` module, and it has unambiguous
matches Python's old name for the :mod:`re` module, and it has unambiguous
camel-casing.
camel-casing.
To improve consistency, some of long-standing method aliases are being
(Contributed by Raymond Hettinger and implemented by Ezio Melotti.)
* To improve consistency, some of long-standing method aliases are being
deprecated in favor of the preferred names:
deprecated in favor of the preferred names:
- replace :meth:`assert_` with :meth:`.assertTrue`
- replace :meth:`assert_` with :meth:`.assertTrue`
...
@@ -1135,6 +1168,13 @@ unittest
...
@@ -1135,6 +1168,13 @@ unittest
(Contributed by Ezio Melotti; :issue:`9424`.)
(Contributed by Ezio Melotti; :issue:`9424`.)
* The :meth:`~unittest.TestCase.assertDictContainsSubset` method was deprecated
because it was mis-implemented with the arguments in the wrong order. This
created hard-to-debug optical illusions where tests like
``TestCase().assertDictContainsSubset({'a':1, 'b':2}, {'a':1})`` would fail.
(Contributed by Raymond Hettinger.)
random
random
------
------
...
@@ -1548,12 +1588,22 @@ The :mod:`datetime` module now has an auxiliary implementation in pure Python.
...
@@ -1548,12 +1588,22 @@ The :mod:`datetime` module now has an auxiliary implementation in pure Python.
No functionality was changed. This just provides an easier-to-read
No functionality was changed. This just provides an easier-to-read
alternate implementation. (Contributed by Alexander Belopolsky.)
alternate implementation. (Contributed by Alexander Belopolsky.)
The unmaintained *Demo* directory has been removed. Some demos were integrated
into the documentation, some were moved to the *Tools/demo* directory, and
others were removed altogether. (Contributed by Georg Brandl.)
IDLE
IDLE
====
====
* The format menu now has an option to clean-up source files by stripping
* The format menu now has an option to clean-up source files by stripping
trailing whitespace (:issue:`5150`).
trailing whitespace.
(Contributed by Raymond Hettinger; :issue:`5150`.)
* IDLE on Mac OS X now works with both Carbon AquaTk and Cocoa AquaTk.
(Contributed by Kevin Walzer, Ned Deily, and Ronald Oussoren; :issue:`6075`.)
Build and C API Changes
Build and C API Changes
...
@@ -1561,6 +1611,9 @@ Build and C API Changes
...
@@ -1561,6 +1611,9 @@ Build and C API Changes
Changes to Python's build process and to the C API include:
Changes to Python's build process and to the C API include:
* The *idle*, *pydoc* and *2to3* scripts are now installed with a
version-specific suffix on ``make altinstall`` (:issue:`10679`).
* The C functions that access the Unicode Database now accept and return
* The C functions that access the Unicode Database now accept and return
characters from the full Unicode range, even on narrow unicode builds
characters from the full Unicode range, even on narrow unicode builds
(Py_UNICODE_TOLOWER, Py_UNICODE_ISDECIMAL, and others). A visible difference
(Py_UNICODE_TOLOWER, Py_UNICODE_ISDECIMAL, and others). A visible difference
...
@@ -1713,6 +1766,13 @@ require changes to your code:
...
@@ -1713,6 +1766,13 @@ require changes to your code:
(Contributed by Georg Brandl and Mattias Brändström;
(Contributed by Georg Brandl and Mattias Brändström;
`appspot issue 53094 <http://codereview.appspot.com/53094>`_.)
`appspot issue 53094 <http://codereview.appspot.com/53094>`_.)
* :func:`struct.pack` no longer implicitly encodes unicode to UTF-8: use
* :func:`struct.pack` now only allows bytes for the ``s`` string pack code.
explicit conversion instead and replace unicode literals by bytes literals.
Formerly, it would accept text arguments and implicitly encode them to bytes
using UTF-8. This was problematic because it made assumptions about the
correct encoding and because a variable length encoding can fail when writing
to fixed length segment of a structure.
Code such as ``struct.pack('<6sHHBBB', 'GIF87a', x, y)`` should be rewritten
with to use bytes instead of text, ``struct.pack('<6sHHBBB', b'GIF87a', x, y)``.
(Discovered by David Beazley and fixed by Victor Stinner; :issue:`10783`.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment