Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(6000)

Delta Between Two Patch Sets: Doc/whatsnew/3.4.rst

Issue 22417: PEP 476: verify HTTPS certificates by default
Left Patch Set: Created 4 years, 8 months ago
Right Patch Set: Created 4 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Doc/library/xmlrpc.client.rst ('k') | Lib/http/client.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 **************************** 1 ****************************
2 What's New In Python 3.4 2 What's New In Python 3.4
3 **************************** 3 ****************************
4 4
5 :Author: R. David Murray <rdmurray@bitdance.com> (Editor) 5 :Author: R. David Murray <rdmurray@bitdance.com> (Editor)
6 6
7 .. Rules for maintenance: 7 .. Rules for maintenance:
8 8
9 * Anyone can add text to this document, but the maintainer reserves the 9 * Anyone can add text to this document, but the maintainer reserves the
10 right to rewrite any additions. In particular, for obscure or esoteric 10 right to rewrite any additions. In particular, for obscure or esoteric
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 * You can comment out your additions if you like, but it's not 46 * You can comment out your additions if you like, but it's not
47 necessary (especially when a final release is some months away). 47 necessary (especially when a final release is some months away).
48 48
49 * Credit the author of a patch or bugfix. Just the name is 49 * Credit the author of a patch or bugfix. Just the name is
50 sufficient; the e-mail address isn't necessary. 50 sufficient; the e-mail address isn't necessary.
51 51
52 * It's helpful to add the bug/patch number as a comment: 52 * It's helpful to add the bug/patch number as a comment:
53 53
54 The :ref:`~socket.transmogrify()` function was added to the 54 The :ref:`~socket.transmogrify()` function was added to the
55 :mod:`socket` module. (Contributed by P.Y. Developer in :issue:`12345`.) 55 :mod:`socket` module. (Contributed by P.Y. Developer in :issue:`12345`.)
56 56
57 This saves the maintainer the effort of going through the Mercurial log 57 This saves the maintainer the effort of going through the Mercurial log
58 when researching a change. 58 when researching a change.
59 59
60 * Cross referencing tip: :ref:`mod.attr` will display as ``mod.attr``, 60 * Cross referencing tip: :ref:`mod.attr` will display as ``mod.attr``,
61 while :ref:`~mod.attr` will display as ``attr``. 61 while :ref:`~mod.attr` will display as ``attr``.
62 62
63 This article explains the new features in Python 3.4, compared to 3.3. 63 This article explains the new features in Python 3.4, compared to 3.3.
64 Python 3.4 was released on March 16, 2014. For full details, see the 64 Python 3.4 was released on March 16, 2014. For full details, see the
65 `changelog <https://docs.python.org/3.4/whatsnew/changelog.html>`_. 65 `changelog <https://docs.python.org/3.4/whatsnew/changelog.html>`_.
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 >>> from codecs import encode, decode 365 >>> from codecs import encode, decode
366 >>> encode(b"hello", "hex") 366 >>> encode(b"hello", "hex")
367 b'68656c6c6f' 367 b'68656c6c6f'
368 >>> decode(b"68656c6c6f", "hex") 368 >>> decode(b"68656c6c6f", "hex")
369 b'hello' 369 b'hello'
370 370
371 The binary and text transforms provided in the standard library are detailed 371 The binary and text transforms provided in the standard library are detailed
372 in :ref:`binary-transforms` and :ref:`text-transforms`. 372 in :ref:`binary-transforms` and :ref:`text-transforms`.
373 373
374 (Contributed by Nick Coghlan in :issue:`7475`, :issue:`17827`, 374 (Contributed by Nick Coghlan in :issue:`7475`, :issue:`17827`,
375 :issue:`17828` and :issue:`19619`) 375 :issue:`17828` and :issue:`19619`.)
376 376
377 377
378 .. _whatsnew-pep-451: 378 .. _whatsnew-pep-451:
379 379
380 PEP 451: A ModuleSpec Type for the Import System 380 PEP 451: A ModuleSpec Type for the Import System
381 ------------------------------------------------ 381 ------------------------------------------------
382 382
383 :pep:`451` provides an encapsulation of the information about a module that the 383 :pep:`451` provides an encapsulation of the information about a module that the
384 import machinery will use to load it (that is, a module specification). This 384 import machinery will use to load it (that is, a module specification). This
385 helps simplify both the import implementation and several import-related APIs. 385 helps simplify both the import implementation and several import-related APIs.
(...skipping 21 matching lines...) Expand all
407 * :func:`min` and :func:`max` now accept a *default* keyword-only argument that 407 * :func:`min` and :func:`max` now accept a *default* keyword-only argument that
408 can be used to specify the value they return if the iterable they are 408 can be used to specify the value they return if the iterable they are
409 evaluating has no elements. (Contributed by Julian Berman in 409 evaluating has no elements. (Contributed by Julian Berman in
410 :issue:`18111`.) 410 :issue:`18111`.)
411 411
412 * Module objects are now :mod:`weakref`'able. 412 * Module objects are now :mod:`weakref`'able.
413 413
414 * Module ``__file__`` attributes (and related values) should now always 414 * Module ``__file__`` attributes (and related values) should now always
415 contain absolute paths by default, with the sole exception of 415 contain absolute paths by default, with the sole exception of
416 ``__main__.__file__`` when a script has been executed directly using 416 ``__main__.__file__`` when a script has been executed directly using
417 a relative path (Contributed by Brett Cannon in :issue:`18416`). 417 a relative path. (Contributed by Brett Cannon in :issue:`18416`.)
418 418
419 * All the UTF-\* codecs (except UTF-7) now reject surrogates during both 419 * All the UTF-\* codecs (except UTF-7) now reject surrogates during both
420 encoding and decoding unless the ``surrogatepass`` error handler is used, 420 encoding and decoding unless the ``surrogatepass`` error handler is used,
421 with the exception of the UTF-16 decoder (which accepts valid surrogate pairs) 421 with the exception of the UTF-16 decoder (which accepts valid surrogate pairs)
422 and the UTF-16 encoder (which produces them while encoding non-BMP characters) . 422 and the UTF-16 encoder (which produces them while encoding non-BMP characters) .
423 Contributed by Victor Stinner, Kang-Hao (Kenny) Lu and Serhiy Storchaka in 423 (Contributed by Victor Stinner, Kang-Hao (Kenny) Lu and Serhiy Storchaka in
424 :issue:`12892`. 424 :issue:`12892`.)
425 425
426 * New German EBCDIC :ref:`codec <standard-encodings>` ``cp273``. (Contributed 426 * New German EBCDIC :ref:`codec <standard-encodings>` ``cp273``. (Contributed
427 by Michael Bierenfeld and Andrew Kuchling in :issue:`1097797`.) 427 by Michael Bierenfeld and Andrew Kuchling in :issue:`1097797`.)
428 428
429 * New Ukrainian :ref:`codec <standard-encodings>` ``cp1125``. (Contributed by 429 * New Ukrainian :ref:`codec <standard-encodings>` ``cp1125``. (Contributed by
430 Serhiy Storchaka in :issue:`19668`.) 430 Serhiy Storchaka in :issue:`19668`.)
431 431
432 * :class:`bytes`.join() and :class:`bytearray`.join() now accept arbitrary 432 * :class:`bytes`.join() and :class:`bytearray`.join() now accept arbitrary
433 buffer objects as arguments. (Contributed by Antoine Pitrou in 433 buffer objects as arguments. (Contributed by Antoine Pitrou in
434 :issue:`15958`.) 434 :issue:`15958`.)
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 by Lucas Maystre in :issue:`11175`.) 626 by Lucas Maystre in :issue:`11175`.)
627 627
628 628
629 audioop 629 audioop
630 ------- 630 -------
631 631
632 :mod:`audioop` now supports 24-bit samples. (Contributed by Serhiy Storchaka 632 :mod:`audioop` now supports 24-bit samples. (Contributed by Serhiy Storchaka
633 in :issue:`12866`.) 633 in :issue:`12866`.)
634 634
635 New :func:`~audioop.byteswap` function converts big-endian samples to 635 New :func:`~audioop.byteswap` function converts big-endian samples to
636 little-endian and vice versa (Contributed by Serhiy Storchaka in 636 little-endian and vice versa. (Contributed by Serhiy Storchaka in
637 :issue:`19641`). 637 :issue:`19641`.)
638 638
639 All :mod:`audioop` functions now accept any :term:`bytes-like object`. Strings 639 All :mod:`audioop` functions now accept any :term:`bytes-like object`. Strings
640 are not accepted: they didn't work before, now they raise an error right away. 640 are not accepted: they didn't work before, now they raise an error right away.
641 (Contributed by Serhiy Storchaka in :issue:`16685`.) 641 (Contributed by Serhiy Storchaka in :issue:`16685`.)
642 642
643 643
644 base64 644 base64
645 ------ 645 ------
646 646
647 The encoding and decoding functions in :mod:`base64` now accept any 647 The encoding and decoding functions in :mod:`base64` now accept any
(...skipping 26 matching lines...) Expand all
674 been expanded so that they match the FCC NTSC versions. The change in 674 been expanded so that they match the FCC NTSC versions. The change in
675 results should be less than 1% and may better match results found elsewhere. 675 results should be less than 1% and may better match results found elsewhere.
676 (Contributed by Brian Landers and Serhiy Storchaka in :issue:`14323`.) 676 (Contributed by Brian Landers and Serhiy Storchaka in :issue:`14323`.)
677 677
678 678
679 contextlib 679 contextlib
680 ---------- 680 ----------
681 681
682 The new :class:`contextlib.suppress` context manager helps to clarify the 682 The new :class:`contextlib.suppress` context manager helps to clarify the
683 intent of code that deliberately suppresses exceptions from a single 683 intent of code that deliberately suppresses exceptions from a single
684 statement. (Contributed by Raymond Hettinger in :issue:`15806` and 684 statement. (Contributed by Raymond Hettinger in :issue:`15806` and
685 Zero Piraeus in :issue:`19266`) 685 Zero Piraeus in :issue:`19266`.)
686 686
687 The new :func:`contextlib.redirect_stdout` context manager makes it easier 687 The new :func:`contextlib.redirect_stdout` context manager makes it easier
688 for utility scripts to handle inflexible APIs that write their output to 688 for utility scripts to handle inflexible APIs that write their output to
689 :data:`sys.stdout` and don't provide any options to redirect it. Using the 689 :data:`sys.stdout` and don't provide any options to redirect it. Using the
690 context manager, the :data:`sys.stdout` output can be redirected to any 690 context manager, the :data:`sys.stdout` output can be redirected to any
691 other stream or, in conjunction with :class:`io.StringIO`, to a string. 691 other stream or, in conjunction with :class:`io.StringIO`, to a string.
692 The latter can be especially useful, for example, to capture output 692 The latter can be especially useful, for example, to capture output
693 from a function that was written to implement a command line interface. 693 from a function that was written to implement a command line interface.
694 It is recommended only for utility scripts because it affects the 694 It is recommended only for utility scripts because it affects the
695 global state of :data:`sys.stdout`. (Contributed by Raymond Hettinger 695 global state of :data:`sys.stdout`. (Contributed by Raymond Hettinger
696 in :issue:`15805`) 696 in :issue:`15805`.)
697 697
698 The :mod:`contextlib` documentation has also been updated to include a 698 The :mod:`contextlib` documentation has also been updated to include a
699 :ref:`discussion <single-use-reusable-and-reentrant-cms>` of the 699 :ref:`discussion <single-use-reusable-and-reentrant-cms>` of the
700 differences between single use, reusable and reentrant context managers. 700 differences between single use, reusable and reentrant context managers.
701 701
702 702
703 dbm 703 dbm
704 --- 704 ---
705 705
706 :func:`dbm.open` objects now support the context management protocol. When 706 :func:`dbm.open` objects now support the context management protocol. When
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 ' --> 3 LOAD_CONST 1 (1)', 758 ' --> 3 LOAD_CONST 1 (1)',
759 ' 6 BINARY_ADD', 759 ' 6 BINARY_ADD',
760 ' 7 RETURN_VALUE'] 760 ' 7 RETURN_VALUE']
761 761
762 :class:`~dis.Bytecode` also has a class method, 762 :class:`~dis.Bytecode` also has a class method,
763 :meth:`~dis.Bytecode.from_traceback`, that provides the ability to manipulate a 763 :meth:`~dis.Bytecode.from_traceback`, that provides the ability to manipulate a
764 traceback (that is, ``print(Bytecode.from_traceback(tb).dis())`` is equivalent 764 traceback (that is, ``print(Bytecode.from_traceback(tb).dis())`` is equivalent
765 to ``distb(tb)``). 765 to ``distb(tb)``).
766 766
767 (Contributed by Nick Coghlan, Ryan Kelly and Thomas Kluyver in :issue:`11816` 767 (Contributed by Nick Coghlan, Ryan Kelly and Thomas Kluyver in :issue:`11816`
768 and Claudiu Popa in :issue:`17916`) 768 and Claudiu Popa in :issue:`17916`.)
769 769
770 New function :func:`~dis.stack_effect` computes the effect on the Python stack 770 New function :func:`~dis.stack_effect` computes the effect on the Python stack
771 of a given opcode and argument, information that is not otherwise available. 771 of a given opcode and argument, information that is not otherwise available.
772 (Contributed by Larry Hastings in :issue:`19722`.) 772 (Contributed by Larry Hastings in :issue:`19722`.)
773 773
774 774
775 doctest 775 doctest
776 ------- 776 -------
777 777
778 A new :ref:`option flag <doctest-options>`, :data:`~doctest.FAIL_FAST`, halts 778 A new :ref:`option flag <doctest-options>`, :data:`~doctest.FAIL_FAST`, halts
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 848
849 849
850 functools 850 functools
851 --------- 851 ---------
852 852
853 The new :func:`~functools.partialmethod` descriptor brings partial argument 853 The new :func:`~functools.partialmethod` descriptor brings partial argument
854 application to descriptors, just as :func:`~functools.partial` provides 854 application to descriptors, just as :func:`~functools.partial` provides
855 for normal callables. The new descriptor also makes it easier to get 855 for normal callables. The new descriptor also makes it easier to get
856 arbitrary callables (including :func:`~functools.partial` instances) 856 arbitrary callables (including :func:`~functools.partial` instances)
857 to behave like normal instance methods when included in a class definition. 857 to behave like normal instance methods when included in a class definition.
858 (Contributed by Alon Horev and Nick Coghlan in :issue:`4331`) 858 (Contributed by Alon Horev and Nick Coghlan in :issue:`4331`.)
859 859
860 .. _whatsnew-singledispatch: 860 .. _whatsnew-singledispatch:
861 861
862 The new :func:`~functools.singledispatch` decorator brings support for 862 The new :func:`~functools.singledispatch` decorator brings support for
863 single-dispatch generic functions to the Python standard library. Where 863 single-dispatch generic functions to the Python standard library. Where
864 object oriented programming focuses on grouping multiple operations on a 864 object oriented programming focuses on grouping multiple operations on a
865 common set of data into a class, a generic function focuses on grouping 865 common set of data into a class, a generic function focuses on grouping
866 multiple implementations of an operation that allows it to work with 866 multiple implementations of an operation that allows it to work with
867 *different* kinds of data. 867 *different* kinds of data.
868 868
(...skipping 27 matching lines...) Expand all
896 in a filename so that they do not become part of the globbing expansion but are 896 in a filename so that they do not become part of the globbing expansion but are
897 instead matched literally. (Contributed by Serhiy Storchaka in :issue:`8402`.) 897 instead matched literally. (Contributed by Serhiy Storchaka in :issue:`8402`.)
898 898
899 899
900 hashlib 900 hashlib
901 ------- 901 -------
902 902
903 A new :func:`hashlib.pbkdf2_hmac` function provides 903 A new :func:`hashlib.pbkdf2_hmac` function provides
904 the `PKCS#5 password-based key derivation function 2 904 the `PKCS#5 password-based key derivation function 2
905 <http://en.wikipedia.org/wiki/PBKDF2>`_. (Contributed by Christian 905 <http://en.wikipedia.org/wiki/PBKDF2>`_. (Contributed by Christian
906 Heimes in :issue:`18582`) 906 Heimes in :issue:`18582`.)
907 907
908 The :attr:`~hashlib.hash.name` attribute of :mod:`hashlib` hash objects is now 908 The :attr:`~hashlib.hash.name` attribute of :mod:`hashlib` hash objects is now
909 a formally supported interface. It has always existed in CPython's 909 a formally supported interface. It has always existed in CPython's
910 :mod:`hashlib` (although it did not return lower case names for all supported 910 :mod:`hashlib` (although it did not return lower case names for all supported
911 hashes), but it was not a public interface and so some other Python 911 hashes), but it was not a public interface and so some other Python
912 implementations have not previously supported it. (Contributed by Jason R. 912 implementations have not previously supported it. (Contributed by Jason R.
913 Coombs in :issue:`18532`.) 913 Coombs in :issue:`18532`.)
914 914
915 915
916 hmac 916 hmac
(...skipping 15 matching lines...) Expand all
932 attributes (and the formal documentation of the :attr:`~hmac.HMAC.digest_size` 932 attributes (and the formal documentation of the :attr:`~hmac.HMAC.digest_size`
933 attribute), the :mod:`hmac` module now conforms fully to the :pep:`247` API. 933 attribute), the :mod:`hmac` module now conforms fully to the :pep:`247` API.
934 (Contributed by Christian Heimes in :issue:`18775`.) 934 (Contributed by Christian Heimes in :issue:`18775`.)
935 935
936 936
937 html 937 html
938 ---- 938 ----
939 939
940 New function :func:`~html.unescape` function converts HTML5 character references to 940 New function :func:`~html.unescape` function converts HTML5 character references to
941 the corresponding Unicode characters. (Contributed by Ezio Melotti in 941 the corresponding Unicode characters. (Contributed by Ezio Melotti in
942 :issue:`2927`) 942 :issue:`2927`.)
943 943
944 :class:`~html.parser.HTMLParser` accepts a new keyword argument 944 :class:`~html.parser.HTMLParser` accepts a new keyword argument
945 *convert_charrefs* that, when ``True``, automatically converts all character 945 *convert_charrefs* that, when ``True``, automatically converts all character
946 references. For backward-compatibility, its value defaults to ``False``, but 946 references. For backward-compatibility, its value defaults to ``False``, but
947 it will change to ``True`` in a future version of Python, so you are invited to 947 it will change to ``True`` in a future version of Python, so you are invited to
948 set it explicitly and update your code to use this new feature. (Contributed 948 set it explicitly and update your code to use this new feature. (Contributed
949 by Ezio Melotti in :issue:`13633`) 949 by Ezio Melotti in :issue:`13633`.)
950 950
951 The *strict* argument of :class:`~html.parser.HTMLParser` is now deprecated. 951 The *strict* argument of :class:`~html.parser.HTMLParser` is now deprecated.
952 (Contributed by Ezio Melotti in :issue:`15114`) 952 (Contributed by Ezio Melotti in :issue:`15114`.)
953 953
954 954
955 http 955 http
956 ---- 956 ----
957 957
958 :meth:`~http.server.BaseHTTPRequestHandler.send_error` now accepts an 958 :meth:`~http.server.BaseHTTPRequestHandler.send_error` now accepts an
959 optional additional *explain* parameter which can be used to provide an 959 optional additional *explain* parameter which can be used to provide an
960 extended error description, overriding the hardcoded default if there is one. 960 extended error description, overriding the hardcoded default if there is one.
961 This extended error description will be formatted using the 961 This extended error description will be formatted using the
962 :attr:`~http.server.HTTP.error_message_format` attribute and sent as the body 962 :attr:`~http.server.HTTP.error_message_format` attribute and sent as the body
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 :meth:`~importlib.machinery.ExtensionFileLoader.get_filename` method. This was 1008 :meth:`~importlib.machinery.ExtensionFileLoader.get_filename` method. This was
1009 inadvertently omitted in the original implementation. (Contributed by Eric 1009 inadvertently omitted in the original implementation. (Contributed by Eric
1010 Snow in :issue:`19152`.) 1010 Snow in :issue:`19152`.)
1011 1011
1012 1012
1013 inspect 1013 inspect
1014 ------- 1014 -------
1015 1015
1016 The :mod:`inspect` module now offers a basic :ref:`command line interface 1016 The :mod:`inspect` module now offers a basic :ref:`command line interface
1017 <inspect-module-cli>` to quickly display source code and other 1017 <inspect-module-cli>` to quickly display source code and other
1018 information for modules, classes and functions. (Contributed by Claudiu Popa 1018 information for modules, classes and functions. (Contributed by Claudiu Popa
1019 and Nick Coghlan in :issue:`18626`) 1019 and Nick Coghlan in :issue:`18626`.)
1020 1020
1021 :func:`~inspect.unwrap` makes it easy to unravel wrapper function chains 1021 :func:`~inspect.unwrap` makes it easy to unravel wrapper function chains
1022 created by :func:`functools.wraps` (and any other API that sets the 1022 created by :func:`functools.wraps` (and any other API that sets the
1023 ``__wrapped__`` attribute on a wrapper function). (Contributed by 1023 ``__wrapped__`` attribute on a wrapper function). (Contributed by
1024 Daniel Urban, Aaron Iles and Nick Coghlan in :issue:`13266`) 1024 Daniel Urban, Aaron Iles and Nick Coghlan in :issue:`13266`.)
1025 1025
1026 As part of the implementation of the new :mod:`enum` module, the 1026 As part of the implementation of the new :mod:`enum` module, the
1027 :mod:`inspect` module now has substantially better support for custom 1027 :mod:`inspect` module now has substantially better support for custom
1028 ``__dir__`` methods and dynamic class attributes provided through 1028 ``__dir__`` methods and dynamic class attributes provided through
1029 metaclasses (Contributed by Ethan Furman in :issue:`18929` and 1029 metaclasses. (Contributed by Ethan Furman in :issue:`18929` and
1030 :issue:`19030`) 1030 :issue:`19030`.)
1031 1031
1032 :func:`~inspect.getfullargspec` and :func:`~inspect.getargspec` 1032 :func:`~inspect.getfullargspec` and :func:`~inspect.getargspec`
1033 now use the :func:`~inspect.signature` API. This allows them to 1033 now use the :func:`~inspect.signature` API. This allows them to
1034 support a much broader range of callables, including those with 1034 support a much broader range of callables, including those with
1035 ``__signature__`` attributes, those with metadata provided by argument 1035 ``__signature__`` attributes, those with metadata provided by argument
1036 clinic, :func:`functools.partial` objects and more. Note that, unlike 1036 clinic, :func:`functools.partial` objects and more. Note that, unlike
1037 :func:`~inspect.signature`, these functions still ignore ``__wrapped__`` 1037 :func:`~inspect.signature`, these functions still ignore ``__wrapped__``
1038 attributes, and report the already bound first argument for bound methods, 1038 attributes, and report the already bound first argument for bound methods,
1039 so it is still necessary to update your code to use 1039 so it is still necessary to update your code to use
1040 :func:`~inspect.signature` directly if those features are desired. 1040 :func:`~inspect.signature` directly if those features are desired.
1041 (Contributed by Yury Selivanov in :issue:`17481`) 1041 (Contributed by Yury Selivanov in :issue:`17481`.)
1042 1042
1043 :func:`~inspect.signature` now supports duck types of CPython functions, 1043 :func:`~inspect.signature` now supports duck types of CPython functions,
1044 which adds support for functions compiled with Cython. (Contributed 1044 which adds support for functions compiled with Cython. (Contributed
1045 by Stefan Behnel and Yury Selivanov in :issue:`17159`) 1045 by Stefan Behnel and Yury Selivanov in :issue:`17159`.)
1046 1046
1047 1047
1048 ipaddress 1048 ipaddress
1049 --------- 1049 ---------
1050 1050
1051 :mod:`ipaddress` was added to the standard library in Python 3.3 as a 1051 :mod:`ipaddress` was added to the standard library in Python 3.3 as a
1052 :term:`provisional API`. With the release of Python 3.4, this qualification 1052 :term:`provisional API`. With the release of Python 3.4, this qualification
1053 has been removed: :mod:`ipaddress` is now considered a stable API, covered 1053 has been removed: :mod:`ipaddress` is now considered a stable API, covered
1054 by the normal standard library requirements to maintain backwards 1054 by the normal standard library requirements to maintain backwards
1055 compatibility. 1055 compatibility.
(...skipping 19 matching lines...) Expand all
1075 :class:`configparser.RawConfigParser` subclass instance for the *fname* 1075 :class:`configparser.RawConfigParser` subclass instance for the *fname*
1076 parameter. This facilitates using a configuration file when logging 1076 parameter. This facilitates using a configuration file when logging
1077 configuration is just a part of the overall application configuration, or where 1077 configuration is just a part of the overall application configuration, or where
1078 the application modifies the configuration before passing it to 1078 the application modifies the configuration before passing it to
1079 :func:`~logging.config.fileConfig`. (Contributed by Vinay Sajip in 1079 :func:`~logging.config.fileConfig`. (Contributed by Vinay Sajip in
1080 :issue:`16110`.) 1080 :issue:`16110`.)
1081 1081
1082 Logging configuration data received from a socket via the 1082 Logging configuration data received from a socket via the
1083 :func:`logging.config.listen` function can now be validated before being 1083 :func:`logging.config.listen` function can now be validated before being
1084 processed by supplying a verification function as the argument to the new 1084 processed by supplying a verification function as the argument to the new
1085 *verify* keyword argument. (Contributed by Vinay Sajip in :issue:`15452`.) 1085 *verify* keyword argument. (Contributed by Vinay Sajip in :issue:`15452`.)
1086 1086
1087 1087
1088 .. _whatsnew-marshal-3: 1088 .. _whatsnew-marshal-3:
1089 1089
1090 marshal 1090 marshal
1091 ------- 1091 -------
1092 1092
1093 The default :mod:`marshal` version has been bumped to 3. The code implementing 1093 The default :mod:`marshal` version has been bumped to 3. The code implementing
1094 the new version restores the Python2 behavior of recording only one copy of 1094 the new version restores the Python2 behavior of recording only one copy of
1095 interned strings and preserving the interning on deserialization, and extends 1095 interned strings and preserving the interning on deserialization, and extends
(...skipping 17 matching lines...) Expand all
1113 .. _whatsnew-multiprocessing-no-fork: 1113 .. _whatsnew-multiprocessing-no-fork:
1114 1114
1115 On Unix two new :ref:`start methods <multiprocessing-start-methods>`, 1115 On Unix two new :ref:`start methods <multiprocessing-start-methods>`,
1116 (``spawn`` and ``forkserver``, have been added for starting processes using 1116 (``spawn`` and ``forkserver``, have been added for starting processes using
1117 :mod:`multiprocessing`. These make the mixing of processes with threads more 1117 :mod:`multiprocessing`. These make the mixing of processes with threads more
1118 robust, and the ``spawn`` method matches the semantics that multiprocessing has 1118 robust, and the ``spawn`` method matches the semantics that multiprocessing has
1119 always used on Windows. New function 1119 always used on Windows. New function
1120 :func:`~multiprocessing.get_all_start_methods` reports all start methods 1120 :func:`~multiprocessing.get_all_start_methods` reports all start methods
1121 available on the platform, :func:`~multiprocessing.get_start_method` reports 1121 available on the platform, :func:`~multiprocessing.get_start_method` reports
1122 the current start method, and :func:`~multiprocessing.set_start_method` sets 1122 the current start method, and :func:`~multiprocessing.set_start_method` sets
1123 the start method. (Contributed by Richard Oudkerk in :issue:`8713`). 1123 the start method. (Contributed by Richard Oudkerk in :issue:`8713`.)
1124 1124
1125 :mod:`multiprocessing` also now has the concept of a ``context``, which 1125 :mod:`multiprocessing` also now has the concept of a ``context``, which
1126 determines how child processes are created. New function 1126 determines how child processes are created. New function
1127 :func:`~multiprocessing.get_context` returns a context that uses a specified 1127 :func:`~multiprocessing.get_context` returns a context that uses a specified
1128 start method. It has the same API as the :mod:`multiprocessing` module itself, 1128 start method. It has the same API as the :mod:`multiprocessing` module itself,
1129 so you can use it to create :class:`~multiprocessing.pool.Pool`\ s and other 1129 so you can use it to create :class:`~multiprocessing.pool.Pool`\ s and other
1130 objects that will operate within that context. This allows a framework and an 1130 objects that will operate within that context. This allows a framework and an
1131 application or different parts of the same application to use multiprocessing 1131 application or different parts of the same application to use multiprocessing
1132 without interfering with each other. (Contributed by Richard Oudkerk in 1132 without interfering with each other. (Contributed by Richard Oudkerk in
1133 :issue:`18999`.) 1133 :issue:`18999`.)
1134 1134
1135 Except when using the old *fork* start method, child processes no longer 1135 Except when using the old *fork* start method, child processes no longer
1136 inherit unneeded handles/file descriptors from their parents (part of 1136 inherit unneeded handles/file descriptors from their parents (part of
1137 :issue:`8713`). 1137 :issue:`8713`).
1138 1138
1139 :mod:`multiprocessing` now relies on :mod:`runpy` (which implements the 1139 :mod:`multiprocessing` now relies on :mod:`runpy` (which implements the
1140 ``-m`` switch) to initialise ``__main__`` appropriately in child processes 1140 ``-m`` switch) to initialise ``__main__`` appropriately in child processes
1141 when using the ``spawn`` or ``forkserver`` start methods. This resolves some 1141 when using the ``spawn`` or ``forkserver`` start methods. This resolves some
1142 edge cases where combining multiprocessing, the ``-m`` command line switch, 1142 edge cases where combining multiprocessing, the ``-m`` command line switch,
1143 and explicit relative imports could cause obscure failures in child 1143 and explicit relative imports could cause obscure failures in child
1144 processes. (Contributed by Nick Coghlan in :issue:`19946`) 1144 processes. (Contributed by Nick Coghlan in :issue:`19946`.)
1145 1145
1146 1146
1147 operator 1147 operator
1148 -------- 1148 --------
1149 1149
1150 New function :func:`~operator.length_hint` provides an implementation of the 1150 New function :func:`~operator.length_hint` provides an implementation of the
1151 specification for how the :meth:`~object.__length_hint__` special method should 1151 specification for how the :meth:`~object.__length_hint__` special method should
1152 be used, as part of the :pep:`424` formal specification of this language 1152 be used, as part of the :pep:`424` formal specification of this language
1153 feature. (Contributed by Armin Ronacher in :issue:`16148`.) 1153 feature. (Contributed by Armin Ronacher in :issue:`16148`.)
1154 1154
(...skipping 14 matching lines...) Expand all
1169 platform on which Python is running (or ``None`` if the count can't be 1169 platform on which Python is running (or ``None`` if the count can't be
1170 determined). The :func:`multiprocessing.cpu_count` function is now implemented 1170 determined). The :func:`multiprocessing.cpu_count` function is now implemented
1171 in terms of this function). (Contributed by Trent Nelson, Yogesh Chaudhari, 1171 in terms of this function). (Contributed by Trent Nelson, Yogesh Chaudhari,
1172 Victor Stinner, and Charles-François Natali in :issue:`17914`.) 1172 Victor Stinner, and Charles-François Natali in :issue:`17914`.)
1173 1173
1174 :func:`os.path.samestat` is now available on the Windows platform (and the 1174 :func:`os.path.samestat` is now available on the Windows platform (and the
1175 :func:`os.path.samefile` implementation is now shared between Unix and 1175 :func:`os.path.samefile` implementation is now shared between Unix and
1176 Windows). (Contributed by Brian Curtin in :issue:`11939`.) 1176 Windows). (Contributed by Brian Curtin in :issue:`11939`.)
1177 1177
1178 :func:`os.path.ismount` now recognizes volumes mounted below a drive 1178 :func:`os.path.ismount` now recognizes volumes mounted below a drive
1179 root on Windows. (Contributed by Tim Golden in :issue:`9035`.) 1179 root on Windows. (Contributed by Tim Golden in :issue:`9035`.)
1180 1180
1181 :func:`os.open` supports two new flags on platforms that provide them, 1181 :func:`os.open` supports two new flags on platforms that provide them,
1182 :data:`~os.O_PATH` (un-opened file descriptor), and :data:`~os.O_TMPFILE` 1182 :data:`~os.O_PATH` (un-opened file descriptor), and :data:`~os.O_TMPFILE`
1183 (unnamed temporary file; as of 3.4.0 release available only on Linux systems 1183 (unnamed temporary file; as of 3.4.0 release available only on Linux systems
1184 with a kernel version of 3.11 or newer that have uapi headers). (Contributed 1184 with a kernel version of 3.11 or newer that have uapi headers). (Contributed
1185 by Christian Heimes in :issue:`18673` and Benjamin Peterson, respectively.) 1185 by Christian Heimes in :issue:`18673` and Benjamin Peterson, respectively.)
1186 1186
1187 1187
1188 pdb 1188 pdb
1189 --- 1189 ---
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 1223
1224 plistlib 1224 plistlib
1225 -------- 1225 --------
1226 1226
1227 :mod:`plistlib` now has an API that is similar to the standard pattern for 1227 :mod:`plistlib` now has an API that is similar to the standard pattern for
1228 stdlib serialization protocols, with new :func:`~plistlib.load`, 1228 stdlib serialization protocols, with new :func:`~plistlib.load`,
1229 :func:`~plistlib.dump`, :func:`~plistlib.loads`, and :func:`~plistlib.dumps` 1229 :func:`~plistlib.dump`, :func:`~plistlib.loads`, and :func:`~plistlib.dumps`
1230 functions. (The older API is now deprecated.) In addition to the already 1230 functions. (The older API is now deprecated.) In addition to the already
1231 supported XML plist format (:data:`~plistlib.FMT_XML`), it also now supports 1231 supported XML plist format (:data:`~plistlib.FMT_XML`), it also now supports
1232 the binary plist format (:data:`~plistlib.FMT_BINARY`). (Contributed by Ronald 1232 the binary plist format (:data:`~plistlib.FMT_BINARY`). (Contributed by Ronald
1233 Oussoren and others in :issue:`14455`). 1233 Oussoren and others in :issue:`14455`.)
1234 1234
1235 1235
1236 poplib 1236 poplib
1237 ------ 1237 ------
1238 1238
1239 Two new methods have been added to :mod:`poplib`: :meth:`~poplib.POP3.capa`, 1239 Two new methods have been added to :mod:`poplib`: :meth:`~poplib.POP3.capa`,
1240 which returns the list of capabilities advertised by the POP server, and 1240 which returns the list of capabilities advertised by the POP server, and
1241 :meth:`~poplib.POP3.stls`, which switches a clear-text POP3 session into an 1241 :meth:`~poplib.POP3.stls`, which switches a clear-text POP3 session into an
1242 encrypted POP3 session if the POP server supports it. (Contributed by Lorenzo 1242 encrypted POP3 session if the POP server supports it. (Contributed by Lorenzo
1243 Catucci in :issue:`4473`.) 1243 Catucci in :issue:`4473`.)
1244 1244
1245 1245
1246 pprint 1246 pprint
1247 ------ 1247 ------
1248 1248
1249 The :mod:`pprint` module's :class:`~pprint.PrettyPrinter` class and its 1249 The :mod:`pprint` module's :class:`~pprint.PrettyPrinter` class and its
1250 :func:`~pprint.pformat`, and :func:`~pprint.pprint` functions have a new 1250 :func:`~pprint.pformat`, and :func:`~pprint.pprint` functions have a new
1251 option, *compact*, that controls how the output is formatted. Currently 1251 option, *compact*, that controls how the output is formatted. Currently
1252 setting *compact* to ``True`` means that sequences will be printed with as many 1252 setting *compact* to ``True`` means that sequences will be printed with as many
1253 sequence elements as will fit within *width* on each (indented) line. 1253 sequence elements as will fit within *width* on each (indented) line.
1254 (Contributed by Serhiy Storchaka in :issue:`19132`.) 1254 (Contributed by Serhiy Storchaka in :issue:`19132`.)
1255 1255
1256 Long strings are now wrapped using Python's normal line continuation 1256 Long strings are now wrapped using Python's normal line continuation
1257 syntax. (Contributed by Antoine Pitrou in :issue:`17150`). 1257 syntax. (Contributed by Antoine Pitrou in :issue:`17150`.)
1258 1258
1259 1259
1260 pty 1260 pty
1261 --- 1261 ---
1262 1262
1263 :func:`pty.spawn` now returns the status value from :func:`os.waitpid` on 1263 :func:`pty.spawn` now returns the status value from :func:`os.waitpid` on
1264 the child process, instead of ``None``. (Contributed by Gregory P. Smith.) 1264 the child process, instead of ``None``. (Contributed by Gregory P. Smith.)
1265 1265
1266 1266
1267 pydoc 1267 pydoc
1268 ----- 1268 -----
1269 1269
1270 The :mod:`pydoc` module is now based directly on the :func:`inspect.signature` 1270 The :mod:`pydoc` module is now based directly on the :func:`inspect.signature`
1271 introspection API, allowing it to provide signature information for a wider 1271 introspection API, allowing it to provide signature information for a wider
1272 variety of callable objects. This change also means that ``__wrapped__`` 1272 variety of callable objects. This change also means that ``__wrapped__``
1273 attributes are now taken into account when displaying help information 1273 attributes are now taken into account when displaying help information.
1274 (Contributed by Larry Hastings in :issue:`19674`) 1274 (Contributed by Larry Hastings in :issue:`19674`.)
1275 1275
1276 The :mod:`pydoc` module no longer displays the ``self`` parameter for 1276 The :mod:`pydoc` module no longer displays the ``self`` parameter for
1277 already bound methods. Instead, it aims to always display the exact current 1277 already bound methods. Instead, it aims to always display the exact current
1278 signature of the supplied callable (Contributed by Larry Hastings in 1278 signature of the supplied callable. (Contributed by Larry Hastings in
1279 :issue:`20710`) 1279 :issue:`20710`.)
1280 1280
1281 In addition to the changes that have been made to :mod:`pydoc` directly, 1281 In addition to the changes that have been made to :mod:`pydoc` directly,
1282 its handling of custom ``__dir__`` methods and various descriptor 1282 its handling of custom ``__dir__`` methods and various descriptor
1283 behaviours has also been improved substantially by the underlying changes in 1283 behaviours has also been improved substantially by the underlying changes in
1284 the :mod:`inspect` module. 1284 the :mod:`inspect` module.
1285 1285
1286 As the :func:`help` builtin is based on :mod:`pydoc`, the above changes also 1286 As the :func:`help` builtin is based on :mod:`pydoc`, the above changes also
1287 affect the behaviour of :func:`help`. 1287 affect the behaviour of :func:`help`.
1288 1288
1289 1289
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 to avoid affecting the global socket map. (Contributed by Vinay Sajip in 1365 to avoid affecting the global socket map. (Contributed by Vinay Sajip in
1366 :issue:`11959`.) 1366 :issue:`11959`.)
1367 1367
1368 1368
1369 smtplib 1369 smtplib
1370 ------- 1370 -------
1371 1371
1372 :exc:`~smtplib.SMTPException` is now a subclass of :exc:`OSError`, which allows 1372 :exc:`~smtplib.SMTPException` is now a subclass of :exc:`OSError`, which allows
1373 both socket level errors and SMTP protocol level errors to be caught in one 1373 both socket level errors and SMTP protocol level errors to be caught in one
1374 try/except statement by code that only cares whether or not an error occurred. 1374 try/except statement by code that only cares whether or not an error occurred.
1375 (Contributed by Ned Jackson Lovely in :issue:`2118`). 1375 (Contributed by Ned Jackson Lovely in :issue:`2118`.)
1376 1376
1377 1377
1378 socket 1378 socket
1379 ------ 1379 ------
1380 1380
1381 The socket module now supports the :data:`~socket.CAN_BCM` protocol on 1381 The socket module now supports the :data:`~socket.CAN_BCM` protocol on
1382 platforms that support it. (Contributed by Brian Thorne in :issue:`15359`.) 1382 platforms that support it. (Contributed by Brian Thorne in :issue:`15359`.)
1383 1383
1384 Socket objects have new methods to get or set their :ref:`inheritable flag 1384 Socket objects have new methods to get or set their :ref:`inheritable flag
1385 <fd_inheritance>`, :meth:`~socket.socket.get_inheritable` and 1385 <fd_inheritance>`, :meth:`~socket.socket.get_inheritable` and
(...skipping 19 matching lines...) Expand all
1405 1405
1406 1406
1407 ssl 1407 ssl
1408 --- 1408 ---
1409 1409
1410 .. _whatsnew-tls-11-12: 1410 .. _whatsnew-tls-11-12:
1411 1411
1412 :data:`~ssl.PROTOCOL_TLSv1_1` and :data:`~ssl.PROTOCOL_TLSv1_2` (TLSv1.1 and 1412 :data:`~ssl.PROTOCOL_TLSv1_1` and :data:`~ssl.PROTOCOL_TLSv1_2` (TLSv1.1 and
1413 TLSv1.2 support) have been added; support for these protocols is only available if 1413 TLSv1.2 support) have been added; support for these protocols is only available if
1414 Python is linked with OpenSSL 1.0.1 or later. (Contributed by Michele Orrù and 1414 Python is linked with OpenSSL 1.0.1 or later. (Contributed by Michele Orrù and
1415 Antoine Pitrou in :issue:`16692`) 1415 Antoine Pitrou in :issue:`16692`.)
1416 1416
1417 .. _whatsnew34-sslcontext: 1417 .. _whatsnew34-sslcontext:
1418 1418
1419 New function :func:`~ssl.create_default_context` provides a standard way to 1419 New function :func:`~ssl.create_default_context` provides a standard way to
1420 obtain an :class:`~ssl.SSLContext` whose settings are intended to be a 1420 obtain an :class:`~ssl.SSLContext` whose settings are intended to be a
1421 reasonable balance between compatibility and security. These settings are 1421 reasonable balance between compatibility and security. These settings are
1422 more stringent than the defaults provided by the :class:`~ssl.SSLContext` 1422 more stringent than the defaults provided by the :class:`~ssl.SSLContext`
1423 constructor, and may be adjusted in the future, without prior deprecation, if 1423 constructor, and may be adjusted in the future, without prior deprecation, if
1424 best-practice security requirements change. The new recommended best 1424 best-practice security requirements change. The new recommended best
1425 practice for using stdlib libraries that support SSL is to use 1425 practice for using stdlib libraries that support SSL is to use
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1589 conditions this will be the thread from which the Python interpreter was 1589 conditions this will be the thread from which the Python interpreter was
1590 started. (Contributed by Andrew Svetlov in :issue:`18882`.) 1590 started. (Contributed by Andrew Svetlov in :issue:`18882`.)
1591 1591
1592 1592
1593 traceback 1593 traceback
1594 --------- 1594 ---------
1595 1595
1596 A new :func:`traceback.clear_frames` function takes a traceback object 1596 A new :func:`traceback.clear_frames` function takes a traceback object
1597 and clears the local variables in all of the frames it references, 1597 and clears the local variables in all of the frames it references,
1598 reducing the amount of memory consumed. (Contributed by Andrew Kuchling in 1598 reducing the amount of memory consumed. (Contributed by Andrew Kuchling in
1599 :issue:`1565525`). 1599 :issue:`1565525`.)
1600 1600
1601 1601
1602 types 1602 types
1603 ----- 1603 -----
1604 1604
1605 A new :func:`~types.DynamicClassAttribute` descriptor provides a way to define 1605 A new :func:`~types.DynamicClassAttribute` descriptor provides a way to define
1606 an attribute that acts normally when looked up through an instance object, but 1606 an attribute that acts normally when looked up through an instance object, but
1607 which is routed to the *class* ``__getattr__`` when looked up through the 1607 which is routed to the *class* ``__getattr__`` when looked up through the
1608 class. This allows one to have properties active on a class, and have virtual 1608 class. This allows one to have properties active on a class, and have virtual
1609 attributes on the class with the same name (see :mod:`Enum` for an example). 1609 attributes on the class with the same name (see :mod:`Enum` for an example).
1610 (Contributed by Ethan Furman in :issue:`19030`.) 1610 (Contributed by Ethan Furman in :issue:`19030`.)
1611 1611
1612 1612
1613 urllib 1613 urllib
1614 ------ 1614 ------
1615 1615
1616 :mod:`urllib.request` now supports ``data:`` URLs via the 1616 :mod:`urllib.request` now supports ``data:`` URLs via the
1617 :class:`~urllib.request.DataHandler` class. (Contributed by Mathias Panzenböck 1617 :class:`~urllib.request.DataHandler` class. (Contributed by Mathias Panzenböck
1618 in :issue:`16423`.) 1618 in :issue:`16423`.)
1619 1619
1620 The http method that will be used by a :class:`~urllib.request.Request` class 1620 The http method that will be used by a :class:`~urllib.request.Request` class
1621 can now be specified by setting a :class:`~urllib.request.Request.method` 1621 can now be specified by setting a :class:`~urllib.request.Request.method`
1622 class attribute on the subclass. (Contributed by Jason R Coombs in 1622 class attribute on the subclass. (Contributed by Jason R Coombs in
1623 :issue:`18978`.) 1623 :issue:`18978`.)
1624 1624
1625 :class:`~urllib.request.Request` objects are now reusable: if the 1625 :class:`~urllib.request.Request` objects are now reusable: if the
1626 :attr:`~urllib.request.Request.full_url` or :attr:`~urllib.request.Request.data` 1626 :attr:`~urllib.request.Request.full_url` or :attr:`~urllib.request.Request.data`
1627 attributes are modified, all relevant internal properties are updated. This 1627 attributes are modified, all relevant internal properties are updated. This
1628 means, for example, that it is now possible to use the same 1628 means, for example, that it is now possible to use the same
1629 :class:`~urllib.request.Request` object in more than one 1629 :class:`~urllib.request.Request` object in more than one
1630 :meth:`.OpenerDirector.open` call with different *data* arguments, or to 1630 :meth:`.OpenerDirector.open` call with different *data* arguments, or to
1631 modify a :class:`~urllib.request.Request`\ 's ``url`` rather than recomputing it 1631 modify a :class:`~urllib.request.Request`\ 's ``url`` rather than recomputing it
1632 from scratch. There is also a new 1632 from scratch. There is also a new
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1694 1694
1695 Test discovery now works with namespace packages (Contributed by Claudiu Popa 1695 Test discovery now works with namespace packages (Contributed by Claudiu Popa
1696 in :issue:`17457`.) 1696 in :issue:`17457`.)
1697 1697
1698 :mod:`unittest.mock` objects now inspect their specification signatures when 1698 :mod:`unittest.mock` objects now inspect their specification signatures when
1699 matching calls, which means an argument can now be matched by either position 1699 matching calls, which means an argument can now be matched by either position
1700 or name, instead of only by position. (Contributed by Antoine Pitrou in 1700 or name, instead of only by position. (Contributed by Antoine Pitrou in
1701 :issue:`17015`.) 1701 :issue:`17015`.)
1702 1702
1703 :func:`~mock.mock_open` objects now have ``readline`` and ``readlines`` 1703 :func:`~mock.mock_open` objects now have ``readline`` and ``readlines``
1704 methods. (Contributed by Toshio Kuratomi in :issue:`17467`.) 1704 methods. (Contributed by Toshio Kuratomi in :issue:`17467`.)
1705 1705
1706 1706
1707 venv 1707 venv
1708 ---- 1708 ----
1709 1709
1710 :mod:`venv` now includes activation scripts for the ``csh`` and ``fish`` 1710 :mod:`venv` now includes activation scripts for the ``csh`` and ``fish``
1711 shells (Contributed by Andrew Svetlov in :issue:`15417`.) 1711 shells. (Contributed by Andrew Svetlov in :issue:`15417`.)
1712 1712
1713 :class:`~venv.EnvBuilder` and the :func:`~venv.create` convenience function 1713 :class:`~venv.EnvBuilder` and the :func:`~venv.create` convenience function
1714 take a new keyword argument *with_pip*, which defaults to ``False``, that 1714 take a new keyword argument *with_pip*, which defaults to ``False``, that
1715 controls whether or not :class:`~venv.EnvBuilder` ensures that ``pip`` is 1715 controls whether or not :class:`~venv.EnvBuilder` ensures that ``pip`` is
1716 installed in the virtual environment. (Contributed by Nick Coghlan in 1716 installed in the virtual environment. (Contributed by Nick Coghlan in
1717 :issue:`19552` as part of the :pep:`453` implementation.) 1717 :issue:`19552` as part of the :pep:`453` implementation.)
1718 1718
1719 1719
1720 wave 1720 wave
1721 ---- 1721 ----
(...skipping 10 matching lines...) Expand all
1732 1732
1733 The :meth:`~wave.Wave_write.writeframesraw` and 1733 The :meth:`~wave.Wave_write.writeframesraw` and
1734 :meth:`~wave.Wave_write.writeframes` methods now accept any :term:`bytes-like 1734 :meth:`~wave.Wave_write.writeframes` methods now accept any :term:`bytes-like
1735 object`. (Contributed by Serhiy Storchaka in :issue:`8311`.) 1735 object`. (Contributed by Serhiy Storchaka in :issue:`8311`.)
1736 1736
1737 1737
1738 weakref 1738 weakref
1739 ------- 1739 -------
1740 1740
1741 New :class:`~weakref.WeakMethod` class simulates weak references to bound 1741 New :class:`~weakref.WeakMethod` class simulates weak references to bound
1742 methods. (Contributed by Antoine Pitrou in :issue:`14631`.) 1742 methods. (Contributed by Antoine Pitrou in :issue:`14631`.)
1743 1743
1744 New :class:`~weakref.finalize` class makes it possible to register a callback 1744 New :class:`~weakref.finalize` class makes it possible to register a callback
1745 to be invoked when an object is garbage collected, without needing to 1745 to be invoked when an object is garbage collected, without needing to
1746 carefully manage the lifecycle of the weak reference itself. (Contributed by 1746 carefully manage the lifecycle of the weak reference itself. (Contributed by
1747 Richard Oudkerk in :issue:`15528`) 1747 Richard Oudkerk in :issue:`15528`.)
1748 1748
1749 The callback, if any, associated with a :class:`~weakref.ref` is now 1749 The callback, if any, associated with a :class:`~weakref.ref` is now
1750 exposed via the :attr:`~weakref.ref.__callback__` attribute. (Contributed 1750 exposed via the :attr:`~weakref.ref.__callback__` attribute. (Contributed
1751 by Mark Dickinson in :issue:`17643`.) 1751 by Mark Dickinson in :issue:`17643`.)
1752 1752
1753 1753
1754 xml.etree 1754 xml.etree
1755 --------- 1755 ---------
1756 1756
1757 A new parser, :class:`~xml.etree.ElementTree.XMLPullParser`, allows a 1757 A new parser, :class:`~xml.etree.ElementTree.XMLPullParser`, allows a
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1872 1872
1873 :pep:`436` -- The Argument Clinic DSL 1873 :pep:`436` -- The Argument Clinic DSL
1874 PEP written and implemented by Larry Hastings. 1874 PEP written and implemented by Larry Hastings.
1875 1875
1876 1876
1877 Other Build and C API Changes 1877 Other Build and C API Changes
1878 ----------------------------- 1878 -----------------------------
1879 1879
1880 * The new :c:func:`PyType_GetSlot` function has been added to the stable ABI, 1880 * The new :c:func:`PyType_GetSlot` function has been added to the stable ABI,
1881 allowing retrieval of function pointers from named type slots when using 1881 allowing retrieval of function pointers from named type slots when using
1882 the limited API. (Contributed by Martin von Löwis in :issue:`17162`) 1882 the limited API. (Contributed by Martin von Löwis in :issue:`17162`.)
1883 1883
1884 * The new :c:func:`Py_SetStandardStreamEncoding` pre-initialization API 1884 * The new :c:func:`Py_SetStandardStreamEncoding` pre-initialization API
1885 allows applications embedding the CPython interpreter to reliably force 1885 allows applications embedding the CPython interpreter to reliably force
1886 a particular encoding and error handler for the standard streams 1886 a particular encoding and error handler for the standard streams.
1887 (Contributed by Bastien Montagne and Nick Coghlan in :issue:`16129`) 1887 (Contributed by Bastien Montagne and Nick Coghlan in :issue:`16129`.)
1888 1888
1889 * Most Python C APIs that don't mutate string arguments are now correctly 1889 * Most Python C APIs that don't mutate string arguments are now correctly
1890 marked as accepting ``const char *`` rather than ``char *`` (Contributed 1890 marked as accepting ``const char *`` rather than ``char *``. (Contributed
1891 by Serhiy Storchaka in :issue:`1772673`). 1891 by Serhiy Storchaka in :issue:`1772673`.)
1892 1892
1893 * A new shell version of ``python-config`` can be used even when a python 1893 * A new shell version of ``python-config`` can be used even when a python
1894 interpreter is not available (for example, in cross compilation scenarios). 1894 interpreter is not available (for example, in cross compilation scenarios).
1895 1895
1896 * :c:func:`PyUnicode_FromFormat` now supports width and precision 1896 * :c:func:`PyUnicode_FromFormat` now supports width and precision
1897 specifications for ``%s``, ``%A``, ``%U``, ``%V``, ``%S``, and ``%R``. 1897 specifications for ``%s``, ``%A``, ``%U``, ``%V``, ``%S``, and ``%R``.
1898 (Contributed by Ysj Ray and Victor Stinner in :issue:`7330`.) 1898 (Contributed by Ysj Ray and Victor Stinner in :issue:`7330`.)
1899 1899
1900 * New function :c:func:`PyStructSequence_InitType2` supplements the 1900 * New function :c:func:`PyStructSequence_InitType2` supplements the
1901 existing :c:func:`PyStructSequence_InitType` function. The difference 1901 existing :c:func:`PyStructSequence_InitType` function. The difference
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1951 1951
1952 * A new ``make`` target `coverage-report 1952 * A new ``make`` target `coverage-report
1953 <https://docs.python.org/devguide/coverage.html#measuring-coverage-of-c-code-w ith-gcov-and-lcov>`_ 1953 <https://docs.python.org/devguide/coverage.html#measuring-coverage-of-c-code-w ith-gcov-and-lcov>`_
1954 will build python, run the test suite, and generate an HTML coverage report 1954 will build python, run the test suite, and generate an HTML coverage report
1955 for the C codebase using ``gcov`` and `lcov 1955 for the C codebase using ``gcov`` and `lcov
1956 <http://ltp.sourceforge.net/coverage/lcov.php>`_. 1956 <http://ltp.sourceforge.net/coverage/lcov.php>`_.
1957 1957
1958 * The ``-R`` option to the :ref:`python regression test suite <regrtest>` now 1958 * The ``-R`` option to the :ref:`python regression test suite <regrtest>` now
1959 also checks for memory allocation leaks, using 1959 also checks for memory allocation leaks, using
1960 :func:`sys.getallocatedblocks()`. (Contributed by Antoine Pitrou in 1960 :func:`sys.getallocatedblocks()`. (Contributed by Antoine Pitrou in
1961 :issue:`13390`). 1961 :issue:`13390`.)
1962 1962
1963 * ``python -m`` now works with namespace packages. 1963 * ``python -m`` now works with namespace packages.
1964 1964
1965 * The :mod:`stat` module is now implemented in C, which means it gets the 1965 * The :mod:`stat` module is now implemented in C, which means it gets the
1966 values for its constants from the C header files, instead of having the 1966 values for its constants from the C header files, instead of having the
1967 values hard-coded in the python module as was previously the case. 1967 values hard-coded in the python module as was previously the case.
1968 1968
1969 * Loading multiple python modules from a single OS module (``.so``, ``.dll``) 1969 * Loading multiple python modules from a single OS module (``.so``, ``.dll``)
1970 now works correctly (previously it silently returned the first python 1970 now works correctly (previously it silently returned the first python
1971 module in the file). (Contributed by Václav Šmilauer in :issue:`16421`.) 1971 module in the file). (Contributed by Václav Šmilauer in :issue:`16421`.)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2014 LINEAR_PROBES to be any value. Set LINEAR_PROBES=0 to turn-off 2014 LINEAR_PROBES to be any value. Set LINEAR_PROBES=0 to turn-off
2015 linear probing entirely. (Contributed by Raymond Hettinger in 2015 linear probing entirely. (Contributed by Raymond Hettinger in
2016 :issue:`18771`.) 2016 :issue:`18771`.)
2017 2017
2018 * The interpreter starts about 30% faster. A couple of measures lead to the 2018 * The interpreter starts about 30% faster. A couple of measures lead to the
2019 speedup. The interpreter loads fewer modules on startup, e.g. the :mod:`re`, 2019 speedup. The interpreter loads fewer modules on startup, e.g. the :mod:`re`,
2020 :mod:`collections` and :mod:`locale` modules and their dependencies are no 2020 :mod:`collections` and :mod:`locale` modules and their dependencies are no
2021 longer imported by default. The marshal module has been improved to load 2021 longer imported by default. The marshal module has been improved to load
2022 compiled Python code faster. (Contributed by Antoine Pitrou, Christian 2022 compiled Python code faster. (Contributed by Antoine Pitrou, Christian
2023 Heimes and Victor Stinner in :issue:`19219`, :issue:`19218`, :issue:`19209`, 2023 Heimes and Victor Stinner in :issue:`19219`, :issue:`19218`, :issue:`19209`,
2024 :issue:`19205` and :issue:`9548`) 2024 :issue:`19205` and :issue:`9548`.)
2025 2025
2026 * :class:`bz2.BZ2File` is now as fast or faster than the Python2 version for 2026 * :class:`bz2.BZ2File` is now as fast or faster than the Python2 version for
2027 most cases. :class:`lzma.LZMAFile` has also been optimized. (Contributed by 2027 most cases. :class:`lzma.LZMAFile` has also been optimized. (Contributed by
2028 Serhiy Storchaka and Nadeem Vawda in :issue:`16034`.) 2028 Serhiy Storchaka and Nadeem Vawda in :issue:`16034`.)
2029 2029
2030 * :func:`random.getrandbits` is 20%-40% faster for small integers (the most 2030 * :func:`random.getrandbits` is 20%-40% faster for small integers (the most
2031 common use case). (Contributed by Serhiy Storchaka in :issue:`16674`). 2031 common use case). (Contributed by Serhiy Storchaka in :issue:`16674`.)
2032 2032
2033 * By taking advantage of the new storage format for strings, pickling of 2033 * By taking advantage of the new storage format for strings, pickling of
2034 strings is now significantly faster. (Contributed by Victor Stinner and 2034 strings is now significantly faster. (Contributed by Victor Stinner and
2035 Antoine Pitrou in :issue:`15596`.) 2035 Antoine Pitrou in :issue:`15596`.)
2036 2036
2037 * A performance issue in :meth:`io.FileIO.readall` has been solved. This 2037 * A performance issue in :meth:`io.FileIO.readall` has been solved. This
2038 particularly affects Windows, and significantly speeds up the case of piping 2038 particularly affects Windows, and significantly speeds up the case of piping
2039 significant amounts of data through :mod:`subprocess`. (Contributed 2039 significant amounts of data through :mod:`subprocess`. (Contributed
2040 by Richard Oudkerk in :issue:`15758`.) 2040 by Richard Oudkerk in :issue:`15758`.)
2041 2041
2042 * :func:`html.escape` is now 10x faster. (Contributed by Matt Bryant in 2042 * :func:`html.escape` is now 10x faster. (Contributed by Matt Bryant in
2043 :issue:`18020`.) 2043 :issue:`18020`.)
2044 2044
2045 * On Windows, the native ``VirtualAlloc`` is now used instead of the CRT 2045 * On Windows, the native ``VirtualAlloc`` is now used instead of the CRT
2046 ``malloc`` in ``obmalloc``. Artificial benchmarks show about a 3% memory 2046 ``malloc`` in ``obmalloc``. Artificial benchmarks show about a 3% memory
2047 savings. 2047 savings.
2048 2048
2049 * :func:`os.urandom` now uses a lazily-opened persistent file descriptor 2049 * :func:`os.urandom` now uses a lazily-opened persistent file descriptor
2050 so as to avoid using many file descriptors when run in parallel from 2050 so as to avoid using many file descriptors when run in parallel from
2051 multiple threads. (Contributed by Antoine Pitrou in :issue:`18756`.) 2051 multiple threads. (Contributed by Antoine Pitrou in :issue:`18756`.)
2052 2052
2053 2053
2054 .. _deprecated-3.4: 2054 .. _deprecated-3.4:
2055 2055
2056 Deprecated 2056 Deprecated
2057 ========== 2057 ==========
2058 2058
2059 This section covers various APIs and other features that have been deprecated 2059 This section covers various APIs and other features that have been deprecated
2060 in Python 3.4, and will be removed in Python 3.5 or later. In most (but not 2060 in Python 3.4, and will be removed in Python 3.5 or later. In most (but not
2061 all) cases, using the deprecated APIs will produce a :exc:`DeprecationWarning` 2061 all) cases, using the deprecated APIs will produce a :exc:`DeprecationWarning`
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
2239 * In a posix shell, setting the :envvar:`PATH` environment variable to 2239 * In a posix shell, setting the :envvar:`PATH` environment variable to
2240 an empty value is equivalent to not setting it at all. However, setting 2240 an empty value is equivalent to not setting it at all. However, setting
2241 :envvar:`PYTHONPATH` to an empty value was *not* equivalent to not setting it 2241 :envvar:`PYTHONPATH` to an empty value was *not* equivalent to not setting it
2242 at all: setting :envvar:`PYTHONPATH` to an empty value was equivalent to 2242 at all: setting :envvar:`PYTHONPATH` to an empty value was equivalent to
2243 setting it to ``.``, which leads to confusion when reasoning by analogy to 2243 setting it to ``.``, which leads to confusion when reasoning by analogy to
2244 how :envvar:`PATH` works. The behavior now conforms to the posix convention 2244 how :envvar:`PATH` works. The behavior now conforms to the posix convention
2245 for :envvar:`PATH`. 2245 for :envvar:`PATH`.
2246 2246
2247 * The [X refs, Y blocks] output of a debug (``--with-pydebug``) build of the 2247 * The [X refs, Y blocks] output of a debug (``--with-pydebug``) build of the
2248 CPython interpreter is now off by default. It can be re-enabled using the 2248 CPython interpreter is now off by default. It can be re-enabled using the
2249 ``-X showrefcount`` option. (Contributed by Ezio Melotti in :issue:`17323`.) 2249 ``-X showrefcount`` option. (Contributed by Ezio Melotti in :issue:`17323`.)
2250 2250
2251 * The python command and most stdlib scripts (as well as :mod:`argparse`) now 2251 * The python command and most stdlib scripts (as well as :mod:`argparse`) now
2252 output ``--version`` information to ``stdout`` instead of ``stderr`` (for 2252 output ``--version`` information to ``stdout`` instead of ``stderr`` (for
2253 issue list see :ref:`other-improvements-3.4` above). 2253 issue list see :ref:`other-improvements-3.4` above).
2254 2254
2255 2255
2256 Changes in the Python API 2256 Changes in the Python API
2257 ------------------------- 2257 -------------------------
2258 2258
2259 * The ABCs defined in :mod:`importlib.abc` now either raise the appropriate 2259 * The ABCs defined in :mod:`importlib.abc` now either raise the appropriate
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
2388 * Defaults for keyword-only arguments are now evaluated *after* defaults for 2388 * Defaults for keyword-only arguments are now evaluated *after* defaults for
2389 regular keyword arguments, instead of before. Hopefully no one wrote any 2389 regular keyword arguments, instead of before. Hopefully no one wrote any
2390 code that depends on the previous buggy behavior (:issue:`16967`). 2390 code that depends on the previous buggy behavior (:issue:`16967`).
2391 2391
2392 * Stale thread states are now cleared after :func:`~os.fork`. This may cause 2392 * Stale thread states are now cleared after :func:`~os.fork`. This may cause
2393 some system resources to be released that previously were incorrectly kept 2393 some system resources to be released that previously were incorrectly kept
2394 perpetually alive (for example, database connections kept in thread-local 2394 perpetually alive (for example, database connections kept in thread-local
2395 storage). (:issue:`17094`.) 2395 storage). (:issue:`17094`.)
2396 2396
2397 * Parameter names in ``__annotations__`` dicts are now mangled properly, 2397 * Parameter names in ``__annotations__`` dicts are now mangled properly,
2398 similarly to ``__kwdefaults__``. (Contributed by Yury Selivanov in 2398 similarly to ``__kwdefaults__``. (Contributed by Yury Selivanov in
2399 :issue:`20625`). 2399 :issue:`20625`.)
2400 2400
2401 * :attr:`hashlib.hash.name` now always returns the identifier in lower case. 2401 * :attr:`hashlib.hash.name` now always returns the identifier in lower case.
2402 Previously some builtin hashes had uppercase names, but now that it is a 2402 Previously some builtin hashes had uppercase names, but now that it is a
2403 formal public interface the naming has been made consistent (:issue:`18532`). 2403 formal public interface the naming has been made consistent (:issue:`18532`).
2404 2404
2405 * Because :mod:`unittest.TestSuite` now drops references to tests after they 2405 * Because :mod:`unittest.TestSuite` now drops references to tests after they
2406 are run, test harnesses that re-use a :class:`~unittest.TestSuite` to re-run 2406 are run, test harnesses that re-use a :class:`~unittest.TestSuite` to re-run
2407 a set of tests may fail. Test suites should not be re-used in this fashion 2407 a set of tests may fail. Test suites should not be re-used in this fashion
2408 since it means state is retained between test runs, breaking the test 2408 since it means state is retained between test runs, breaking the test
2409 isolation that :mod:`unittest` is designed to provide. However, if the lack 2409 isolation that :mod:`unittest` is designed to provide. However, if the lack
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
2526 import ssl 2526 import ssl
2527 2527
2528 # This disables all verification 2528 # This disables all verification
2529 context = ssl._create_unverified_context() 2529 context = ssl._create_unverified_context()
2530 2530
2531 # This allows using a specific certificate for the host, which doesn't need 2531 # This allows using a specific certificate for the host, which doesn't need
2532 # to be in the trust store 2532 # to be in the trust store
2533 context = ssl.create_default_context(cafile="/path/to/file.crt") 2533 context = ssl.create_default_context(cafile="/path/to/file.crt")
2534 2534
2535 urllib.request.urlopen("https://invalid-cert", context=context) 2535 urllib.request.urlopen("https://invalid-cert", context=context)
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+