~ubuntu-branches/ubuntu/raring/python2.7/raring-proposed

« back to all changes in this revision

Viewing changes to debian/patches/hg-updates.diff

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2012-12-10 19:10:32 UTC
  • mfrom: (27.2.9 experimental)
  • Revision ID: package-import@ubuntu.com-20121210191032-ub006z2f0loze834
Tags: 2.7.3-11ubuntu1
* Merge with Debian; remaining changes:
  - Regenerate the control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# DP: hg updates of the 2.7 release branch (until 2012-11-28).
 
1
# DP: hg updates of the 2.7 release branch (until 2012-12-10).
2
2
 
3
3
# hg diff -r v2.7.3 | filterdiff --exclude=.*ignore --exclude=.hg* --remove-timestamps
4
4
 
445
445
    Return the list of files that were copied or might have been copied, using their
446
446
    output name. The return value is unaffected by *update* or *dry_run*: it is
447
447
    simply the list of all files under *src*, with the names changed to be under
448
 
@@ -988,6 +987,10 @@
 
448
@@ -988,6 +987,13 @@
449
449
    destination of the symlink will be copied.  *update* and *verbose* are the same
450
450
    as for :func:`copy_file`.
451
451
 
453
453
+   these files is available in answer D2 of the `NFS FAQ page
454
454
+   <http://nfs.sourceforge.net/#section_d>`_.
455
455
+
 
456
+   .. versionchanged:: 2.7.4
 
457
+      NFS files are ignored.
 
458
+
456
459
 
457
460
 .. function:: remove_tree(directory[, verbose=0, dry_run=0])
458
461
 
459
 
@@ -995,8 +998,6 @@
 
462
@@ -995,8 +1001,6 @@
460
463
    errors are ignored (apart from being reported to ``sys.stdout`` if *verbose* is
461
464
    true).
462
465
 
465
468
 
466
469
 :mod:`distutils.file_util` --- Single file operations
467
470
 =====================================================
468
 
@@ -1110,8 +1111,6 @@
 
471
@@ -1110,8 +1114,6 @@
469
472
 
470
473
    * ``macosx-10.6-intel``
471
474
 
474
477
 
475
478
 .. function:: convert_path(pathname)
476
479
 
477
 
@@ -1311,8 +1310,6 @@
 
480
@@ -1311,8 +1313,6 @@
478
481
   the "negative alias" of :option:`--verbose`, then :option:`--quiet` on the
479
482
   command line sets *verbose* to false.
480
483
 
483
486
 
484
487
 .. function:: fancy_getopt(options, negative_opt, object, args)
485
488
 
486
 
@@ -1329,8 +1326,6 @@
 
489
@@ -1329,8 +1329,6 @@
487
490
 
488
491
    Wraps *text* to less than *width* wide.
489
492
 
492
495
 
493
496
 
494
497
 .. class:: FancyGetopt([option_table=None])
495
 
@@ -1394,10 +1389,6 @@
 
498
@@ -1394,10 +1392,6 @@
496
499
    :synopsis: A simple logging mechanism, 282-style
497
500
 
498
501
 
503
506
 :mod:`distutils.spawn` --- Spawn a sub-process
504
507
 ==============================================
505
508
 
506
 
@@ -1894,9 +1885,6 @@
 
509
@@ -1894,9 +1888,6 @@
507
510
    :synopsis: Build the .py/.pyc files of a package
508
511
 
509
512
 
978
981
 
979
982
     largeString = 'z' * (100 * 1024)
980
983
     myPickle = cPickle.dumps(largeString, protocol=1)
 
984
diff -r 70274d53c1dd Doc/faq/programming.rst
 
985
--- a/Doc/faq/programming.rst
 
986
+++ b/Doc/faq/programming.rst
 
987
@@ -469,6 +469,27 @@
 
988
        apply(g, (x,)+args, kwargs)
 
989
 
 
990
 
 
991
+.. _faq-argument-vs-parameter:
 
992
+
 
993
+What is the difference between arguments and parameters?
 
994
+--------------------------------------------------------
 
995
+
 
996
+:term:`Parameters <parameter>` are defined by the names that appear in a
 
997
+function definition, whereas :term:`arguments <argument>` are the values
 
998
+actually passed to a function when calling it.  Parameters define what types of
 
999
+arguments a function can accept.  For example, given the function definition::
 
1000
+
 
1001
+   def func(foo, bar=None, **kwargs):
 
1002
+       pass
 
1003
+
 
1004
+*foo*, *bar* and *kwargs* are parameters of ``func``.  However, when calling
 
1005
+``func``, for example::
 
1006
+
 
1007
+   func(42, bar=314, extra=somevar)
 
1008
+
 
1009
+the values ``42``, ``314``, and ``somevar`` are arguments.
 
1010
+
 
1011
+
 
1012
 How do I write a function with output parameters (call by reference)?
 
1013
 ---------------------------------------------------------------------
 
1014
 
981
1015
diff -r 70274d53c1dd Doc/faq/windows.rst
982
1016
--- a/Doc/faq/windows.rst
983
1017
+++ b/Doc/faq/windows.rst
1011
1045
diff -r 70274d53c1dd Doc/glossary.rst
1012
1046
--- a/Doc/glossary.rst
1013
1047
+++ b/Doc/glossary.rst
1014
 
@@ -80,7 +80,7 @@
 
1048
@@ -39,16 +39,34 @@
 
1049
       create your own ABCs with the :mod:`abc` module.
 
1050
 
 
1051
    argument
 
1052
-      A value passed to a function or method, assigned to a named local
 
1053
-      variable in the function body.  A function or method may have both
 
1054
-      positional arguments and keyword arguments in its definition.
 
1055
-      Positional and keyword arguments may be variable-length: ``*`` accepts
 
1056
-      or passes (if in the function definition or call) several positional
 
1057
-      arguments in a list, while ``**`` does the same for keyword arguments
 
1058
-      in a dictionary.
 
1059
+      A value passed to a :term:`function` (or :term:`method`) when calling the
 
1060
+      function.  There are two types of arguments:
 
1061
 
 
1062
-      Any expression may be used within the argument list, and the evaluated
 
1063
-      value is passed to the local variable.
 
1064
+      * :dfn:`keyword argument`: an argument preceded by an identifier (e.g.
 
1065
+        ``name=``) in a function call or passed as a value in a dictionary
 
1066
+        preceded by ``**``.  For example, ``3`` and ``5`` are both keyword
 
1067
+        arguments in the following calls to :func:`complex`::
 
1068
+
 
1069
+           complex(real=3, imag=5)
 
1070
+           complex(**{'real': 3, 'imag': 5})
 
1071
+
 
1072
+      * :dfn:`positional argument`: an argument that is not a keyword argument.
 
1073
+        Positional arguments can appear at the beginning of an argument list
 
1074
+        and/or be passed as elements of an :term:`iterable` preceded by ``*``.
 
1075
+        For example, ``3`` and ``5`` are both positional arguments in the
 
1076
+        following calls::
 
1077
+
 
1078
+           complex(3, 5)
 
1079
+           complex(*(3, 5))
 
1080
+
 
1081
+      Arguments are assigned to the named local variables in a function body.
 
1082
+      See the :ref:`calls` section for the rules governing this assignment.
 
1083
+      Syntactically, any expression can be used to represent an argument; the
 
1084
+      evaluated value is assigned to the local variable.
 
1085
+
 
1086
+      See also the :term:`parameter` glossary entry and the FAQ question on
 
1087
+      :ref:`the difference between arguments and parameters
 
1088
+      <faq-argument-vs-parameter>`.
 
1089
 
 
1090
    attribute
 
1091
       A value associated with an object which is referenced by name using
 
1092
@@ -80,7 +98,7 @@
1015
1093
 
1016
1094
    classic class
1017
1095
       Any class which does not inherit from :class:`object`.  See
1020
1098
 
1021
1099
    coercion
1022
1100
       The implicit conversion of an instance of one type to another during an
1023
 
@@ -152,9 +152,9 @@
 
1101
@@ -152,9 +170,9 @@
1024
1102
       For more information about descriptors' methods, see :ref:`descriptors`.
1025
1103
 
1026
1104
    dictionary
1033
1111
 
1034
1112
    docstring
1035
1113
       A string literal which appears as the first expression in a class,
1036
 
@@ -200,7 +200,7 @@
 
1114
@@ -200,7 +218,7 @@
1037
1115
       An object exposing a file-oriented API (with methods such as
1038
1116
       :meth:`read()` or :meth:`write()`) to an underlying resource.  Depending
1039
1117
       on the way it was created, a file object can mediate access to a real
1042
1120
       (for example standard input/output, in-memory buffers, sockets, pipes,
1043
1121
       etc.).  File objects are also called :dfn:`file-like objects` or
1044
1122
       :dfn:`streams`.
1045
 
@@ -406,7 +406,7 @@
 
1123
@@ -406,16 +424,13 @@
1046
1124
       :meth:`str.lower` method can serve as a key function for case insensitive
1047
1125
       sorts.  Alternatively, an ad-hoc key function can be built from a
1048
1126
       :keyword:`lambda` expression such as ``lambda r: (r[0], r[2])``.  Also,
1051
1129
       :func:`~operator.attrgetter`, :func:`~operator.itemgetter`, and
1052
1130
       :func:`~operator.methodcaller`.  See the :ref:`Sorting HOW TO
1053
1131
       <sortinghowto>` for examples of how to create and use key functions.
1054
 
@@ -630,6 +630,13 @@
 
1132
 
 
1133
    keyword argument
 
1134
-      Arguments which are preceded with a ``variable_name=`` in the call.
 
1135
-      The variable name designates the local name in the function to which the
 
1136
-      value is assigned.  ``**`` is used to accept or pass a dictionary of
 
1137
-      keyword arguments.  See :term:`argument`.
 
1138
+      See :term:`argument`.
 
1139
 
 
1140
    lambda
 
1141
       An anonymous inline function consisting of a single :term:`expression`
 
1142
@@ -537,12 +552,46 @@
 
1143
       (methods).  Also the ultimate base class of any :term:`new-style
 
1144
       class`.
 
1145
 
 
1146
+   parameter
 
1147
+      A named entity in a :term:`function` (or method) definition that
 
1148
+      specifies an :term:`argument` (or in some cases, arguments) that the
 
1149
+      function can accept.  There are four types of parameters:
 
1150
+
 
1151
+      * :dfn:`positional-or-keyword`: specifies an argument that can be passed
 
1152
+        either :term:`positionally <argument>` or as a :term:`keyword argument
 
1153
+        <argument>`.  This is the default kind of parameter, for example *foo*
 
1154
+        and *bar* in the following::
 
1155
+
 
1156
+           def func(foo, bar=None): ...
 
1157
+
 
1158
+      * :dfn:`positional-only`: specifies an argument that can be supplied only
 
1159
+        by position.  Python has no syntax for defining positional-only
 
1160
+        parameters.  However, some built-in functions have positional-only
 
1161
+        parameters (e.g. :func:`abs`).
 
1162
+
 
1163
+      * :dfn:`var-positional`: specifies that an arbitrary sequence of
 
1164
+        positional arguments can be provided (in addition to any positional
 
1165
+        arguments already accepted by other parameters).  Such a parameter can
 
1166
+        be defined by prepending the parameter name with ``*``, for example
 
1167
+        *args* in the following::
 
1168
+
 
1169
+           def func(*args, **kwargs): ...
 
1170
+
 
1171
+      * :dfn:`var-keyword`: specifies that arbitrarily many keyword arguments
 
1172
+        can be provided (in addition to any keyword arguments already accepted
 
1173
+        by other parameters).  Such a parameter can be defined by prepending
 
1174
+        the parameter name with ``**``, for example *kwargs* in the example
 
1175
+        above.
 
1176
+
 
1177
+      Parameters can specify both optional and required arguments, as well as
 
1178
+      default values for some optional arguments.
 
1179
+
 
1180
+      See also the :term:`argument` glossary entry, the FAQ question on
 
1181
+      :ref:`the difference between arguments and parameters
 
1182
+      <faq-argument-vs-parameter>`, and the :ref:`function` section.
 
1183
+
 
1184
    positional argument
 
1185
-      The arguments assigned to local names inside a function or method,
 
1186
-      determined by the order in which they were given in the call.  ``*`` is
 
1187
-      used to either accept multiple positional arguments (when in the
 
1188
-      definition), or pass several arguments as a list to a function.  See
 
1189
-      :term:`argument`.
 
1190
+      See :term:`argument`.
 
1191
 
 
1192
    Python 3000
 
