Giampaolo Rodolà | 3108f98 | 2011-02-24 20:59:48 +0000 | [diff] [blame] | 1 | **************************** |
| 2 | What's New In Python 3.3 |
| 3 | **************************** |
| 4 | |
| 5 | :Author: Raymond Hettinger |
| 6 | :Release: |release| |
| 7 | :Date: |today| |
| 8 | |
| 9 | .. $Id$ |
| 10 | Rules for maintenance: |
| 11 | |
| 12 | * Anyone can add text to this document. Do not spend very much time |
| 13 | on the wording of your changes, because your text will probably |
| 14 | get rewritten to some degree. |
| 15 | |
| 16 | * The maintainer will go through Misc/NEWS periodically and add |
| 17 | changes; it's therefore more important to add your changes to |
| 18 | Misc/NEWS than to this file. |
| 19 | |
| 20 | * This is not a complete list of every single change; completeness |
| 21 | is the purpose of Misc/NEWS. Some changes I consider too small |
| 22 | or esoteric to include. If such a change is added to the text, |
| 23 | I'll just remove it. (This is another reason you shouldn't spend |
| 24 | too much time on writing your addition.) |
| 25 | |
| 26 | * If you want to draw your new text to the attention of the |
| 27 | maintainer, add 'XXX' to the beginning of the paragraph or |
| 28 | section. |
| 29 | |
| 30 | * It's OK to just add a fragmentary note about a change. For |
| 31 | example: "XXX Describe the transmogrify() function added to the |
| 32 | socket module." The maintainer will research the change and |
| 33 | write the necessary text. |
| 34 | |
| 35 | * You can comment out your additions if you like, but it's not |
| 36 | necessary (especially when a final release is some months away). |
| 37 | |
| 38 | * Credit the author of a patch or bugfix. Just the name is |
| 39 | sufficient; the e-mail address isn't necessary. |
| 40 | |
| 41 | * It's helpful to add the bug/patch number as a comment: |
| 42 | |
| 43 | % Patch 12345 |
| 44 | XXX Describe the transmogrify() function added to the socket |
| 45 | module. |
| 46 | (Contributed by P.Y. Developer.) |
| 47 | |
| 48 | This saves the maintainer the effort of going through the SVN log |
| 49 | when researching a change. |
| 50 | |
| 51 | This article explains the new features in Python 3.3, compared to 3.2. |
| 52 | |
| 53 | |
| 54 | PEP XXX: Stub |
| 55 | ============= |
| 56 | |
| 57 | |
| 58 | Other Language Changes |
| 59 | ====================== |
| 60 | |
| 61 | Some smaller changes made to the core Python language are: |
| 62 | |
| 63 | * Stub |
| 64 | |
| 65 | |
| 66 | New, Improved, and Deprecated Modules |
| 67 | ===================================== |
| 68 | |
| 69 | * Stub |
| 70 | |
Victor Stinner | 024e37a | 2011-03-31 01:31:06 +0200 | [diff] [blame] | 71 | faulthandler |
| 72 | ------------ |
| 73 | |
| 74 | New module: :mod:`faulthandler`. |
| 75 | |
| 76 | * :envvar:`PYTHONFAULTHANDLER` |
| 77 | * :option:`-X` ``faulthandler`` |
| 78 | |
Victor Stinner | fa0e3d5 | 2011-05-09 01:01:09 +0200 | [diff] [blame] | 79 | |
| 80 | math |
| 81 | ---- |
| 82 | |
| 83 | The :mod:`math` module has a new function: |
| 84 | |
| 85 | * :func:`~math.log2`: return the base-2 logarithm of *x* |
| 86 | (Written by Mark Dickinson in :issue:`11888`). |
| 87 | |
| 88 | |
| 89 | nntplib |
| 90 | ------- |
| 91 | |
| 92 | The :class:`nntplib.NNTP` class now supports the context manager protocol to |
| 93 | unconditionally consume :exc:`socket.error` exceptions and to close the NNTP |
| 94 | connection when done:: |
| 95 | |
| 96 | >>> from nntplib import NNTP |
| 97 | >>> with nntplib.NNTP('news.gmane.org') as n: |
| 98 | ... n.group('gmane.comp.python.committers') |
| 99 | ... |
| 100 | ('211 1454 1 1454 gmane.comp.python.committers', '1454', '1', '1454', 'gmane.comp.python.committers') |
| 101 | >>> |
| 102 | |
| 103 | (Contributed by Giampaolo Rodolà in :issue:`9795`) |
| 104 | |
| 105 | |
Giampaolo Rodolà | c9c2c8b | 2011-02-25 14:39:16 +0000 | [diff] [blame] | 106 | os |
| 107 | -- |
| 108 | |
Charles-François Natali | a003af1 | 2011-06-01 20:30:52 +0200 | [diff] [blame] | 109 | * The :mod:`os` module has a new :func:`~os.pipe2` function that makes it |
| 110 | possible to create a pipe with :data:`~os.O_CLOEXEC` or |
| 111 | :data:`~os.O_NONBLOCK` flags set atomically. This is especially useful to |
| 112 | avoid race conditions in multi-threaded programs. |
| 113 | |
Giampaolo Rodolà | 18e8bcb | 2011-02-25 20:57:54 +0000 | [diff] [blame] | 114 | * The :mod:`os` module has a new :func:`~os.sendfile` function which provides |
| 115 | an efficent "zero-copy" way for copying data from one file (or socket) |
| 116 | descriptor to another. The phrase "zero-copy" refers to the fact that all of |
| 117 | the copying of data between the two descriptors is done entirely by the |
| 118 | kernel, with no copying of data into userspace buffers. :func:`~os.sendfile` |
| 119 | can be used to efficiently copy data from a file on disk to a network socket, |
| 120 | e.g. for downloading a file. |
Giampaolo Rodolà | c9c2c8b | 2011-02-25 14:39:16 +0000 | [diff] [blame] | 121 | |
Giampaolo Rodolà | 18e8bcb | 2011-02-25 20:57:54 +0000 | [diff] [blame] | 122 | (Patch submitted by Ross Lagerwall and Giampaolo Rodolà in :issue:`10882`.) |
| 123 | |
| 124 | * The :mod:`os` module has two new functions: :func:`~os.getpriority` and |
| 125 | :func:`~os.setpriority`. They can be used to get or set process |
| 126 | niceness/priority in a fashion similar to :func:`os.nice` but extended to all |
| 127 | processes instead of just the current one. |
| 128 | |
| 129 | (Patch submitted by Giampaolo Rodolà in :issue:`10784`.) |
Giampaolo Rodolà | 3108f98 | 2011-02-24 20:59:48 +0000 | [diff] [blame] | 130 | |
Giampaolo Rodolà | 424298a | 2011-03-03 18:34:06 +0000 | [diff] [blame] | 131 | |
Éric Araujo | 765e94f | 2011-06-03 17:26:59 +0200 | [diff] [blame] | 132 | packaging |
| 133 | --------- |
| 134 | |
| 135 | :mod:`distutils` has undergone additions and refactoring under a new name, |
| 136 | :mod:`packaging`, to allow developers to break backward compatibility. |
| 137 | :mod:`distutils` is still provided in the standard library, but users are |
| 138 | encouraged to transition to :mod:`packaging`. For older versions of Python, a |
| 139 | backport compatible with 2.4+ and 3.1+ will be made available on PyPI under the |
| 140 | name :mod:`distutils2`. |
| 141 | |
| 142 | .. TODO add examples and howto to the packaging docs and link to them |
| 143 | |
| 144 | |
Victor Stinner | 383c3fc | 2011-05-25 01:35:05 +0200 | [diff] [blame] | 145 | pydoc |
| 146 | ----- |
| 147 | |
Victor Stinner | 6daa33c | 2011-05-25 01:41:22 +0200 | [diff] [blame] | 148 | The Tk GUI and the :func:`~pydoc.serve` function have been removed from the |
| 149 | :mod:`pydoc` module: ``pydoc -g`` and :func:`~pydoc.serve` have been deprecated |
| 150 | in Python 3.2. |
Victor Stinner | 383c3fc | 2011-05-25 01:35:05 +0200 | [diff] [blame] | 151 | |
| 152 | |
Victor Stinner | d5c355c | 2011-04-30 14:53:09 +0200 | [diff] [blame] | 153 | sys |
| 154 | --- |
Victor Stinner | 754851f | 2011-04-19 23:58:51 +0200 | [diff] [blame] | 155 | |
Victor Stinner | d5c355c | 2011-04-30 14:53:09 +0200 | [diff] [blame] | 156 | * The :mod:`sys` module has a new :func:`~sys.thread_info` :term:`struct |
| 157 | sequence` holding informations about the thread implementation. |
Victor Stinner | 754851f | 2011-04-19 23:58:51 +0200 | [diff] [blame] | 158 | |
Georg Brandl | 00db582 | 2011-04-30 15:30:03 +0200 | [diff] [blame] | 159 | (:issue:`11223`) |
Victor Stinner | a929335 | 2011-04-30 15:21:58 +0200 | [diff] [blame] | 160 | |
Victor Stinner | fa0e3d5 | 2011-05-09 01:01:09 +0200 | [diff] [blame] | 161 | |
Victor Stinner | a929335 | 2011-04-30 15:21:58 +0200 | [diff] [blame] | 162 | signal |
| 163 | ------ |
| 164 | |
Victor Stinner | fa0e3d5 | 2011-05-09 01:01:09 +0200 | [diff] [blame] | 165 | * The :mod:`signal` module has new functions: |
Victor Stinner | a929335 | 2011-04-30 15:21:58 +0200 | [diff] [blame] | 166 | |
Victor Stinner | b3e7219 | 2011-05-08 01:46:11 +0200 | [diff] [blame] | 167 | * :func:`~signal.pthread_sigmask`: fetch and/or change the signal mask of the |
| 168 | calling thread (Contributed by Jean-Paul Calderone in :issue:`8407`) ; |
| 169 | * :func:`~signal.pthread_kill`: send a signal to a thread ; |
| 170 | * :func:`~signal.sigpending`: examine pending functions ; |
| 171 | * :func:`~signal.sigwait`: wait a signal. |
Ross Lagerwall | bc80822 | 2011-06-25 12:13:40 +0200 | [diff] [blame] | 172 | * :func:`~signal.sigwaitinfo`: wait for a signal, returning detailed |
| 173 | information about it. |
| 174 | * :func:`~signal.sigtimedwait`: like :func:`~signal.sigwaitinfo` but with a |
| 175 | timeout. |
Victor Stinner | a929335 | 2011-04-30 15:21:58 +0200 | [diff] [blame] | 176 | |
Victor Stinner | d49b1f1 | 2011-05-08 02:03:15 +0200 | [diff] [blame] | 177 | * The signal handler writes the signal number as a single byte instead of |
| 178 | a nul byte into the wakeup file descriptor. So it is possible to wait more |
| 179 | than one signal and know which signals were raised. |
| 180 | |
Victor Stinner | 388196e | 2011-05-10 17:13:00 +0200 | [diff] [blame] | 181 | * :func:`signal.signal` and :func:`signal.siginterrupt` raise an OSError, |
| 182 | instead of a RuntimeError: OSError has an errno attribute. |
| 183 | |
Victor Stinner | 754851f | 2011-04-19 23:58:51 +0200 | [diff] [blame] | 184 | |
Victor Stinner | 99c8b16 | 2011-05-24 12:05:19 +0200 | [diff] [blame] | 185 | ssl |
| 186 | --- |
| 187 | |
| 188 | The :mod:`ssl` module has new functions: |
| 189 | |
| 190 | * :func:`~ssl.RAND_bytes`: generate cryptographically strong |
| 191 | pseudo-random bytes. |
| 192 | * :func:`~ssl.RAND_pseudo_bytes`: generate pseudo-random bytes. |
| 193 | |
| 194 | |
Giampaolo Rodola' | 096dcb1 | 2011-06-27 11:17:51 +0200 | [diff] [blame^] | 195 | ftplib |
| 196 | ------ |
| 197 | |
| 198 | The :class:`~ftplib.FTP_TLS` class now provides a new |
| 199 | :func:`~ftplib.FTP_TLS.ccc` function to revert control channel back to |
| 200 | plaintex. This can be useful to take advantage of firewalls that know how to |
| 201 | handle NAT with non-secure FTP without opening fixed ports. |
| 202 | |
| 203 | (Patch submitted by Giampaolo Rodolà in :issue:`12139`.) |
| 204 | |
| 205 | |
Giampaolo Rodolà | 3108f98 | 2011-02-24 20:59:48 +0000 | [diff] [blame] | 206 | Optimizations |
| 207 | ============= |
| 208 | |
| 209 | Major performance enhancements have been added: |
| 210 | |
| 211 | * Stub |
| 212 | |
| 213 | |
| 214 | Build and C API Changes |
| 215 | ======================= |
| 216 | |
| 217 | Changes to Python's build process and to the C API include: |
| 218 | |
| 219 | * Stub |
| 220 | |
| 221 | |
Georg Brandl | 0cd25c9 | 2011-04-29 13:45:54 +0200 | [diff] [blame] | 222 | Unsupported Operating Systems |
Victor Stinner | b90db4c | 2011-04-26 22:48:24 +0200 | [diff] [blame] | 223 | ============================= |
| 224 | |
Brian Curtin | 49a40cd | 2011-05-02 22:30:06 -0500 | [diff] [blame] | 225 | OS/2 and VMS are no longer supported due to the lack of a maintainer. |
| 226 | |
| 227 | Windows 2000 and Windows platforms which set ``COMSPEC`` to ``command.com`` |
| 228 | are no longer supported due to maintenance burden. |
Victor Stinner | b90db4c | 2011-04-26 22:48:24 +0200 | [diff] [blame] | 229 | |
| 230 | |
Giampaolo Rodolà | 3108f98 | 2011-02-24 20:59:48 +0000 | [diff] [blame] | 231 | Porting to Python 3.3 |
| 232 | ===================== |
| 233 | |
| 234 | This section lists previously described changes and other bugfixes |
| 235 | that may require changes to your code: |
| 236 | |
| 237 | * Stub |
| 238 | |
Éric Araujo | c09fca6 | 2011-03-23 02:06:24 +0100 | [diff] [blame] | 239 | |
| 240 | .. Issue #11591: When :program:`python` was started with :option:`-S`, |
| 241 | ``import site`` will not add site-specific paths to the module search |
| 242 | paths. In previous versions, it did. See changeset for doc changes in |
| 243 | various files. Contributed by Carl Meyer with editions by Éric Araujo. |
Éric Araujo | be3bd57 | 2011-03-26 01:55:15 +0100 | [diff] [blame] | 244 | |
| 245 | .. Issue #10998: -Q command-line flags are related artifacts have been |
| 246 | removed. Code checking sys.flags.division_warning will need updating. |
| 247 | Contributed by Éric Araujo. |