1193
       Nickname for the Python 3.x release line (coined long ago when the release
 
1194
@@ -630,6 +679,13 @@
1055
1195
       object has a type.  An object's type is accessible as its
1056
1196
       :attr:`__class__` attribute or can be retrieved with ``type(obj)``.
1057
1197
 
3790
3930
     ...         else:
3791
3931
     ...             return timedelta(0)
3792
3932
     ...     def tzname(self,dt):
 
3933
@@ -1145,7 +1154,7 @@
 
3934
 A time object represents a (local) time of day, independent of any particular
 
3935
 day, and subject to adjustment via a :class:`tzinfo` object.
 
3936
 
 
3937
-.. class:: time(hour[, minute[, second[, microsecond[, tzinfo]]]])
 
3938
+.. class:: time([hour[, minute[, second[, microsecond[, tzinfo]]]]])
 
3939
 
 
3940
    All arguments are optional.  *tzinfo* may be ``None``, or an instance of a
 
3941
    :class:`tzinfo` subclass.  The remaining arguments may be ints or longs, in the
3793
3942
@@ -1521,6 +1530,21 @@
3794
3943
 other fixed-offset :class:`tzinfo` subclass (such as a class representing only
3795
3944
 EST (fixed offset -5 hours), or only EDT (fixed offset -4 hours)).
4360
4509
 
4361
4510
 .. module:: email.utils
4362
4511
    :synopsis: Miscellaneous email package utilities.
 
4512
diff -r 70274d53c1dd Doc/library/exceptions.rst
 
4513
--- a/Doc/library/exceptions.rst
 
4514
+++ b/Doc/library/exceptions.rst
 
4515
@@ -387,6 +387,30 @@
 
4516
    Raised when a Unicode-related encoding or decoding error occurs.  It is a
 
4517
    subclass of :exc:`ValueError`.
 
4518
 
 
4519
+   :exc:`UnicodeError` has attributes that describe the encoding or decoding
 
4520
+   error.  For example, ``err.object[err.start:err.end]`` gives the particular
 
4521
+   invalid input that the codec failed on.
 
4522
+
 
4523
+   .. attribute:: encoding
 
4524
+
 
4525
+       The name of the encoding that raised the error.
 
4526
+
 
4527
+   .. attribute:: reason
 
4528
+
 
4529
+       A string describing the specific codec error.
 
4530
+
 
4531
+   .. attribute:: object
 
4532
+
 
4533
+       The object the codec was attempting to encode or decode.
 
4534
+
 
4535
+   .. attribute:: start
 
4536
+
 
4537
+       The first index of invalid data in :attr:`object`.
 
4538
+
 
4539
+   .. attribute:: end
 
4540
+
 
4541
+       The index after the last invalid data in :attr:`object`.
 
4542
+
 
4543
    .. versionadded:: 2.0
 
4544
 
 
4545
 
4363
4546
diff -r 70274d53c1dd Doc/library/filecmp.rst
4364
4547
--- a/Doc/library/filecmp.rst
4365
4548
+++ b/Doc/library/filecmp.rst
4542
4725
 
4543
4726
 .. sectionauthor:: Moshe Zadka <moshez@zadka.site.co.il>
4544
4727
 
 
4728
diff -r 70274d53c1dd Doc/library/fractions.rst
 
4729
--- a/Doc/library/fractions.rst
 
4730
+++ b/Doc/library/fractions.rst
 
4731
@@ -57,7 +57,6 @@
 
4732
       Fraction(0, 1)
 
4733
       >>> Fraction('3/7')
 
4734
       Fraction(3, 7)
 
4735
-      [40794 refs]
 
4736
       >>> Fraction(' -3/7 ')
 
4737
       Fraction(-3, 7)
 
4738
       >>> Fraction('1.414213 \t\n')
4545
4739
diff -r 70274d53c1dd Doc/library/functions.rst
4546
4740
--- a/Doc/library/functions.rst
4547
4741
+++ b/Doc/library/functions.rst
5276
5470
    :func:`find_module` and :func:`load_module` to find and load package *P*, and
5277
5471
    then use :func:`find_module` with the *path* argument set to ``P.__path__``.
5278
5472
    When *P* itself has a dotted name, apply this recipe recursively.
 
5473
@@ -237,6 +237,17 @@
 
5474
    using shared libraries is highly system dependent, and not all systems support
 
5475
    it.)
 
5476
 
 
5477
+   .. impl-detail::
 
5478
+
 
5479
+    The import internals identify extension modules by filename, so doing
 
5480
+    ``foo = load_dynamic("foo", "mod.so")`` and
 
5481
+    ``bar = load_dynamic("bar", "mod.so")`` will result in both foo and bar
 
5482
+    referring to the same module, regardless of whether or not
 
5483
+    ``mod.so`` exports an ``initbar`` function. On systems which
 
5484
+    support them, symlinks can be used to import multiple modules from
 
5485
+    the same shared library, as each reference to the module will use
 
5486
+    a different file name.
 
5487
+
 
5488
 
 
5489
 .. function:: load_source(name, pathname[, file])
 
5490
 
5279
5491
diff -r 70274d53c1dd Doc/library/imputil.rst
5280
5492
--- a/Doc/library/imputil.rst
5281
5493
+++ b/Doc/library/imputil.rst
5451
5663
 
5452
5664
 :mod:`json` exposes an API familiar to users of the standard library
5453
5665
 :mod:`marshal` and :mod:`pickle` modules.
5454
 
@@ -99,35 +101,43 @@
 
5666
@@ -41,7 +43,8 @@
 
5667
 Pretty printing::
 
5668
 
 
5669
     >>> import json
 
5670
-    >>> print json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4)
 
5671
+    >>> print json.dumps({'4': 5, '6': 7}, sort_keys=True,
 
5672
+    ...                  indent=4, separators=(',', ': '))
 
5673
     {
 
5674
         "4": 5,
 
5675
         "6": 7
 
5676
@@ -99,35 +102,43 @@
5455
5677
     {
5456
5678
         "json": "obj"
5457
5679
     }
5506
5728
 
5507
5729
    If *check_circular* is ``False`` (default: ``True``), then the circular
5508
5730
    reference check for container types will be skipped and a circular reference
5509
 
@@ -152,6 +162,9 @@
 
5731
@@ -143,6 +154,12 @@
 
5732
    or negative, will only insert newlines.  ``None`` (the default) selects the
 
5733
    most compact representation.
 
5734
 
 
5735
+   .. note::
 
5736
+
 
5737
+      Since the default item separator is ``', '``,  the output might include
 
5738
+      trailing whitespace when *indent* is specified.  You can use
 
5739
+      ``separators=(',', ': ')`` to avoid this.
 
5740
+
 
5741
    If *separators* is an ``(item_separator, dict_separator)`` tuple, then it
 
5742
    will be used instead of the default ``(', ', ': ')`` separators.  ``(',',
 
5743
    ':')`` is the most compact JSON representation.
 
5744
@@ -152,6 +169,9 @@
5510
5745
    *default(obj)* is a function that should return a serializable version of
5511
5746
    *obj* or raise :exc:`TypeError`.  The default simply raises :exc:`TypeError`.
5512
5747
 
5516
5751
    To use a custom :class:`JSONEncoder` subclass (e.g. one that overrides the
5517
5752
    :meth:`default` method to serialize additional types), specify it with the
5518
5753
    *cls* kwarg; otherwise :class:`JSONEncoder` is used.
5519
 
@@ -162,19 +175,30 @@
 
5754
@@ -162,19 +182,30 @@
5520
5755
       trying to serialize more objects with repeated calls to :func:`dump` and
5521
5756
       the same *fp* will result in an invalid JSON file.
5522
5757
 
5554
5789
 
5555
5790
    If the contents of *fp* are encoded with an ASCII based encoding other than
5556
5791
    UTF-8 (e.g. latin-1), then an appropriate *encoding* name must be specified.
5557
 
@@ -185,7 +209,8 @@
 
5792
@@ -185,7 +216,8 @@
5558
5793
    *object_hook* is an optional function that will be called with the result of
5559
5794
    any object literal decoded (a :class:`dict`).  The return value of
5560
5795
    *object_hook* will be used instead of the :class:`dict`.  This feature can be used
5564
5799
 
5565
5800
    *object_pairs_hook* is an optional function that will be called with the
5566
5801
    result of any object literal decoded with an ordered list of pairs.  The
5567
 
@@ -209,10 +234,13 @@
 
5802
@@ -209,10 +241,13 @@
5568
5803
    (e.g. :class:`float`).
5569
5804
 
5570
5805
    *parse_constant*, if specified, will be called with one of the following
5580
5815
    To use a custom :class:`JSONDecoder` subclass, specify it with the ``cls``
5581
5816
    kwarg; otherwise :class:`JSONDecoder` is used.  Additional keyword arguments
5582
5817
    will be passed to the constructor of the class.
5583
 
@@ -231,7 +259,7 @@
 
5818
@@ -231,7 +266,7 @@
5584
5819
    The other arguments have the same meaning as in :func:`load`.
5585
5820
 
5586
5821
 
5589
5824
 ---------------------
5590
5825
 
5591
5826
 .. class:: JSONDecoder([encoding[, object_hook[, parse_float[, parse_int[, parse_constant[, strict[, object_pairs_hook]]]]]]])
5592
 
@@ -355,9 +383,12 @@
 
5827
@@ -355,9 +390,12 @@
5593
5828
    attempt encoding of keys that are not str, int, long, float or None.  If
5594
5829
    *skipkeys* is ``True``, such items are simply skipped.
5595
5830
 
5605
5840
 
5606
5841
    If *check_circular* is ``True`` (the default), then lists, dicts, and custom
5607
5842
    encoded objects will be checked for circular references during encoding to
5608
 
@@ -427,3 +458,108 @@
 
5843
@@ -379,6 +417,12 @@
 
5844
    level.  An indent level of 0 will only insert newlines.  ``None`` is the most
 
5845
    compact representation.
 
5846
 
 
5847
+   .. note::
 
5848
+
 
5849
+      Since the default item separator is ``', '``,  the output might include
 
5850
+      trailing whitespace when *indent* is specified.  You can use
 
5851
+      ``separators=(',', ': ')`` to avoid this.
 
5852
+
 
5853
    If specified, *separators* should be an ``(item_separator, key_separator)``
 
5854
    tuple.  The default is ``(', ', ': ')``.  To get the most compact JSON
 
5855
    representation, you should specify ``(',', ':')`` to eliminate whitespace.
 
5856
@@ -427,3 +471,108 @@
5609
5857
 
5610
5858
             for chunk in JSONEncoder().iterencode(bigobject):
5611
5859
                 mysocket.write(chunk)
6537
6785
 
6538
6786
 
6539
6787
 .. class:: POP3(host[, port[, timeout]])
 
6788
diff -r 70274d53c1dd Doc/library/pprint.rst
 
6789
--- a/Doc/library/pprint.rst
 
6790
+++ b/Doc/library/pprint.rst
 
6791
@@ -36,7 +36,7 @@
 
6792
 .. First the implementation class:
 
6793
 
 
6794
 
 
6795
-.. class:: PrettyPrinter(...)
 
6796
+.. class:: PrettyPrinter(indent=1, width=80, depth=None, stream=None)
 
6797
 
 
6798
    Construct a :class:`PrettyPrinter` instance.  This constructor understands
 
6799
    several keyword parameters.  An output stream may be set using the *stream*
 
6800
@@ -73,9 +73,7 @@
 
6801
 
 
6802
 The :class:`PrettyPrinter` class supports several derivative functions:
 
6803
 
 
6804
-.. Now the derivative functions:
 
6805
-
 
6806
-.. function:: pformat(object[, indent[, width[, depth]]])
 
6807
+.. function:: pformat(object, indent=1, width=80, depth=None)
 
6808
 
 
6809
    Return the formatted representation of *object* as a string.  *indent*, *width*
 
6810
    and *depth* will be passed to the :class:`PrettyPrinter` constructor as
 
6811
@@ -85,10 +83,10 @@
 
6812
       The parameters *indent*, *width* and *depth* were added.
 
6813
 
 
6814
 
 
6815
-.. function:: pprint(object[, stream[, indent[, width[, depth]]]])
 
6816
+.. function:: pprint(object, stream=None, indent=1, width=80, depth=None)
 
6817
 
 
6818
    Prints the formatted representation of *object* on *stream*, followed by a
 
6819
-   newline.  If *stream* is omitted, ``sys.stdout`` is used.  This may be used in
 
6820
+   newline.  If *stream* is ``None``, ``sys.stdout`` is used.  This may be used in
 
6821
    the interactive interpreter instead of a :keyword:`print` statement for
 
6822
    inspecting values.    *indent*, *width* and *depth* will be passed to the
 
6823
    :class:`PrettyPrinter` constructor as formatting parameters.
 
6824
@@ -206,7 +204,8 @@
 
6825
 pprint Example
 
6826
 --------------
 
6827
 
 
6828
-This example demonstrates several uses of the :func:`pprint` function and its parameters.
 
6829
+This example demonstrates several uses of the :func:`pprint` function and its
 
6830
+parameters.
 
6831
 
 
6832
    >>> import pprint
 
6833
    >>> tup = ('spam', ('eggs', ('lumberjack', ('knights', ('ni', ('dead',
6540
6834
diff -r 70274d53c1dd Doc/library/profile.rst
6541
6835
--- a/Doc/library/profile.rst
6542
6836
+++ b/Doc/library/profile.rst
8555
8849
 
8556
8850
    .. versionadded:: 2.2
8557
8851
 
8558
 
@@ -2378,7 +2399,7 @@
 
8852
@@ -2309,7 +2330,7 @@
 
8853
 
 
8854
       with open("hello.txt") as f:
 
8855
           for line in f:
 
8856
-              print line
 
8857
+              print line,
 
8858
 
 
8859
    In older versions of Python, you would have needed to do this to get the same
 
8860
    effect::
 
8861
@@ -2317,7 +2338,7 @@
 
8862
       f = open("hello.txt")
 
8863
       try:
 
8864
           for line in f:
 
8865
-              print line
 
8866
+              print line,
 
8867
       finally:
 
8868
           f.close()
 
8869
 
 
8870
@@ -2371,14 +2392,14 @@
 
8871
 
 
8872
    A file object is its own iterator, for example ``iter(f)`` returns *f* (unless
 
8873
    *f* is closed).  When a file is used as an iterator, typically in a
 
8874
-   :keyword:`for` loop (for example, ``for line in f: print line``), the
 
8875
+   :keyword:`for` loop (for example, ``for line in f: print line.strip()``), the
 
8876
    :meth:`~file.next` method is called repeatedly.  This method returns the next input
 
8877
    line, or raises :exc:`StopIteration` when EOF is hit when the file is open for
 
8878
    reading (behavior is undefined when the file is open for writing).  In order to
8559
8879
    make a :keyword:`for` loop the most efficient way of looping over the lines of a
8560
8880
    file (a very common operation), the :meth:`~file.next` method uses a hidden read-ahead
8561
8881
    buffer.  As a consequence of using a read-ahead buffer, combining :meth:`~file.next`
10158
10478
 
10159
10479
 
10160
10480
 The :mod:`urllib2` module defines functions and classes which help in opening
10161
 
@@ -380,6 +380,17 @@
 
10481
@@ -121,7 +121,10 @@
 
10482
       This numeric value corresponds to a value found in the dictionary of
 
10483
       codes as found in :attr:`BaseHTTPServer.BaseHTTPRequestHandler.responses`.
 
10484
 
 
10485
+   .. attribute:: reason
 
10486
 
 
10487
+      The reason for this error.  It can be a message string or another exception
 
10488
+      instance.
 
10489
 
 
10490
 The following classes are provided:
 
10491
 
 
10492
@@ -380,6 +383,17 @@
10162
10493
    Return the selector --- the part of the URL that is sent to the server.
10163
10494
 
10164
10495
 
11518
11849
 
11519
11850
 "Private" instance variables that cannot be accessed except from inside an
11520
11851
 object don't exist in Python.  However, there is a convention that is followed
 
11852
@@ -688,7 +688,7 @@
 
11853
    for char in "123":
 
11854
        print char
 
11855
    for line in open("myfile.txt"):
 
11856
-       print line
 
11857
+       print line,
 
11858
 
 
11859
 This style of access is clear, concise, and convenient.  The use of iterators
 
11860
 pervades and unifies Python.  Behind the scenes, the :keyword:`for` statement
11521
11861
diff -r 70274d53c1dd Doc/tutorial/controlflow.rst
11522
11862
--- a/Doc/tutorial/controlflow.rst
11523
11863
+++ b/Doc/tutorial/controlflow.rst
11795
12135
    ...    print 'x =', x
11796
12136
    ...    print 'y =', y
11797
12137
    ...
 
12138
@@ -389,7 +397,7 @@
 
12139
 and print its contents to the screen. ::
 
12140
 
 
12141
    for line in open("myfile.txt"):
 
12142
-       print line
 
12143
+       print line,
 
12144
 
 
12145
 The problem with this code is that it leaves the file open for an indeterminate
 
12146
 amount of time after the code has finished executing. This is not an issue in
 
12147
@@ -399,7 +407,7 @@
 
12148
 
 
12149
    with open("myfile.txt") as f:
 
12150
        for line in f:
 
12151
-           print line
 
12152
+           print line,
 
12153
 
 
12154
 After the statement is executed, the file *f* is always closed, even if a
 
12155
 problem was encountered while processing the lines. Other objects which provide
11798
12156
diff -r 70274d53c1dd Doc/tutorial/index.rst
11799
12157
--- a/Doc/tutorial/index.rst
11800
12158
+++ b/Doc/tutorial/index.rst
12281
12639
diff -r 70274d53c1dd Include/pyport.h
12282
12640
--- a/Include/pyport.h
12283
12641
+++ b/Include/pyport.h
12284
 
@@ -549,6 +549,30 @@
 
12642
@@ -93,9 +93,12 @@
 
12643
  * uint32_t to be such a type unless stdint.h or inttypes.h defines uint32_t.
 
12644
  * However, it doesn't set HAVE_UINT32_T, so we do that here.
 
12645
  */
 
12646
-#if (defined UINT32_MAX || defined uint32_t)
 
12647
+#ifdef uint32_t
 
12648
+#define HAVE_UINT32_T 1
 
12649
+#endif
 
12650
+
 
12651
+#ifdef HAVE_UINT32_T
 
12652
 #ifndef PY_UINT32_T
 
12653
-#define HAVE_UINT32_T 1
 
12654
 #define PY_UINT32_T uint32_t
 
12655
 #endif
 
12656
 #endif
 
12657
@@ -103,23 +106,33 @@
 
12658
 /* Macros for a 64-bit unsigned integer type; used for type 'twodigits' in the
 
12659
  * long integer implementation, when 30-bit digits are enabled.
 
12660
  */
 
12661
-#if (defined UINT64_MAX || defined uint64_t)
 
12662
+#ifdef uint64_t
 
12663
+#define HAVE_UINT64_T 1
 
12664
+#endif
 
12665
+
 
12666
+#ifdef HAVE_UINT64_T
 
12667
 #ifndef PY_UINT64_T
 
12668
-#define HAVE_UINT64_T 1
 
12669
 #define PY_UINT64_T uint64_t
 
12670
 #endif
 
12671
 #endif
 
12672
 
 
12673
 /* Signed variants of the above */
 
12674
-#if (defined INT32_MAX || defined int32_t)
 
12675
+#ifdef int32_t
 
12676
+#define HAVE_INT32_T 1
 
12677
+#endif
 
12678
+
 
12679
+#ifdef HAVE_INT32_T
 
12680
 #ifndef PY_INT32_T
 
12681
-#define HAVE_INT32_T 1
 
12682
 #define PY_INT32_T int32_t
 
12683
 #endif
 
12684
 #endif
 
12685
-#if (defined INT64_MAX || defined int64_t)
 
12686
+
 
12687
+#ifdef int64_t
 
12688
+#define HAVE_INT64_T 1
 
12689
+#endif
 
12690
+
 
12691
+#ifdef HAVE_INT64_T
 
12692
 #ifndef PY_INT64_T
 
12693
-#define HAVE_INT64_T 1
 
12694
 #define PY_INT64_T int64_t
 
12695
 #endif
 
12696
 #endif
 
12697
@@ -549,6 +562,30 @@
12285
12698
         _Py_set_387controlword(old_387controlword)
12286
12699
 #endif
12287
12700
 
12312
12725
 /* default definitions are empty */
12313
12726
 #ifndef HAVE_PY_SET_53BIT_PRECISION
12314
12727
 #define _Py_SET_53BIT_PRECISION_HEADER
12315
 
@@ -622,7 +646,7 @@
 
12728
@@ -622,7 +659,7 @@
12316
12729
 /* On QNX 6, struct termio must be declared by including sys/termio.h
12317
12730
    if TCGETA, TCSETA, TCSETAW, or TCSETAF are used.  sys/termio.h must
12318
12731
    be included before termios.h or it will generate an error. */
12334
12747
     /* XXX signal handlers should also be here */
12335
12748
 
12336
12749
 } PyThreadState;
 
12750
diff -r 70274d53c1dd Include/weakrefobject.h
 
12751
--- a/Include/weakrefobject.h
 
12752
+++ b/Include/weakrefobject.h
 
12753
@@ -66,7 +66,17 @@
 
12754
 
 
12755
 PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self);
 
12756
 
 
12757
-#define PyWeakref_GET_OBJECT(ref) (((PyWeakReference *)(ref))->wr_object)
 
12758
+/* Explanation for the Py_REFCNT() check: when a weakref's target is part
 
12759
+   of a long chain of deallocations which triggers the trashcan mechanism,
 
12760
+   clearing the weakrefs can be delayed long after the target's refcount
 
12761
+   has dropped to zero.  In the meantime, code accessing the weakref will
 
12762
+   be able to "see" the target object even though it is supposed to be
 
12763
+   unreachable.  See issue #16602. */
 
12764
+
 
12765
+#define PyWeakref_GET_OBJECT(ref)                           \
 
12766
+    (Py_REFCNT(((PyWeakReference *)(ref))->wr_object) > 0   \
 
12767
+     ? ((PyWeakReference *)(ref))->wr_object                \
 
12768
+     : Py_None)
 
12769
 
 
12770
 
 
12771
 #ifdef __cplusplus
12337
12772
diff -r 70274d53c1dd Lib/BaseHTTPServer.py
12338
12773
--- a/Lib/BaseHTTPServer.py
12339
12774
+++ b/Lib/BaseHTTPServer.py
13048
13483
diff -r 70274d53c1dd Lib/collections.py
13049
13484
--- a/Lib/collections.py
13050
13485
+++ b/Lib/collections.py
13051
 
@@ -58,7 +58,7 @@
 
13486
@@ -6,11 +6,12 @@
 
13487
 __all__ += _abcoll.__all__
 
13488
 
 
13489
 from _collections import deque, defaultdict
 
13490
-from operator import itemgetter as _itemgetter
 
13491
+from operator import itemgetter as _itemgetter, eq as _eq
 
13492
 from keyword import iskeyword as _iskeyword
 
13493
 import sys as _sys
 
13494
 import heapq as _heapq
 
13495
 from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
 
13496
+from itertools import imap as _imap
 
13497
 
 
13498
 try:
 
13499
     from thread import get_ident as _get_ident
 
13500
@@ -50,49 +51,45 @@
 
13501
             self.__map = {}
 
13502
         self.__update(*args, **kwds)
 
13503
 
 
13504
-    def __setitem__(self, key, value, PREV=0, NEXT=1, dict_setitem=dict.__setitem__):
 
13505
+    def __setitem__(self, key, value, dict_setitem=dict.__setitem__):
 
13506
         'od.__setitem__(i, y) <==> od[i]=y'
 
13507
         # Setting a new item creates a new link at the end of the linked list,
 
13508
         # and the inherited dictionary is updated with the new key/value pair.
 
13509
         if key not in self:
13052
13510
             root = self.__root
13053
 
             last = root[PREV]
13054
 
             last[NEXT] = root[PREV] = self.__map[key] = [last, root, key]
 
13511
-            last = root[PREV]
 
13512
-            last[NEXT] = root[PREV] = self.__map[key] = [last, root, key]
13055
13513
-        dict_setitem(self, key, value)
 
13514
+            last = root[0]
 
13515
+            last[1] = root[0] = self.__map[key] = [last, root, key]
13056
13516
+        return dict_setitem(self, key, value)
13057
13517
 
13058
 
     def __delitem__(self, key, PREV=0, NEXT=1, dict_delitem=dict.__delitem__):
 
13518
-    def __delitem__(self, key, PREV=0, NEXT=1, dict_delitem=dict.__delitem__):
 
13519
+    def __delitem__(self, key, dict_delitem=dict.__delitem__):
13059
13520
         'od.__delitem__(y) <==> del od[y]'
13060
 
@@ -91,8 +91,6 @@
 
13521
         # Deleting an existing item uses self.__map to find the link which gets
 
13522
         # removed by updating the links in the predecessor and successor nodes.
 
13523
         dict_delitem(self, key)
 
13524
         link_prev, link_next, key = self.__map.pop(key)
 
13525
-        link_prev[NEXT] = link_next
 
13526
-        link_next[PREV] = link_prev
 
13527
+        link_prev[1] = link_next                        # update link_prev[NEXT]
 
13528
+        link_next[0] = link_prev                        # update link_next[PREV]
 
13529
 
 
13530
     def __iter__(self):
 
13531
         'od.__iter__() <==> iter(od)'
 
13532
         # Traverse the linked list in order.
 
13533
-        NEXT, KEY = 1, 2
 
13534
         root = self.__root
 
13535
-        curr = root[NEXT]
 
13536
+        curr = root[1]                                  # start at the first node
 
13537
         while curr is not root:
 
13538
-            yield curr[KEY]
 
13539
-            curr = curr[NEXT]
 
13540
+            yield curr[2]                               # yield the curr[KEY]
 
13541
+            curr = curr[1]                              # move to next node
 
13542
 
 
13543
     def __reversed__(self):
 
13544
         'od.__reversed__() <==> reversed(od)'
 
13545
         # Traverse the linked list in reverse order.
 
13546
-        PREV, KEY = 0, 2
 
13547
         root = self.__root
 
13548
-        curr = root[PREV]
 
13549
+        curr = root[0]                                  # start at the last node
 
13550
         while curr is not root:
 
13551
-            yield curr[KEY]
 
13552
-            curr = curr[PREV]
 
13553
+            yield curr[2]                               # yield the curr[KEY]
 
13554
+            curr = curr[0]                              # move to previous node
13061
13555
 
13062
13556
     def clear(self):
13063
13557
         'od.clear() -> None.  Remove all items from od.'
13066
13560
         root = self.__root
13067
13561
         root[:] = [root, root, None]
13068
13562
         self.__map.clear()
13069
 
@@ -234,10 +232,60 @@
 
13563
@@ -208,7 +205,7 @@
 
13564
 
 
13565
         '''
 
13566
         if isinstance(other, OrderedDict):
 
13567
-            return len(self)==len(other) and self.items() == other.items()
 
13568
+            return dict.__eq__(self, other) and all(_imap(_eq, self, other))
 
13569
         return dict.__eq__(self, other)
 
13570
 
 
13571
     def __ne__(self, other):
 
13572
@@ -234,10 +231,60 @@
13070
13573
 ### namedtuple
13071
13574
 ################################################################################
13072
13575
 
13128
13631
     >>> Point.__doc__                   # docstring for the new class
13129
13632
     'Point(x, y)'
13130
13633
     >>> p = Point(11, y=22)             # instantiate with positional args or keywords
13131
 
@@ -258,83 +306,63 @@
 
13634
@@ -258,83 +305,63 @@
13132
13635
 
13133
13636
     """
13134
13637
 
13414
13917
     # run()
13415
13918
 
13416
13919
     def _dist_path(self, path):
 
13920
diff -r 70274d53c1dd Lib/distutils/command/check.py
 
13921
--- a/Lib/distutils/command/check.py
 
13922
+++ b/Lib/distutils/command/check.py
 
13923
@@ -26,6 +26,9 @@
 
13924
 
 
13925
         def system_message(self, level, message, *children, **kwargs):
 
13926
             self.messages.append((level, message, children, kwargs))
 
13927
+            return nodes.system_message(message, level=level,
 
13928
+                                        type=self.levels[level],
 
13929
+                                        *children, **kwargs)
 
13930
 
 
13931
     HAS_DOCUTILS = True
 
13932
 except ImportError:
13417
13933
diff -r 70274d53c1dd Lib/distutils/config.py
13418
13934
--- a/Lib/distutils/config.py
13419
13935
+++ b/Lib/distutils/config.py
13420
 
@@ -42,7 +42,7 @@
 
13936
@@ -42,16 +42,11 @@
13421
13937
     def _store_pypirc(self, username, password):
13422
13938
         """Creates a default .pypirc file."""
13423
13939
         rc = self._get_rc_file()
13426
13942
         try:
13427
13943
             f.write(DEFAULT_PYPIRC % (username, password))
13428
13944
         finally:
 
13945
             f.close()
 
13946
-        try:
 
13947
-            os.chmod(rc, 0600)
 
13948
-        except OSError:
 
13949
-            # should do something better here
 
13950
-            pass
 
13951
 
 
13952
     def _read_pypirc(self):
 
13953
         """Reads the .pypirc file."""
13429
13954
diff -r 70274d53c1dd Lib/distutils/dir_util.py
13430
13955
--- a/Lib/distutils/dir_util.py
13431
13956
+++ b/Lib/distutils/dir_util.py
13690
14215
 def test_suite():
13691
14216
     return unittest.makeSuite(InstallTestCase)
13692
14217
 
 
14218
diff -r 70274d53c1dd Lib/distutils/tests/test_register.py
 
14219
--- a/Lib/distutils/tests/test_register.py
 
14220
+++ b/Lib/distutils/tests/test_register.py
 
14221
@@ -1,6 +1,5 @@
 
14222
 # -*- encoding: utf8 -*-
 
14223
 """Tests for distutils.command.register."""
 
14224
-import sys
 
14225
 import os
 
14226
 import unittest
 
14227
 import getpass
 
14228
@@ -11,11 +10,14 @@
 
14229
 
 
14230
 from distutils.command import register as register_module
 
14231
 from distutils.command.register import register
 
14232
-from distutils.core import Distribution
 
14233
 from distutils.errors import DistutilsSetupError
 
14234
 
 
14235
-from distutils.tests import support
 
14236
-from distutils.tests.test_config import PYPIRC, PyPIRCCommandTestCase
 
14237
+from distutils.tests.test_config import PyPIRCCommandTestCase
 
14238
+
 
14239
+try:
 
14240
+    import docutils
 
14241
+except ImportError:
 
14242
+    docutils = None
 
14243
 
 
14244
 PYPIRC_NOPASSWORD = """\
 
14245
 [distutils]
 
14246
@@ -192,6 +194,7 @@
 
14247
         self.assertEqual(headers['Content-length'], '290')
 
14248
         self.assertTrue('tarek' in req.data)
 
14249
 
 
14250
+    @unittest.skipUnless(docutils is not None, 'needs docutils')
 
14251
     def test_strict(self):
 
14252
         # testing the script option
 
14253
         # when on, the register command stops if
 
14254
@@ -204,13 +207,6 @@
 
14255
         cmd.strict = 1
 
14256
         self.assertRaises(DistutilsSetupError, cmd.run)
 
14257
 
 
14258
-        # we don't test the reSt feature if docutils
 
14259
-        # is not installed
 
14260
-        try:
 
14261
-            import docutils
 
14262
-        except ImportError:
 
14263
-            return
 
14264
-
 
14265
         # metadata are OK but long_description is broken
 
14266
         metadata = {'url': 'xxx', 'author': 'xxx',
 
14267
                     'author_email': u'éxéxé',
 
14268
@@ -264,6 +260,21 @@
 
14269
         finally:
 
14270
             del register_module.raw_input
 
14271
 
 
14272
+    @unittest.skipUnless(docutils is not None, 'needs docutils')
 
14273
+    def test_register_invalid_long_description(self):
 
14274
+        description = ':funkie:`str`'  # mimic Sphinx-specific markup
 
14275
+        metadata = {'url': 'xxx', 'author': 'xxx',
 
14276
+                    'author_email': 'xxx',
 
14277
+                    'name': 'xxx', 'version': 'xxx',
 
14278
+                    'long_description': description}
 
14279
+        cmd = self._get_cmd(metadata)
 
14280
+        cmd.ensure_finalized()
 
14281
+        cmd.strict = True
 
14282
+        inputs = RawInputs('2', 'tarek', 'tarek@ziade.org')
 
14283
+        register_module.raw_input = inputs
 
14284
+        self.addCleanup(delattr, register_module, 'raw_input')
 
14285
+        self.assertRaises(DistutilsSetupError, cmd.run)
 
14286
+
 
14287
     def test_check_metadata_deprecated(self):
 
14288
         # makes sure make_metadata is deprecated
 
14289
         cmd = self._get_cmd()
13693
14290
diff -r 70274d53c1dd Lib/distutils/tests/test_sdist.py
13694
14291
--- a/Lib/distutils/tests/test_sdist.py
13695
14292
+++ b/Lib/distutils/tests/test_sdist.py
14803
15400
diff -r 70274d53c1dd Lib/json/__init__.py
14804
15401
--- a/Lib/json/__init__.py
14805
15402
+++ b/Lib/json/__init__.py
 
15403
@@ -37,8 +37,8 @@
 
15404
 Pretty printing::
 
15405
 
 
15406
     >>> import json
 
15407
-    >>> s = json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4)
 
15408
-    >>> print '\n'.join([l.rstrip() for l in  s.splitlines()])
 
15409
+    >>> print json.dumps({'4': 5, '6': 7}, sort_keys=True,
 
15410
+    ...                  indent=4, separators=(',', ': '))
 
15411
     {
 
15412
         "4": 5,
 
15413
         "6": 7
14806
15414
@@ -95,7 +95,7 @@
14807
15415
         "json": "obj"
14808
15416
     }
14841
15449
 
14842
15450
     If ``check_circular`` is false, then the circular reference check
14843
15451
     for container types will be skipped and a circular reference will
14844
 
@@ -158,6 +161,9 @@
 
15452
@@ -147,7 +150,9 @@
 
15453
     If ``indent`` is a non-negative integer, then JSON array elements and
 
15454
     object members will be pretty-printed with that indent level. An indent
 
15455
     level of 0 will only insert newlines. ``None`` is the most compact
 
15456
-    representation.
 
15457
+    representation.  Since the default item separator is ``', '``,  the
 
15458
+    output might include trailing whitespace when ``indent`` is specified.
 
15459
+    You can use ``separators=(',', ': ')`` to avoid this.
 
15460
 
 
15461
     If ``separators`` is an ``(item_separator, dict_separator)`` tuple
 
15462
     then it will be used instead of the default ``(', ', ': ')`` separators.
 
15463
@@ -158,6 +163,9 @@
14845
15464
     ``default(obj)`` is a function that should return a serializable version
14846
15465
     of obj or raise TypeError. The default simply raises TypeError.
14847
15466
 
14851
15470
     To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the
14852
15471
     ``.default()`` method to serialize additional types), specify it with
14853
15472
     the ``cls`` kwarg; otherwise ``JSONEncoder`` is used.
14854
 
@@ -167,7 +173,7 @@
 
15473
@@ -167,7 +175,7 @@
14855
15474
     if (not skipkeys and ensure_ascii and
14856
15475
         check_circular and allow_nan and
14857
15476
         cls is None and indent is None and separators is None and
14860
15479
         iterable = _default_encoder.iterencode(obj)
14861
15480
     else:
14862
15481
         if cls is None:
14863
 
@@ -175,7 +181,7 @@
 
15482
@@ -175,7 +183,7 @@
14864
15483
         iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii,
14865
15484
             check_circular=check_circular, allow_nan=allow_nan, indent=indent,
14866
15485
             separators=separators, encoding=encoding,
14869
15488
     # could accelerate with writelines in some versions of Python, at
14870
15489
     # a debuggability cost
14871
15490
     for chunk in iterable:
14872
 
@@ -184,16 +190,15 @@
 
15491
@@ -184,16 +192,15 @@
14873
15492
 
14874
15493
 def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True,
14875
15494
         allow_nan=True, cls=None, indent=None, separators=None,
14889
15508
 
14890
15509
     If ``check_circular`` is false, then the circular reference check
14891
15510
     for container types will be skipped and a circular reference will
14892
 
@@ -218,6 +223,9 @@
 
15511
@@ -207,7 +214,9 @@
 
15512
     If ``indent`` is a non-negative integer, then JSON array elements and
 
15513
     object members will be pretty-printed with that indent level. An indent
 
15514
     level of 0 will only insert newlines. ``None`` is the most compact
 
15515
-    representation.
 
15516
+    representation.  Since the default item separator is ``', '``,  the
 
15517
+    output might include trailing whitespace when ``indent`` is specified.
 
15518
+    You can use ``separators=(',', ': ')`` to avoid this.
 
15519
 
 
15520
     If ``separators`` is an ``(item_separator, dict_separator)`` tuple
 
15521
     then it will be used instead of the default ``(', ', ': ')`` separators.
 
15522
@@ -218,6 +227,9 @@
14893
15523
     ``default(obj)`` is a function that should return a serializable version
14894
15524
     of obj or raise TypeError. The default simply raises TypeError.
14895
15525
 
14899
15529
     To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the
14900
15530
     ``.default()`` method to serialize additional types), specify it with
14901
15531
     the ``cls`` kwarg; otherwise ``JSONEncoder`` is used.
14902
 
@@ -227,7 +235,7 @@
 
15532
@@ -227,7 +239,7 @@
14903
15533
     if (not skipkeys and ensure_ascii and
14904
15534
         check_circular and allow_nan and
14905
15535
         cls is None and indent is None and separators is None and
14908
15538
         return _default_encoder.encode(obj)
14909
15539
     if cls is None:
14910
15540
         cls = JSONEncoder
14911
 
@@ -235,7 +243,7 @@
 
15541
@@ -235,7 +247,7 @@
14912
15542
         skipkeys=skipkeys, ensure_ascii=ensure_ascii,
14913
15543
         check_circular=check_circular, allow_nan=allow_nan, indent=indent,
14914
15544
         separators=separators, encoding=encoding, default=default,
14999
15629
 
15000
15630
         If check_circular is true, then lists, dicts, and custom encoded
15001
15631
         objects will be checked for circular references during encoding to
 
15632
@@ -129,7 +131,10 @@
 
15633
         If indent is a non-negative integer, then JSON array
 
15634
         elements and object members will be pretty-printed with that
 
15635
         indent level.  An indent level of 0 will only insert newlines.
 
15636
-        None is the most compact representation.
 
15637
+        None is the most compact representation.  Since the default
 
15638
+        item separator is ', ',  the output might include trailing
 
15639
+        whitespace when indent is specified.  You can use
 
15640
+        separators=(',', ': ') to avoid this.
 
15641
 
 
15642
         If specified, separators should be a (item_separator, key_separator)
 
15643
         tuple.  The default is (', ', ': ').  To get the most compact JSON
15002
15644
diff -r 70274d53c1dd Lib/json/tests/test_decode.py
15003
15645
--- a/Lib/json/tests/test_decode.py
15004
15646
+++ b/Lib/json/tests/test_decode.py
15172
15814
 
15173
15815
 
15174
15816
 class TestPyPass1(TestPass1, PyTest): pass
 
15817
diff -r 70274d53c1dd Lib/json/tests/test_tool.py
 
15818
--- /dev/null
 
15819
+++ b/Lib/json/tests/test_tool.py
 
15820
@@ -0,0 +1,69 @@
 
15821
+import os
 
15822
+import sys
 
15823
+import textwrap
 
15824
+import unittest
 
15825
+import subprocess
 
15826
+from test import test_support
 
15827
+from test.script_helper import assert_python_ok
 
15828
+
 
15829
+class TestTool(unittest.TestCase):
 
15830
+    data = """
 
15831
+
 
15832
+        [["blorpie"],[ "whoops" ] , [
 
15833
+                                 ],\t"d-shtaeou",\r"d-nthiouh",
 
15834
+        "i-vhbjkhnth", {"nifty":87}, {"morefield" :\tfalse,"field"
 
15835
+            :"yes"}  ]
 
15836
+           """
 
15837
+
 
15838
+    expect = textwrap.dedent("""\
 
15839
+    [
 
15840
+        [
 
15841
+            "blorpie"
 
15842
+        ],
 
15843
+        [
 
15844
+            "whoops"
 
15845
+        ],
 
15846
+        [],
 
15847
+        "d-shtaeou",
 
15848
+        "d-nthiouh",
 
15849
+        "i-vhbjkhnth",
 
15850
+        {
 
15851
+            "nifty": 87
 
15852
+        },
 
15853
+        {
 
15854
+            "field": "yes",
 
15855
+            "morefield": false
 
15856
+        }
 
15857
+    ]
 
15858
+    """)
 
15859
+
 
15860
+    def test_stdin_stdout(self):
 
15861
+        proc = subprocess.Popen(
 
15862
+                (sys.executable, '-m', 'json.tool'),
 
15863
+                stdin=subprocess.PIPE, stdout=subprocess.PIPE)
 
15864
+        out, err = proc.communicate(self.data.encode())
 
15865
+        self.assertEqual(out.splitlines(), self.expect.encode().splitlines())
 
15866
+        self.assertEqual(err, None)
 
15867
+
 
15868
+    def _create_infile(self):
 
15869
+        infile = test_support.TESTFN
 
15870
+        with open(infile, "w") as fp:
 
15871
+            self.addCleanup(os.remove, infile)
 
15872
+            fp.write(self.data)
 
15873
+        return infile
 
15874
+
 
15875
+    def test_infile_stdout(self):
 
15876
+        infile = self._create_infile()
 
15877
+        rc, out, err = assert_python_ok('-m', 'json.tool', infile)
 
15878
+        self.assertEqual(out.splitlines(), self.expect.encode().splitlines())
 
15879
+        self.assertEqual(err, b'')
 
15880
+
 
15881
+    def test_infile_outfile(self):
 
15882
+        infile = self._create_infile()
 
15883
+        outfile = test_support.TESTFN + '.out'
 
15884
+        rc, out, err = assert_python_ok('-m', 'json.tool', infile, outfile)
 
15885
+        self.addCleanup(os.remove, outfile)
 
15886
+        with open(outfile, "r") as fp:
 
15887
+            self.assertEqual(fp.read(), self.expect)
 
15888
+        self.assertEqual(out, b'')
 
15889
+        self.assertEqual(err, b'')
15175
15890
diff -r 70274d53c1dd Lib/json/tool.py
15176
15891
--- a/Lib/json/tool.py
15177
15892
+++ b/Lib/json/tool.py
15184
15899
 
15185
15900
 """
15186
15901
 import sys
 
15902
@@ -25,12 +25,15 @@
 
15903
         outfile = open(sys.argv[2], 'wb')
 
15904
     else:
 
15905
         raise SystemExit(sys.argv[0] + " [infile [outfile]]")
 
15906
-    try:
 
15907
-        obj = json.load(infile)
 
15908
-    except ValueError, e:
 
15909
-        raise SystemExit(e)
 
15910
-    json.dump(obj, outfile, sort_keys=True, indent=4)
 
15911
-    outfile.write('\n')
 
15912
+    with infile:
 
15913
+        try:
 
15914
+            obj = json.load(infile)
 
15915
+        except ValueError, e:
 
15916
+            raise SystemExit(e)
 
15917
+    with outfile:
 
15918
+        json.dump(obj, outfile, sort_keys=True,
 
15919
+                  indent=4, separators=(',', ': '))
 
15920
+        outfile.write('\n')
 
15921
 
 
15922
 
 
15923
 if __name__ == '__main__':
15187
15924
diff -r 70274d53c1dd Lib/keyword.py
15188
15925
--- a/Lib/keyword.py
15189
15926
+++ b/Lib/keyword.py
15199
15936
diff -r 70274d53c1dd Lib/lib-tk/Tkinter.py
15200
15937
--- a/Lib/lib-tk/Tkinter.py
15201
15938
+++ b/Lib/lib-tk/Tkinter.py
15202
 
@@ -534,12 +534,19 @@
 
15939
@@ -154,8 +154,12 @@
 
15940
     """Internal function."""
 
15941
     pass
 
15942
 
 
15943
-def _exit(code='0'):
 
15944
+def _exit(code=0):
 
15945
     """Internal function. Calling it will throw the exception SystemExit."""
 
15946
+    try:
 
15947
+        code = int(code)
 
15948
+    except ValueError:
 
15949
+        pass
 
15950
     raise SystemExit, code
 
15951
 
 
15952
 _varnum = 0
 
15953
@@ -534,12 +538,19 @@
15203
15954
 
15204
15955
         The type keyword specifies the form in which the data is
15205
15956
         to be returned and should be an atom name such as STRING
15220
15971
         return self.tk.call(('clipboard', 'get') + self._options(kw))
15221
15972
 
15222
15973
     def clipboard_clear(self, **kw):
15223
 
@@ -621,8 +628,16 @@
 
15974
@@ -621,8 +632,16 @@
15224
15975
         A keyword parameter selection specifies the name of
15225
15976
         the selection and defaults to PRIMARY.  A keyword
15226
15977
         parameter displayof specifies a widget on the display
15238
15989
         return self.tk.call(('selection', 'get') + self._options(kw))
15239
15990
     def selection_handle(self, command, **kw):
15240
15991
         """Specify a function COMMAND to call if the X
15241
 
@@ -1037,6 +1052,15 @@
 
15992
@@ -1037,6 +1056,15 @@
15242
15993
         if displayof is None:
15243
15994
             return ('-displayof', self._w)
15244
15995
         return ()
15254
16005
     def _options(self, cnf, kw = None):
15255
16006
         """Internal function."""
15256
16007
         if kw:
 
16008
@@ -1685,7 +1713,9 @@
 
16009
         self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
 
16010
         if useTk:
 
16011
             self._loadtk()
 
16012
-        self.readprofile(baseName, className)
 
16013
+        if not sys.flags.ignore_environment:
 
16014
+            # Issue #16248: Honor the -E flag to avoid code injection.
 
16015
+            self.readprofile(baseName, className)
 
16016
     def loadtk(self):
 
16017
         if not self._tkloaded:
 
16018
             self.tk.loadtk()
15257
16019
diff -r 70274d53c1dd Lib/lib-tk/tkSimpleDialog.py
15258
16020
--- a/Lib/lib-tk/tkSimpleDialog.py
15259
16021
+++ b/Lib/lib-tk/tkSimpleDialog.py
15281
16043
diff -r 70274d53c1dd Lib/lib2to3/fixer_util.py
15282
16044
--- a/Lib/lib2to3/fixer_util.py
15283
16045
+++ b/Lib/lib2to3/fixer_util.py
 
16046
@@ -165,7 +165,7 @@
 
16047
 
 
16048
 
 
16049
 consuming_calls = set(["sorted", "list", "set", "any", "all", "tuple", "sum",
 
16050
-                       "min", "max"])
 
16051
+                       "min", "max", "enumerate"])
 
16052
 
 
16053
 def attr_chain(obj, attr):
 
16054
     """Follow an attribute chain.
 
16055
@@ -192,14 +192,14 @@
 
16056
 p1 = """
 
16057
 power<
 
16058
     ( 'iter' | 'list' | 'tuple' | 'sorted' | 'set' | 'sum' |
 
16059
-      'any' | 'all' | (any* trailer< '.' 'join' >) )
 
16060
+      'any' | 'all' | 'enumerate' | (any* trailer< '.' 'join' >) )
 
16061
     trailer< '(' node=any ')' >
 
16062
     any*
 
16063
 >
 
16064
 """
 
16065
 p2 = """
 
16066
 power<
 
16067
-    'sorted'
 
16068
+    ( 'sorted' | 'enumerate' )
 
16069
     trailer< '(' arglist<node=any any*> ')' >
 
16070
     any*
 
16071
 >
 
16072
@@ -207,14 +207,14 @@
 
16073
 pats_built = False
 
16074
 def in_special_context(node):
 
16075
     """ Returns true if node is in an environment where all that is required
 
16076
-        of it is being itterable (ie, it doesn't matter if it returns a list
 
16077
-        or an itterator).
 
16078
+        of it is being iterable (ie, it doesn't matter if it returns a list
 
16079
+        or an iterator).
 
16080
         See test_map_nochange in test_fixers.py for some examples and tests.
 
16081
         """
 
16082
     global p0, p1, p2, pats_built
 
16083
     if not pats_built:
 
16084
+        p0 = patcomp.compile_pattern(p0)
 
16085
         p1 = patcomp.compile_pattern(p1)
 
16086
-        p0 = patcomp.compile_pattern(p0)
 
16087
         p2 = patcomp.compile_pattern(p2)
 
16088
         pats_built = True
 
16089
     patterns = [p0, p1, p2]
15284
16090
@@ -274,9 +274,9 @@
15285
16091
     """Find the top level namespace."""
15286
16092
     # Scamper up to the top level namespace
15329
16135
                             # this node has been cut off from a
15330
16136
                             # previous transformation ; skip
15331
16137
                             continue
 
16138
diff -r 70274d53c1dd Lib/lib2to3/tests/test_fixers.py
 
16139
--- a/Lib/lib2to3/tests/test_fixers.py
 
16140
+++ b/Lib/lib2to3/tests/test_fixers.py
 
16141
@@ -2981,6 +2981,10 @@
 
16142
         self.unchanged(a)
 
16143
         a = """sorted(filter(f, 'abc'), key=blah)[0]"""
 
16144
         self.unchanged(a)
 
16145
+        a = """enumerate(filter(f, 'abc'))"""
 
16146
+        self.unchanged(a)
 
16147
+        a = """enumerate(filter(f, 'abc'), start=1)"""
 
16148
+        self.unchanged(a)
 
16149
         a = """for i in filter(f, 'abc'): pass"""
 
16150
         self.unchanged(a)
 
16151
         a = """[x for x in filter(f, 'abc')]"""
 
16152
@@ -3089,6 +3093,10 @@
 
16153
         self.unchanged(a)
 
16154
         a = """sorted(map(f, 'abc'), key=blah)[0]"""
 
16155
         self.unchanged(a)
 
16156
+        a = """enumerate(map(f, 'abc'))"""
 
16157
+        self.unchanged(a)
 
16158
+        a = """enumerate(map(f, 'abc'), start=1)"""
 
16159
+        self.unchanged(a)
 
16160
         a = """for i in map(f, 'abc'): pass"""
 
16161
         self.unchanged(a)
 
16162
         a = """[x for x in map(f, 'abc')]"""
 
16163
@@ -3152,6 +3160,10 @@
 
16164
         self.unchanged(a)
 
16165
         a = """sorted(zip(a, b), key=blah)[0]"""
 
16166
         self.unchanged(a)
 
16167
+        a = """enumerate(zip(a, b))"""
 
16168
+        self.unchanged(a)
 
16169
+        a = """enumerate(zip(a, b), start=1)"""
 
16170
+        self.unchanged(a)
 
16171
         a = """for i in zip(a, b): pass"""
 
16172
         self.unchanged(a)
 
16173
         a = """[x for x in zip(a, b)]"""
15332
16174
diff -r 70274d53c1dd Lib/locale.py
15333
16175
--- a/Lib/locale.py
15334
16176
+++ b/Lib/locale.py
16620
17462
diff -r 70274d53c1dd Lib/tarfile.py
16621
17463
--- a/Lib/tarfile.py
16622
17464
+++ b/Lib/tarfile.py
 
17465
@@ -1987,9 +1987,8 @@
 
17466
 
 
17467
         # Append the tar header and data to the archive.
 
17468
         if tarinfo.isreg():
 
17469
-            f = bltn_open(name, "rb")
 
17470
-            self.addfile(tarinfo, f)
 
17471
-            f.close()
 
17472
+            with bltn_open(name, "rb") as f:
 
17473
+                self.addfile(tarinfo, f)
 
17474
 
 
17475
         elif tarinfo.isdir():
 
17476
             self.addfile(tarinfo)
 
17477
@@ -2197,10 +2196,11 @@
 
17478
         """Make a file called targetpath.
 
17479
         """
 
17480
         source = self.extractfile(tarinfo)
 
17481
-        target = bltn_open(targetpath, "wb")
 
17482
-        copyfileobj(source, target)
 
17483
-        source.close()
 
17484
-        target.close()
 
17485
+        try:
 
17486
+            with bltn_open(targetpath, "wb") as target:
 
17487
+                copyfileobj(source, target)
 
17488
+        finally:
 
17489
+            source.close()
 
17490
 
 
17491
     def makeunknown(self, tarinfo, targetpath):
 
17492
         """Make a file from a TarInfo object with an unknown type
16623
17493
@@ -2397,7 +2397,7 @@
16624
17494
         """
16625
17495
         if tarinfo.issym():
21194
22064
     @unittest.skipUnless(hasattr(posix, 'chown'), "test needs os.chown()")
21195
22065
     def test_chown(self):
21196
22066
         # raise an OSError if the file does not exist
21197
 
@@ -395,8 +405,16 @@
 
22067
@@ -324,7 +334,16 @@
 
22068
     def _test_chflags_regular_file(self, chflags_func, target_file):
 
22069
         st = os.stat(target_file)
 
22070
         self.assertTrue(hasattr(st, 'st_flags'))
 
22071
-        chflags_func(target_file, st.st_flags | stat.UF_IMMUTABLE)
 
22072
+
 
22073
+        # ZFS returns EOPNOTSUPP when attempting to set flag UF_IMMUTABLE.
 
22074
+        try:
 
22075
+            chflags_func(target_file, st.st_flags | stat.UF_IMMUTABLE)
 
22076
+        except OSError as err:
 
22077
+            if err.errno != errno.EOPNOTSUPP:
 
22078
+                raise
 
22079
+            msg = 'chflag UF_IMMUTABLE not supported by underlying fs'
 
22080
+            self.skipTest(msg)
 
22081
+
 
22082
         try:
 
22083
             new_st = os.stat(target_file)
 
22084
             self.assertEqual(st.st_flags | stat.UF_IMMUTABLE, new_st.st_flags)
 
22085
@@ -353,8 +372,16 @@
 
22086
         self.teardown_files.append(_DUMMY_SYMLINK)
 
22087
         dummy_symlink_st = os.lstat(_DUMMY_SYMLINK)
 
22088
 
 
22089
-        posix.lchflags(_DUMMY_SYMLINK,
 
22090
-                       dummy_symlink_st.st_flags | stat.UF_IMMUTABLE)
 
22091
+        # ZFS returns EOPNOTSUPP when attempting to set flag UF_IMMUTABLE.
 
22092
+        try:
 
22093
+            posix.lchflags(_DUMMY_SYMLINK,
 
22094
+                           dummy_symlink_st.st_flags | stat.UF_IMMUTABLE)
 
22095
+        except OSError as err:
 
22096
+            if err.errno != errno.EOPNOTSUPP:
 
22097
+                raise
 
22098
+            msg = 'chflag UF_IMMUTABLE not supported by underlying fs'
 
22099
+            self.skipTest(msg)
 
22100
+
 
22101
         try:
 
22102
             new_testfn_st = os.stat(test_support.TESTFN)
 
22103
             new_dummy_symlink_st = os.lstat(_DUMMY_SYMLINK)
 
22104
@@ -395,8 +422,16 @@
21198
22105
                             _create_and_do_getcwd(dirname, current_path_length + len(dirname) + 1)
21199
22106
                     except OSError as e:
21200
22107
                         expected_errno = errno.ENAMETOOLONG
21213
22120
                         self.assertEqual(e.errno, expected_errno)
21214
22121
                     finally:
21215
22122
                         os.chdir('..')
21216
 
@@ -412,8 +430,9 @@
 
22123
@@ -412,8 +447,9 @@
21217
22124
     def test_getgroups(self):
21218
22125
         with os.popen('id -G') as idg:
21219
22126
             groups = idg.read().strip()
21227
22134
diff -r 70274d53c1dd Lib/test/test_posixpath.py
21228
22135
--- a/Lib/test/test_posixpath.py
21229
22136
+++ b/Lib/test/test_posixpath.py
21230
 
@@ -201,6 +201,7 @@
 
22137
@@ -110,8 +110,10 @@
 
22138
                 ),
 
22139
                 True
 
22140
             )
 
22141
-            # If we don't have links, assume that os.stat doesn't return resonable
 
22142
-            # inode information and thus, that samefile() doesn't work
 
22143
+
 
22144
+            # If we don't have links, assume that os.stat doesn't return
 
22145
+            # reasonable inode information and thus, that samefile() doesn't
 
22146
+            # work.
 
22147
             if hasattr(os, "symlink"):
 
22148
                 os.symlink(
 
22149
                     test_support.TESTFN + "1",
 
22150
@@ -151,19 +153,19 @@
 
22151
                 ),
 
22152
                 True
 
22153
             )
 
22154
-            # If we don't have links, assume that os.stat() doesn't return resonable
 
22155
-            # inode information and thus, that samefile() doesn't work
 
22156
+            # If we don't have links, assume that os.stat() doesn't return
 
22157
+            # reasonable inode information and thus, that samestat() doesn't
 
22158
+            # work.
 
22159
             if hasattr(os, "symlink"):
 
22160
-                if hasattr(os, "symlink"):
 
22161
-                    os.symlink(test_support.TESTFN + "1", test_support.TESTFN + "2")
 
22162
-                    self.assertIs(
 
22163
-                        posixpath.samestat(
 
22164
-                            os.stat(test_support.TESTFN + "1"),
 
22165
-                            os.stat(test_support.TESTFN + "2")
 
22166
-                        ),
 
22167
-                        True
 
22168
-                    )
 
22169
-                    os.remove(test_support.TESTFN + "2")
 
22170
+                os.symlink(test_support.TESTFN + "1", test_support.TESTFN + "2")
 
22171
+                self.assertIs(
 
22172
+                    posixpath.samestat(
 
22173
+                        os.stat(test_support.TESTFN + "1"),
 
22174
+                        os.stat(test_support.TESTFN + "2")
 
22175
+                    ),
 
22176
+                    True
 
22177
+                )
 
22178
+                os.remove(test_support.TESTFN + "2")
 
22179
                 f = open(test_support.TESTFN + "2", "wb")
 
22180
                 f.write("bar")
 
22181
                 f.close()
 
22182
@@ -201,6 +203,7 @@
21231
22183
             with test_support.EnvironmentVarGuard() as env:
21232
22184
                 env['HOME'] = '/'
21233
22185
                 self.assertEqual(posixpath.expanduser("~"), "/")
21393
22345
diff -r 70274d53c1dd Lib/test/test_re.py
21394
22346
--- a/Lib/test/test_re.py
21395
22347
+++ b/Lib/test/test_re.py
21396
 
@@ -174,11 +174,31 @@
 
22348
@@ -1,4 +1,5 @@
 
22349
 from test.test_support import verbose, run_unittest, import_module
 
22350
+from test.test_support import precisionbigmemtest, _2G
 
22351
 import re
 
22352
 from re import Scanner
 
22353
 import sys
 
22354
@@ -6,6 +7,7 @@
 
22355
 import traceback
 
22356
 from weakref import proxy
 
22357
 
 
22358
+
 
22359
 # Misc tests from Tim Peters' re.doc
 
22360
 
 
22361
 # WARNING: Don't change details in these tests if you don't know
 
22362
@@ -174,11 +176,31 @@
21397
22363
         self.assertEqual(re.sub('x*', '-', 'abxd'), '-a-b-d-')
21398
22364
         self.assertEqual(re.sub('x+', '-', 'abxd'), 'ab-d')
21399
22365
 
21425
22391
         self.assertRaises(re.error, re.sub, '(?P<a>x)', '\g<1a1>', 'xx')
21426
22392
         self.assertRaises(IndexError, re.sub, '(?P<a>x)', '\g<ab>', 'xx')
21427
22393
         self.assertRaises(re.error, re.sub, '(?P<a>x)|(?P<b>y)', '\g<b>', 'xx')
21428
 
@@ -373,12 +393,44 @@
 
22394
@@ -373,12 +395,44 @@
21429
22395
         self.assertEqual(re.search(r"\d\D\w\W\s\S",
21430
22396
                                    "1aa! a", re.UNICODE).group(0), "1aa! a")
21431
22397
 
21470
22436
     def test_anyall(self):
21471
22437
         self.assertEqual(re.match("a.b", "a\nb", re.DOTALL).group(0),
21472
22438
                          "a\nb")
21473
 
@@ -757,6 +809,16 @@
 
22439
@@ -757,6 +811,36 @@
21474
22440
         self.assertRaises(TypeError, re.finditer, "a", {})
21475
22441
         self.assertRaises(OverflowError, _sre.compile, "abc", 0, [long_overflow])
21476
22442
 
21484
22450
+        # Test behaviour when not given a string or pattern as parameter
21485
22451
+        self.assertRaises(TypeError, re.compile, 0)
21486
22452
+
 
22453
+    @precisionbigmemtest(size=_2G, memuse=1)
 
22454
+    def test_large_search(self, size):
 
22455
+        # Issue #10182: indices were 32-bit-truncated.
 
22456
+        s = 'a' * size
 
22457
+        m = re.search('$', s)
 
22458
+        self.assertIsNotNone(m)
 
22459
+        self.assertEqual(m.start(), size)
 
22460
+        self.assertEqual(m.end(), size)
 
22461
+
 
22462
+    # The huge memuse is because of re.sub() using a list and a join()
 
22463
+    # to create the replacement result.
 
22464
+    @precisionbigmemtest(size=_2G, memuse=16 + 2)
 
22465
+    def test_large_subn(self, size):
 
22466
+        # Issue #10182: indices were 32-bit-truncated.
 
22467
+        s = 'a' * size
 
22468
+        r, n = re.subn('', '', s)
 
22469
+        self.assertEqual(r, s)
 
22470
+        self.assertEqual(n, size + 1)
 
22471
+
 
22472
+
21487
22473
 def run_re_tests():
21488
22474
     from test.re_tests import tests, SUCCEED, FAIL, SYNTAX_ERROR
21489
22475
     if verbose:
23223
24209
 class TestBase(unittest.TestCase):
23224
24210
 
23225
24211
     def setUp(self):
23226
 
@@ -705,6 +726,54 @@
 
24212
@@ -705,6 +726,75 @@
23227
24213
         self.assertEqual(b(), None)
23228
24214
         self.assertEqual(l, [a, b])
23229
24215
 
23275
24261
+        self.assertEqual(hash(a), hash(42))
23276
24262
+        self.assertRaises(TypeError, hash, b)
23277
24263
+
 
24264
+    def test_trashcan_16602(self):
 
24265
+        # Issue #16602: when a weakref's target was part of a long
 
24266
+        # deallocation chain, the trashcan mechanism could delay clearing
 
24267
+        # of the weakref and make the target object visible from outside
 
24268
+        # code even though its refcount had dropped to 0.  A crash ensued.
 
24269
+        class C(object):
 
24270
+            def __init__(self, parent):
 
24271
+                if not parent:
 
24272
+                    return
 
24273
+                wself = weakref.ref(self)
 
24274
+                def cb(wparent):
 
24275
+                    o = wself()
 
24276
+                self.wparent = weakref.ref(parent, cb)
 
24277
+
 
24278
+        d = weakref.WeakKeyDictionary()
 
24279
+        root = c = C(None)
 
24280
+        for n in range(100):
 
24281
+            d[c] = c = C(c)
 
24282
+        del root
 
24283
+        gc.collect()
 
24284
+
23278
24285
 
23279
24286
 class SubclassableWeakrefTestCase(TestBase):
23280
24287
 
23281
 
@@ -809,17 +878,66 @@
 
24288
@@ -809,17 +899,66 @@
23282
24289
         self.assertEqual(self.cbcalled, 0)
23283
24290
 
23284
24291
 
25195
26202
 AST_C=         $(AST_C_DIR)/Python-ast.c
25196
26203
 AST_ASDL=      $(srcdir)/Parser/Python.asdl
25197
26204
 
25198
 
@@ -406,11 +410,15 @@
 
26205
@@ -406,11 +410,16 @@
25199
26206
 
25200
26207
 
25201
26208
 # Build the shared modules
25202
 
+# MAKEFLAGS are sorted and normalized. Under GNU make the 's' for
 
26209
+# Under GNU make, MAKEFLAGS are sorted and normalized; the 's' for
25203
26210
+# -s, --silent or --quiet is always the first char.
 
26211
+# Under BSD make, MAKEFLAGS might be " -s -v x=y".
25204
26212
 sharedmods: $(BUILDPYTHON)
25205
26213
-       @case $$MAKEFLAGS in \
25206
26214
-       *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
25207
26215
-       *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
25208
26216
-       esac
25209
26217
+       @case "$$MAKEFLAGS" in \
25210
 
+           s*) quiet="-q";; \
 
26218
+           *\ -s*|s*) quiet="-q";; \
25211
26219
+           *) quiet="";; \
25212
26220
+       esac; \
25213
26221
+       $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
25215
26223
 
25216
26224
 # Build static library
25217
26225
 # avoid long command lines, same as LIBRARY_OBJS
25218
 
@@ -559,9 +567,11 @@
 
26226
@@ -559,9 +568,11 @@
25219
26227
 Parser/pgenmain.o:     $(srcdir)/Include/parsetok.h
25220
26228
 
25221
26229
 $(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
25227
26235
        $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
25228
26236
 
25229
26237
 Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
25230
 
@@ -957,7 +967,9 @@
 
26238
@@ -957,7 +968,9 @@
25231
26239
                -d $(LIBDEST)/site-packages -f \
25232
26240
                -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
25233
26241
        -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
25238
26246
 
25239
26247
 # Create the PLATDIR source directory, if one wasn't distributed..
25240
26248
 $(srcdir)/Lib/$(PLATDIR):
25241
 
@@ -1165,7 +1177,7 @@
 
26249
@@ -1165,7 +1178,7 @@
25242
26250
        $(SHELL) config.status --recheck
25243
26251
        $(SHELL) config.status
25244
26252
 
25396
26404
 Mike Clarkson
25397
26405
 Andrew Clegg
25398
26406
 Brad Clements
25399
 
@@ -177,8 +206,10 @@
 
26407
@@ -172,13 +201,16 @@
 
26408
 Scott Cotton
 
26409
 Greg Couch
 
26410
 David Cournapeau
 
26411
+Julien Courteau
 
26412
 Steve Cousins
 
26413
 Alex Coventry
25400
26414
 Matthew Dixon Cowles
25401
26415
 Ryan Coyner
25402
26416
 Christopher A. Craig
25407
26421
 Drew Csillag
25408
26422
 Joaquin Cuenca Abela
25409
26423
 John Cugini
25410
 
@@ -191,6 +222,7 @@
 
26424
@@ -191,6 +223,7 @@
25411
26425
 Eric Daniel
25412
26426
 Scott David Daniels
25413
26427
 Ben Darnell
25415
26429
 Jonathan Dasteel
25416
26430
 John DeGood
25417
26431
 Ned Deily
25418
 
@@ -198,6 +230,7 @@
 
26432
@@ -198,6 +231,7 @@
25419
26433
 Arnaud Delobelle
25420
26434
 Erik Demaine
25421
26435
 John Dennis
25423
26437
 Roger Dev
25424
26438
 Philippe Devalkeneer
25425
26439
 Raghuram Devarakonda
25426
 
@@ -211,6 +244,7 @@
 
26440
@@ -211,6 +245,7 @@
25427
26441
 Daniel Dittmar
25428
26442
 Jaromir Dolecek
25429
26443
 Ismail Donmez
25431
26445
 Marcos Donolo
25432
26446
 Dima Dorfman
25433
26447
 Cesar Douady
25434
 
@@ -259,20 +293,25 @@
 
26448
@@ -223,6 +258,7 @@
 
26449
 Robin Dunn
 
26450
 Luke Dunstan
 
26451
 Virgil Dupras
 
26452
+Bruno Dupuis
 
26453
 Andy Dustman
 
26454
 Gary Duzan
 
26455
 Eugene Dvurechenski
 
26456
@@ -259,20 +295,25 @@
25435
26457
 Mark Favas
25436
26458
 Niels Ferguson
25437
26459
 Sebastian Fernandez
25457
26479
 Ivan Frohne
25458
26480
 Jim Fulton
25459
26481
 Tadayoshi Funaba
25460
 
@@ -287,6 +326,7 @@
 
26482
@@ -287,6 +328,7 @@
25461
26483
 Lele Gaifax
25462
26484
 Santiago Gala
25463
26485
 Yitzchak Gale
25465
26487
 Quentin Gallet-Gilles
25466
26488
 Raymund Galvin
25467
26489
 Nitin Ganatra
25468
 
@@ -295,12 +335,14 @@
 
26490
@@ -295,12 +337,14 @@
25469
26491
 Dan Gass
25470
26492
 Andrew Gaul
25471
26493
 Stephen M. Gava
25480
26502
 Dinu Gherman
25481
26503
 Jonathan Giddy
25482
26504
 Johannes Gijsbers
25483
 
@@ -308,18 +350,23 @@
 
26505
@@ -308,18 +352,23 @@
25484
26506
 Christoph Gohlke
25485
26507
 Tim Golden
25486
26508
 Chris Gonnerman
25504
26526
 Paul ten Hagen
25505
26527
 Rasmus Hahn
25506
26528
 Peter Haight
25507
 
@@ -327,7 +374,9 @@
 
26529
@@ -327,7 +376,9 @@
25508
26530
 Bob Halley
25509
26531
 Jesse Hallio
25510
26532
 Jun Hamano
25514
26536
 Manus Hand
25515
26537
 Milton L. Hankins
25516
26538
 Stephen Hansen
25517
 
@@ -335,9 +384,13 @@
 
26539
@@ -335,9 +386,13 @@
25518
26540
 Lynda Hardman
25519
26541
 Derek Harland
25520
26542
 Jason Harper
25528
26550
 Jochen Hayek
25529
26551
 Christian Heimes
25530
26552
 Thomas Heller
25531
 
@@ -363,9 +416,13 @@
 
26553
@@ -363,9 +418,13 @@
25532
26554
 Joerg-Cyril Hoehle
25533
26555
 Gregor Hoffleit
25534
26556
 Chris Hoffman
25542
26564
 Gerrit Holl
25543
26565
 Shane Holloway
25544
26566
 Rune Holm
25545
 
@@ -380,6 +437,7 @@
 
26567
@@ -380,6 +439,7 @@
25546
26568
 Jan Hosang
25547
26569
 Ken Howard
25548
26570
 Brad Howes
25550
26572
 Chih-Hao Huang
25551
26573
 Lawrence Hudson
25552
26574
 Michael Hudson
25553
 
@@ -387,6 +445,7 @@
 
26575
@@ -387,6 +447,7 @@
25554
26576
 Greg Humphreys
25555
26577
 Eric Huss
25556
26578
 Jeremy Hylton
25558
26580
 Gerhard Häring
25559
26581
 Fredrik Håård
25560
26582
 Catalin Iacob
25561
 
@@ -397,6 +456,7 @@
 
26583
@@ -397,6 +458,7 @@
25562
26584
 Tony Ingraldi
25563
26585
 John Interrante
25564
26586
 Bob Ippolito
25566
26588
 Atsuo Ishimoto
25567
26589
 Paul Jackson
25568
26590
 Ben Jackson
25569
 
@@ -409,10 +469,15 @@
 
26591
@@ -409,10 +471,15 @@
25570
26592
 Thomas Jarosch
25571
26593
 Drew Jenkins
25572
26594
 Flemming Kjær Jensen
25582
26604
 Simon Johnston
25583
26605
 Nicolas Joly
25584
26606
 Evan Jones
25585
 
@@ -425,6 +490,7 @@
 
26607
@@ -425,6 +492,7 @@
25586
26608
 Sijin Joseph
25587
26609
 Andreas Jung
25588
26610
 Tattoo Mabonzo K.
25590
26612
 Bob Kahn
25591
26613
 Kurt B. Kaiser
25592
26614
 Tamito Kajiyama
25593
 
@@ -437,17 +503,20 @@
 
26615
@@ -437,17 +505,20 @@
25594
26616
 Ryan Kelly
25595
26617
 Robert Kern
25596
26618
 Randall Kern
25612
26634
 Ron Klatchko
25613
26635
 Bastian Kleineidam
25614
26636
 Bob Kline
25615
 
@@ -457,10 +526,15 @@
 
26637
@@ -457,10 +528,15 @@
25616
26638
 Kim Knapp
25617
26639
 Lenny Kneler
25618
26640
 Pat Knight
25628
26650
 Maksim Kozyarchuk
25629
26651
 Stefan Krah
25630
26652
 Bob Kras
25631
 
@@ -473,10 +547,13 @@
 
26653
@@ -471,12 +547,16 @@
 
26654
 Hannu Krosing
 
26655
 Andrej Krpic
25632
26656
 Ivan Krstić
 
26657
+Steven Kryskalla
25633
26658
 Andrew Kuchling
25634
26659
 Ralf W. Grosse-Kunstleve
25635
26660
+Dave Kuhlman
25642
26667
 Torsten Landschoff
25643
26668
 Łukasz Langa
25644
26669
 Tino Lange
25645
 
@@ -493,13 +570,15 @@
 
26670
@@ -493,13 +573,16 @@
25646
26671
 Thomas Lee
25647
26672
 Christopher Lee
25648
26673
 Luc Lefebvre
 
26674
+Pierre Paul Lefebvre
25649
26675
+Glyph Lefkowitz
25650
26676
 Vincent Legoll
25651
26677
 Kip Lehman
25659
26685
 John Lenton
25660
26686
 Christopher Tur Lesniewski-Laas
25661
26687
 Mark Levinson
25662
 
@@ -510,10 +589,13 @@
 
26688
@@ -510,10 +593,13 @@
25663
26689
 Shawn Ligocki
25664
26690
 Martin Ligr
25665
26691
 Christopher Lindblad
25673
26699
 Nick Lockwood
25674
26700
 Stephanie Lockwood
25675
26701
 Anne Lord
25676
 
@@ -529,6 +611,8 @@
 
26702
@@ -529,6 +615,8 @@
25677
26703
 Jim Lynch
25678
26704
 Mikael Lyngvig
25679
26705
 Martin von Löwis
25682
26708
 Andrew I MacIntyre
25683
26709
 Tim MacKenzie
25684
26710
 Nick Maclaren
25685
 
@@ -537,16 +621,22 @@
 
26711
@@ -537,16 +625,22 @@
25686
26712
 David Malcolm
25687
26713
 Ken Manheimer
25688
26714
 Vladimir Marangozov
25705
26731
 Kirk McDonald
25706
26732
 Chris McDonough
25707
26733
 Greg McFarlane
25708
 
@@ -556,19 +646,24 @@
 
26734
@@ -556,19 +650,24 @@
25709
26735
 Gordon McMillan
25710
26736
 Caolan McNamara
25711
26737
 Andrew McNamara
25730
26756
 Damien Miller
25731
26757
 Chad Miller
25732
26758
 Jason V. Miller
25733
 
@@ -577,12 +672,15 @@
 
26759
@@ -577,12 +676,15 @@
25734
26760
 Andrii V. Mishkovskyi
25735
26761
 Dustin J. Mitchell
25736
26762
 Dom Mitchell
25746
26772
 Pablo Mouzo
25747
26773
 Ruslan Mstoi
25748
26774
 Sjoerd Mullender
25749
 
@@ -590,7 +688,8 @@
 
26775
@@ -590,7 +692,8 @@
25750
26776
 Michael Muller
25751
26777
 Neil Muller
25752
26778
 R. David Murray
25756
26782
 John Nagle
25757
26783
 Takahiro Nakayama
25758
26784
 Travers Naran
25759
 
@@ -602,6 +701,7 @@
 
26785
@@ -602,6 +705,7 @@
25760
26786
 Chad Netzer
25761
26787
 Max Neunhöffer
25762
26788
 George Neville-Neil
25764
26790
 Johannes Nicolai
25765
26791
 Samuel Nicolary
25766
26792
 Gustavo Niemeyer
25767
 
@@ -619,11 +719,14 @@
 
26793
@@ -619,11 +723,14 @@
25768
26794
 Nigel O'Brian
25769
26795
 Kevin O'Connor
25770
26796
 Tim O'Malley
25779
26805
 Jason Orendorff
25780
26806
 Douglas Orr
25781
26807
 Michele Orrù
25782
 
@@ -632,6 +735,8 @@
 
26808
@@ -632,6 +739,8 @@
25783
26809
 Michael Otteneder
25784
26810
 R. M. Oudkerk
25785
26811
 Russel Owen
25788
26814
 Ondrej Palkovsky
25789
26815
 Mike Pall
25790
26816
 Todd R. Palmer
25791
 
@@ -641,11 +746,13 @@
 
26817
@@ -641,11 +750,14 @@
25792
26818
 Peter Parente
25793
26819
 Alexandre Parenteau
25794
26820
 Dan Parisien
25797
26823
 Randy Pausch
25798
26824
 Samuele Pedroni
25799
26825
 Marcel van der Peijl
 
26826
+Berker Peksag
25800
26827
 Steven Pemberton
25801
26828
+Bo Peng
25802
26829
 Santiago Peresón
25803
26830
 Mark Perrego
25804
26831
 Trevor Perrin
25805
 
@@ -654,11 +761,13 @@
 
26832
@@ -654,11 +766,13 @@
25806
26833
 Benjamin Peterson
25807
26834
 Chris Petrilli
25808
26835
 Bjorn Pettersen
25816
26843
 Jim St. Pierre
25817
26844
 Dan Pierson
25818
26845
 Martijn Pieters
25819
 
@@ -681,15 +790,16 @@
 
26846
@@ -681,15 +795,16 @@
25820
26847
 Brian Quinlan
25821
26848
 Anders Qvist
25822
26849
 Burton Radons
25835
26862
 Gareth Rees
25836
26863
 Steve Reeves
25837
26864
 Lennart Regebro
25838
 
@@ -706,24 +816,29 @@
 
26865
@@ -706,24 +821,29 @@
25839
26866
 Nicholas Riley
25840
26867
 Jean-Claude Rimbault
25841
26868
 Vlad Riscutia
25865
26892
 Craig Rowland
25866
26893
 Clinton Roy
25867
26894
 Paul Rubin
25868
 
@@ -734,6 +849,8 @@
 
26895
@@ -734,6 +854,8 @@
25869
26896
 Sam Rushing
25870
26897
 Mark Russell
25871
26898
 Nick Russo
25874
26901
 Sébastien Sablé
25875
26902
 Suman Saha
25876
26903
 Hajime Saitou
25877
 
@@ -743,17 +860,21 @@
 
26904
@@ -743,17 +865,21 @@
25878
26905
 Ilya Sandler
25879
26906
 Mark Sapiro
25880
26907
 Ty Sarna
25896
26923
 Chad J. Schroeder
25897
26924
 Sam Schulenburg
25898
26925
 Stefan Schwarzer
25899
 
@@ -763,14 +884,20 @@
 
26926
@@ -763,14 +889,20 @@
25900
26927
 Barry Scott
25901
26928
 Nick Seidenman
25902
26929
 Žiga Seilnach
25917
26944
 Bruce Sherwood
25918
26945
 Alexander Shigin
25919
26946
 Pete Shinners
25920
 
@@ -778,30 +905,40 @@
 
26947
@@ -778,30 +910,40 @@
25921
26948
 John W. Shipman
25922
26949
 Joel Shprentz
25923
26950
 Itamar Shtull-Trauring
25958
26985
 Oliver Steele
25959
26986
 Greg Stein
25960
26987
 Chris Stern
25961
 
@@ -810,6 +947,7 @@
 
26988
@@ -810,6 +952,7 @@
25962
26989
 Peter Stoehr
25963
26990
 Casper Stoel
25964
26991
 Michael Stone
25966
26993
 Ken Stox
25967
26994
 Patrick Strawderman
25968
26995
 Dan Stromberg
25969
 
@@ -817,6 +955,7 @@
 
26996
@@ -817,6 +960,7 @@
25970
26997
 Andreas Stührk
25971
26998
 Nathan Sullivan
25972
26999
 Mark Summerfield
25974
27001
 Hisao Suzuki
25975
27002
 Andrew Svetlov
25976
27003
 Kalle Svensson
25977
 
@@ -827,6 +966,7 @@
 
27004
@@ -827,6 +971,7 @@
25978
27005
 Geoff Talvola
25979
27006
 William Tanksley
25980
27007
 Christian Tanzer
25982
27009
 Steven Taschuk
25983
27010
 Monty Taylor
25984
27011
 Amy Taylor
25985
 
@@ -843,6 +983,7 @@
 
27012
@@ -843,16 +988,20 @@
25986
27013
 Oren Tirosh
25987
27014
 Jason Tishler
25988
27015
 Christian Tismer
25990
27017
 Frank J. Tobin
25991
27018
 R Lindsay Todd
25992
27019
 Bennett Todd
25993
 
@@ -852,7 +993,9 @@
 
27020
+Eugene Toder
 
27021
 Matias Torchinsky
 
27022
 Sandro Tosi
 
27023
 Richard Townsend
25994
27024
 Laurence Tratt
25995
27025
 John Tromp
25996
27026
 Jason Trowbridge
26000
27030
 Stephen Turner
26001
27031
 Theodore Turocy
26002
27032
 Bill Tutt
26003
 
@@ -862,6 +1005,7 @@
 
27033
@@ -862,6 +1011,7 @@
26004
27034
 Roger Upole
26005
27035
 Michael Urman
26006
27036
 Hector Urtubia
26008
27038
 Andi Vajda
26009
27039
 Case Van Horsen
26010
27040
 Kyle VanderBeek
26011
 
@@ -878,6 +1022,8 @@
 
27041
@@ -878,6 +1028,8 @@
26012
27042
 Kurt Vile
26013
27043
 Norman Vine
26014
27044
 Frank Visser
26017
27047
 Niki W. Waibel
26018
27048
 Wojtek Walczak
26019
27049
 Charles Waldman
26020
 
@@ -885,14 +1031,17 @@
 
27050
@@ -885,14 +1037,17 @@
26021
27051
 Larry Wall
26022
27052
 Kevin Walzer
26023
27053
 Greg Ward
26035
27065
 Edward Welbourne
26036
27066
 Cliff Wells
26037
27067
 Rickard Westman
26038
 
@@ -905,12 +1054,16 @@
 
27068
@@ -905,12 +1060,16 @@
26039
27069
 Gerry Wiener
26040
27070
 Frank Wierzbicki
26041
27071
 Bryce "Zooko" Wilcox-O'Hearn
26052
27082
 Jody Winston
26053
27083
 Collin Winter
26054
27084
 Dik Winter
26055
 
@@ -924,6 +1077,8 @@
 
27085
@@ -924,6 +1083,8 @@
26056
27086
 Klaus-Juergen Wolf
26057
27087
 Dan Wolfe
26058
27088
 Richard Wolff
26061
27091
 Darren Worrall
26062
27092
 Gordon Worley
26063
27093
 Thomas Wouters
26064
 
@@ -934,6 +1089,7 @@
 
27094
@@ -934,6 +1095,7 @@
26065
27095
 Ka-Ping Yee
26066
27096
 Bob Yodlowski
26067
27097
 Danny Yoo
26069
27099
 George Yoshida
26070
27100
 Masazumi Yoshikawa
26071
27101
 Arnaud Ysmal
26072
 
@@ -944,5 +1100,6 @@
 
27102
@@ -944,5 +1106,6 @@
26073
27103
 Mike Zarnstorff
26074
27104
 Siebren van der Zee
26075
27105
 Uwe Zessin
26079
27109
diff -r 70274d53c1dd Misc/NEWS
26080
27110
--- a/Misc/NEWS
26081
27111
+++ b/Misc/NEWS
26082
 
@@ -1,17 +1,630 @@
 
27112
@@ -1,17 +1,662 @@
26083
27113
 Python News
26084
27114
 +++++++++++
26085
27115
 
26095
27125
+Core and Builtins
26096
27126
+-----------------
26097
27127
+
 
27128
+- Issue #16602: When a weakref's target was part of a long deallocation
 
27129
+  chain, the object could remain reachable through its weakref even though
 
27130
+  its refcount had dropped to zero.
 
27131
+
26098
27132
+- Issue #9011: Fix hacky AST code that modified the CST when compiling
26099
27133
+  a negated numeric literal.
26100
27134
+
26141
27175
+  HTTP servers and reduce memory usage. It's actually a backport of a Python
26142
27176
+  3.2 fix. Thanks to Adrien Kunysz.
26143
27177
+
 
27178
+- Issue #16588: Silence unused-but-set warnings in Python/thread_pthread
 
27179
+
26144
27180
+- Issue #13992: The trashcan mechanism is now thread-safe.  This eliminates
26145
27181
+  sporadic crashes in multi-thread programs when several long deallocator
26146
27182
+  chains ran concurrently and involved subclasses of built-in container
26240
27276
 Library
26241
27277
 -------
26242
27278
 
 
27279
+- Issue #16248: Disable code execution from the user's home directory by
 
27280
+  tkinter when the -E flag is passed to Python.  Patch by Zachary Ware.
 
27281
+
 
27282
+- Issue #16628: Fix a memory leak in ctypes.resize().
 
27283
+
 
27284
+- Issue #13614: Fix setup.py register failure with invalid rst in description.
 
27285
+  Patch by Julien Courteau and Pierre Paul Lefebvre.
 
27286
+
 
27287
+- Issue #10182: The re module doesn't truncate indices to 32 bits anymore.
 
27288
+  Patch by Serhiy Storchaka.
 
27289
+
 
27290
+- Issue #16573: In 2to3, treat enumerate() like a consuming call, so superfluous
 
27291
+  list() calls aren't added to filter(), map(), and zip() which are directly
 
27292
+  passed enumerate().
 
27293
+
 
27294
+- Issue #16476: Fix json.tool to avoid including trailing whitespace.
 
27295
+
26243
27296
+- Issue #1160: Fix compiling large regular expressions on UCS2 builds.
26244
27297
+  Patch by Serhiy Storchaka.
26245
27298
+
26607
27660
+Tests
26608
27661
+-----
26609
27662
+
 
27663
+- Issue #15747: ZFS always returns EOPNOTSUPP when attempting to set the
 
27664
+  UF_IMMUTABLE flag (via either chflags or lchflags); refactor affected
 
27665
+  tests in test_posix.py to account for this.
 
27666
+
 
27667
+- Issue #16549: Add tests for json.tools.  Initial patch by Berker Peksag
 
27668
+  and Serhiy Storchaka.
 
27669
+
26610
27670
+- Issue #16559: Add more tests for the json module, including some from the
26611
27671
+  official test suite at json.org.  Patch by Serhiy Storchaka.
26612
27672
+
26671
27731
+Documentation
26672
27732
+-------------
26673
27733
+
 
27734
+- Issue #15990: Improve argument/parameter documentation.
 
27735
+
26674
27736
+- Issue #16400: Update the description of which versions of a given package
26675
27737
+  PyPI displays.
26676
27738
+
26714
27776
 
26715
27777
 What's New in Python 2.7.3 release candidate 2?
26716
27778
 ===============================================
26717
 
@@ -498,6 +1111,10 @@
 
27779
@@ -498,6 +1143,10 @@
26718
27780
 Extension Modules
26719
27781
 -----------------
26720
27782
 
26725
27787
 - bsddb module: Erratic behaviour of "DBEnv->rep_elect()" because a typo.
26726
27788
   Possible crash.
26727
27789
 
26728
 
@@ -572,6 +1189,9 @@
 
27790
@@ -572,6 +1221,9 @@
26729
27791
 Tests
26730
27792
 -----
26731
27793
 
26735
27797
 - Issue #11689: Fix a variable scoping error in an sqlite3 test.
26736
27798
   Initial patch by Torsten Landschoff.
26737
27799
 
26738
 
@@ -624,7 +1244,8 @@
 
27800
@@ -624,7 +1276,8 @@
26739
27801
 Documentation
26740
27802
 -------------
26741
27803
 
26745
27807
 
26746
27808
 - Issue #13402: Document absoluteness of sys.executable.
26747
27809
 
26748
 
@@ -797,7 +1418,7 @@
 
27810
@@ -797,7 +1450,7 @@
26749
27811
 - Issue #11927: SMTP_SSL now uses port 465 by default as documented.  Patch
26750
27812
   by Kasun Herath.
26751
27813
 
26754
27816
   detect mtime changes by comparing to the system clock instead of to the
26755
27817
   previous value of the mtime.
26756
27818
 
26757
 
@@ -4371,7 +4992,7 @@
 
27819
@@ -4371,7 +5024,7 @@
26758
27820
 - Restore Python 2.3 compatibility for decimal.py.
26759
27821
 
26760
27822
 - Issue #1702551: distutils sdist was not excluding VCS directories under
26954
28016
             return NULL;
26955
28017
         }
26956
28018
         ++self->line_num;
 
28019
diff -r 70274d53c1dd Modules/_ctypes/_ctypes.c
 
28020
--- a/Modules/_ctypes/_ctypes.c
 
28021
+++ b/Modules/_ctypes/_ctypes.c
 
28022
@@ -2530,7 +2530,7 @@
 
28023
     assert(dict); /* Cannot be NULL for CDataObject instances */
 
28024
     Py_CLEAR(self->b_objects);
 
28025
     if ((self->b_needsfree)
 
28026
-        && ((size_t)dict->size > sizeof(self->b_value)))
 
28027
+        && _CDataObject_HasExternalBuffer(self))
 
28028
         PyMem_Free(self->b_ptr);
 
28029
     self->b_ptr = NULL;
 
28030
     Py_CLEAR(self->b_base);
 
28031
diff -r 70274d53c1dd Modules/_ctypes/callproc.c
 
28032
--- a/Modules/_ctypes/callproc.c
 
28033
+++ b/Modules/_ctypes/callproc.c
 
28034
@@ -1740,7 +1740,7 @@
 
28035
         obj->b_size = size;
 
28036
         goto done;
 
28037
     }
 
28038
-    if (obj->b_size <= sizeof(obj->b_value)) {
 
28039
+    if (!_CDataObject_HasExternalBuffer(obj)) {
 
28040
         /* We are currently using the objects default buffer, but it
 
28041
            isn't large enough any more. */
 
28042
         void *ptr = PyMem_Malloc(size);
26957
28043
diff -r 70274d53c1dd Modules/_ctypes/cfield.c
26958
28044
--- a/Modules/_ctypes/cfield.c
26959
28045
+++ b/Modules/_ctypes/cfield.c
27219
28305
 #ifdef WORDS_BIGENDIAN
27220
28306
     if (_PyFloat_Pack4(x, (unsigned char *)ptr, 1))
27221
28307
         return NULL;
 
28308
diff -r 70274d53c1dd Modules/_ctypes/ctypes.h
 
28309
--- a/Modules/_ctypes/ctypes.h
 
28310
+++ b/Modules/_ctypes/ctypes.h
 
28311
@@ -153,6 +153,7 @@
 
28312
 extern PyTypeObject PyCData_Type;
 
28313
 #define CDataObject_CheckExact(v)       ((v)->ob_type == &PyCData_Type)
 
28314
 #define CDataObject_Check(v)            PyObject_TypeCheck(v, &PyCData_Type)
 
28315
+#define _CDataObject_HasExternalBuffer(v)  ((v)->b_ptr != (char *)&(v)->b_value)
 
28316
 
 
28317
 extern PyTypeObject PyCSimpleType_Type;
 
28318
 #define PyCSimpleTypeObject_CheckExact(v)       ((v)->ob_type == &PyCSimpleType_Type)
27222
28319
diff -r 70274d53c1dd Modules/_ctypes/libffi_osx/x86/darwin64.S
27223
28320
--- a/Modules/_ctypes/libffi_osx/x86/darwin64.S
27224
28321
+++ b/Modules/_ctypes/libffi_osx/x86/darwin64.S
28211
29308
diff -r 70274d53c1dd Modules/_sre.c
28212
29309
--- a/Modules/_sre.c
28213
29310
+++ b/Modules/_sre.c
 
29311
@@ -1636,7 +1636,7 @@
 
29312
 static PyObject *
 
29313
 sre_codesize(PyObject* self, PyObject *unused)
 
29314
 {
 
29315
-    return Py_BuildValue("l", sizeof(SRE_CODE));
 
29316
+    return PyLong_FromSize_t(sizeof(SRE_CODE));
 
29317
 }
 
29318
 
 
29319
 static PyObject *
 
29320
@@ -2448,7 +2448,7 @@
 
29321
         return NULL;
 
29322
 
 
29323
     if (subn)
 
29324
-        return Py_BuildValue("Ni", item, n);
 
29325
+        return Py_BuildValue("Nn", item, n);
 
29326
 
 
29327
     return item;
 
29328
 
28214
29329
@@ -2675,6 +2675,13 @@
28215
29330
         PyObject *o = PyList_GET_ITEM(code, i);
28216
29331
         unsigned long value = PyInt_Check(o) ? (unsigned long)PyInt_AsLong(o)
28247
29362
                 if (!_validate_inner(code, code+skip-3, groups))
28248
29363
                     FAIL;
28249
29364
                 code += skip-3;
 
29365
@@ -3386,7 +3389,7 @@
 
29366
     }
 
29367
 
 
29368
     /* mark is -1 if group is undefined */
 
29369
-    return Py_BuildValue("i", self->mark[index*2]);
 
29370
+    return PyLong_FromSsize_t(self->mark[index*2]);
 
29371
 }
 
29372
 
 
29373
 static PyObject*
 
29374
@@ -3409,7 +3412,7 @@
 
29375
     }
 
29376
 
 
29377
     /* mark is -1 if group is undefined */
 
29378
-    return Py_BuildValue("i", self->mark[index*2+1]);
 
29379
+    return PyLong_FromSsize_t(self->mark[index*2+1]);
 
29380
 }
 
29381
 
 
29382
 LOCAL(PyObject*)
 
29383
@@ -3559,7 +3562,7 @@
 
29384
 match_lastindex_get(MatchObject *self)
 
29385
 {
 
29386
     if (self->lastindex >= 0)
 
29387
-       return Py_BuildValue("i", self->lastindex);
 
29388
+        return PyLong_FromSsize_t(self->lastindex);
 
29389
     Py_INCREF(Py_None);
 
29390
     return Py_None;
 
29391
 }
28250
29392
diff -r 70274d53c1dd Modules/_ssl.c
28251
29393
--- a/Modules/_ssl.c
28252
29394
+++ b/Modules/_ssl.c
31339
32481
diff -r 70274d53c1dd Objects/weakrefobject.c
31340
32482
--- a/Objects/weakrefobject.c
31341
32483
+++ b/Objects/weakrefobject.c
31342
 
@@ -187,15 +187,19 @@
 
32484
@@ -52,9 +52,8 @@
 
32485
 {
 
32486
     PyObject *callback = self->wr_callback;
 
32487
 
 
32488
-    if (PyWeakref_GET_OBJECT(self) != Py_None) {
 
32489
-        PyWeakReference **list = GET_WEAKREFS_LISTPTR(
 
32490
-            PyWeakref_GET_OBJECT(self));
 
32491
+    if (self->wr_object != Py_None) {
 
32492
+        PyWeakReference **list = GET_WEAKREFS_LISTPTR(self->wr_object);
 
32493
 
 
32494
         if (*list == self)
 
32495
             /* If 'self' is the end of the list (and thus self->wr_next == NULL)
 
32496
@@ -187,15 +186,19 @@
31343
32497
 static PyObject *
31344
32498
 weakref_richcompare(PyWeakReference* self, PyWeakReference* other, int op)
31345
32499
 {
33130
34284
 #undef _POSIX_THREADS
33131
34285
 #endif
33132
34286
 #endif
 
34287
diff -r 70274d53c1dd Python/thread_pthread.h
 
34288
--- a/Python/thread_pthread.h
 
34289
+++ b/Python/thread_pthread.h
 
34290
@@ -284,6 +284,7 @@
 
34291
     sem_t *thelock = (sem_t *)lock;
 
34292
     int status, error = 0;
 
34293
 
 
34294
+    (void) error; /* silence unused-but-set-variable warning */
 
34295
     dprintf(("PyThread_free_lock(%p) called\n", lock));
 
34296
 
 
34297
     if (!thelock)
 
34298
@@ -314,6 +315,7 @@
 
34299
     sem_t *thelock = (sem_t *)lock;
 
34300
     int status, error = 0;
 
34301
 
 
34302
+    (void) error; /* silence unused-but-set-variable warning */
 
34303
     dprintf(("PyThread_acquire_lock(%p, %d) called\n", lock, waitflag));
 
34304
 
 
34305
     do {
 
34306
@@ -341,6 +343,7 @@
 
34307
     sem_t *thelock = (sem_t *)lock;
 
34308
     int status, error = 0;
 
34309
 
 
34310
+    (void) error; /* silence unused-but-set-variable warning */
 
34311
     dprintf(("PyThread_release_lock(%p) called\n", lock));
 
34312
 
 
34313
     status = sem_post(thelock);
33133
34314
diff -r 70274d53c1dd README
33134
34315
--- a/README
33135
34316
+++ b/README
33268
34449
diff -r 70274d53c1dd configure.ac
33269
34450
--- /dev/null
33270
34451
+++ b/configure.ac
33271
 
@@ -0,0 +1,4385 @@
 
34452
@@ -0,0 +1,4412 @@
33272
34453
+dnl ***********************************************
33273
34454
+dnl * Please run autoreconf to test your changes! *
33274
34455
+dnl ***********************************************
34474
35655
+  CC="$ac_save_cc"])
34475
35656
+  AC_MSG_RESULT($ac_cv_olimit_ok)
34476
35657
+  if test $ac_cv_olimit_ok = yes; then
34477
 
+    BASECFLAGS="$BASECFLAGS -Olimit 1500"
 
35658
+    case $ac_sys_system in
 
35659
+        # Issue #16534: On HP-UX ac_cv_olimit_ok=yes is a false positive.
 
35660
+        HP-UX*)
 
35661
+            ;;
 
35662
+        *)
 
35663
+            BASECFLAGS="$BASECFLAGS -Olimit 1500"
 
35664
+            ;;
 
35665
+    esac
34478
35666
+  fi
34479
35667
+fi
34480
35668
+
34781
35969
+AC_DEFINE_UNQUOTED([RETSIGTYPE],[void],[assume C89 semantics that RETSIGTYPE is always void])
34782
35970
+AC_TYPE_SIZE_T
34783
35971
+AC_TYPE_UID_T
 
35972
+
 
35973
+# There are two separate checks for each of the exact-width integer types we
 
35974
+# need.  First we check whether the type is available using the usual
 
35975
+# AC_CHECK_TYPE macro with the default includes (which includes <inttypes.h>
 
35976
+# and <stdint.h> where available).  We then also use the special type checks of
 
35977
+# the form AC_TYPE_UINT32_T, which in the case that uint32_t is not available
 
35978
+# directly, #define's uint32_t to be a suitable type.
 
35979
+
 
35980
+AC_CHECK_TYPE(uint32_t,
 
35981
+  AC_DEFINE(HAVE_UINT32_T, 1, [Define if your compiler provides uint32_t.]),,)
34784
35982
+AC_TYPE_UINT32_T
 
35983
+
 
35984
+AC_CHECK_TYPE(uint64_t,
 
35985
+  AC_DEFINE(HAVE_UINT64_T, 1, [Define if your compiler provides uint64_t.]),,)
34785
35986
+AC_TYPE_UINT64_T
 
35987
+
 
35988
+AC_CHECK_TYPE(int32_t,
 
35989
+  AC_DEFINE(HAVE_INT32_T, 1, [Define if your compiler provides int32_t.]),,)
34786
35990
+AC_TYPE_INT32_T
 
35991
+
 
35992
+AC_CHECK_TYPE(int64_t,
 
35993
+  AC_DEFINE(HAVE_INT64_T, 1, [Define if your compiler provides int64_t.]),,)
34787
35994
+AC_TYPE_INT64_T
 
35995
+
34788
35996
+AC_CHECK_TYPE(ssize_t,
34789
35997
+  AC_DEFINE(HAVE_SSIZE_T, 1, [Define if your compiler provides ssize_t]),,)
34790
35998
+
42022
43230
 
42023
43231
 
42024
43232
 #ifndef Py_PYCONFIG_H
 
43233
@@ -370,6 +370,12 @@
 
43234
 /* Define to 1 if you have the `initgroups' function. */
 
43235
 #undef HAVE_INITGROUPS
 
43236
 
 
43237
+/* Define if your compiler provides int32_t. */
 
43238
+#undef HAVE_INT32_T
 
43239
+
 
43240
+/* Define if your compiler provides int64_t. */
 
43241
+#undef HAVE_INT64_T
 
43242
+
 
43243
 /* Define to 1 if you have the <inttypes.h> header file. */
 
43244
 #undef HAVE_INTTYPES_H
 
43245
 
 
43246
@@ -847,6 +853,12 @@
 
43247
 /* Define this if you have tcl and TCL_UTF_MAX==6 */
 
43248
 #undef HAVE_UCS4_TCL
 
43249
 
 
43250
+/* Define if your compiler provides uint32_t. */
 
43251
+#undef HAVE_UINT32_T
 
43252
+
 
43253
+/* Define if your compiler provides uint64_t. */
 
43254
+#undef HAVE_UINT64_T
 
43255
+
 
43256
 /* Define to 1 if the system has the type `uintptr_t'. */
 
43257
 #undef HAVE_UINTPTR_T
 
43258
 
42025
43259
diff -r 70274d53c1dd setup.py
42026
43260
--- a/setup.py
42027
43261
+++ b/setup.py