Skip to content

Commit 60aee01

Browse files
Merge branch 'master' into cgi-max-num-fields
2 parents 7668322 + fc8205c commit 60aee01

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+155
-110
lines changed

.azure-pipelines/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ jobs:
116116
condition: and(succeeded(), eq(dependencies.Prebuild.outputs['tests.run'], 'true'))
117117

118118
pool:
119-
vmImage: vs2017-win2017
119+
vmImage: vs2017-win2016
120120

121121
strategy:
122122
matrix:

.azure-pipelines/pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
condition: and(succeeded(), eq(dependencies.Prebuild.outputs['tests.run'], 'true'))
6565

6666
pool:
67-
vmImage: vs2017-win2017
67+
vmImage: vs2017-win2016
6868

6969
strategy:
7070
matrix:

Doc/library/datetime.rst

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ Other constructors, all class methods:
841841
Return a :class:`datetime` corresponding to a *date_string* in one of the
842842
formats emitted by :meth:`date.isoformat` and :meth:`datetime.isoformat`.
843843
Specifically, this function supports strings in the format(s)
844-
``YYYY-MM-DD[*HH[:MM[:SS[.mmm[mmm]]]][+HH:MM[:SS[.ffffff]]]]``,
844+
``YYYY-MM-DD[*HH[:MM[:SS[.fff[fff]]]][+HH:MM[:SS[.ffffff]]]]``,
845845
where ``*`` can match any single character.
846846

847847
.. caution::
@@ -1215,13 +1215,13 @@ Instance methods:
12151215
.. method:: datetime.isoformat(sep='T', timespec='auto')
12161216

12171217
Return a string representing the date and time in ISO 8601 format,
1218-
YYYY-MM-DDTHH:MM:SS.mmmmmm or, if :attr:`microsecond` is 0,
1218+
YYYY-MM-DDTHH:MM:SS.ffffff or, if :attr:`microsecond` is 0,
12191219
YYYY-MM-DDTHH:MM:SS
12201220

1221-
If :meth:`utcoffset` does not return ``None``, a 6-character string is
1222-
appended, giving the UTC offset in (signed) hours and minutes:
1223-
YYYY-MM-DDTHH:MM:SS.mmmmmm+HH:MM or, if :attr:`microsecond` is 0
1224-
YYYY-MM-DDTHH:MM:SS+HH:MM
1221+
If :meth:`utcoffset` does not return ``None``, a string is
1222+
appended, giving the UTC offset:
1223+
YYYY-MM-DDTHH:MM:SS.ffffff+HH:MM[:SS[.ffffff]] or, if :attr:`microsecond`
1224+
is 0 YYYY-MM-DDTHH:MM:SS+HH:MM[:SS[.ffffff]].
12251225

12261226
The optional argument *sep* (default ``'T'``) is a one-character separator,
12271227
placed between the date and time portions of the result. For example,
@@ -1245,7 +1245,7 @@ Instance methods:
12451245
in HH:MM:SS format.
12461246
- ``'milliseconds'``: Include full time, but truncate fractional second
12471247
part to milliseconds. HH:MM:SS.sss format.
1248-
- ``'microseconds'``: Include full time in HH:MM:SS.mmmmmm format.
1248+
- ``'microseconds'``: Include full time in HH:MM:SS.ffffff format.
12491249

12501250
.. note::
12511251

@@ -1522,7 +1522,7 @@ Other constructor:
15221522

15231523
Return a :class:`time` corresponding to a *time_string* in one of the
15241524
formats emitted by :meth:`time.isoformat`. Specifically, this function supports
1525-
strings in the format(s) ``HH[:MM[:SS[.mmm[mmm]]]][+HH:MM[:SS[.ffffff]]]``.
1525+
strings in the format(s) ``HH[:MM[:SS[.fff[fff]]]][+HH:MM[:SS[.ffffff]]]``.
15261526

15271527
.. caution::
15281528

@@ -1548,10 +1548,10 @@ Instance methods:
15481548

15491549
.. method:: time.isoformat(timespec='auto')
15501550

1551-
Return a string representing the time in ISO 8601 format, HH:MM:SS.mmmmmm or, if
1551+
Return a string representing the time in ISO 8601 format, HH:MM:SS.ffffff or, if
15521552
:attr:`microsecond` is 0, HH:MM:SS If :meth:`utcoffset` does not return ``None``, a
1553-
6-character string is appended, giving the UTC offset in (signed) hours and
1554-
minutes: HH:MM:SS.mmmmmm+HH:MM or, if self.microsecond is 0, HH:MM:SS+HH:MM
1553+
string is appended, giving the UTC offset: HH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]
1554+
or, if self.microsecond is 0, HH:MM:SS+HH:MM[:SS[.ffffff]].
15551555

15561556
The optional argument *timespec* specifies the number of additional
15571557
components of the time to include (the default is ``'auto'``).
@@ -1565,7 +1565,7 @@ Instance methods:
15651565
in HH:MM:SS format.
15661566
- ``'milliseconds'``: Include full time, but truncate fractional second
15671567
part to milliseconds. HH:MM:SS.sss format.
1568-
- ``'microseconds'``: Include full time in HH:MM:SS.mmmmmm format.
1568+
- ``'microseconds'``: Include full time in HH:MM:SS.ffffff format.
15691569

15701570
.. note::
15711571

@@ -2091,9 +2091,10 @@ format codes.
20912091
| | number, zero-padded on the | 999999 | |
20922092
| | left. | | |
20932093
+-----------+--------------------------------+------------------------+-------+
2094-
| ``%z`` | UTC offset in the form | (empty), +0000, -0400, | \(6) |
2095-
| | ±HHMM[SS] (empty string if the | +1030 | |
2096-
| | object is naive). | | |
2094+
| ``%z`` | UTC offset in the form | (empty), +0000, | \(6) |
2095+
| | ±HHMM[SS[.ffffff]] (empty | -0400, +1030, | |
2096+
| | string if the object is | +063415, | |
2097+
| | naive). | -030712.345216 | |
20972098
+-----------+--------------------------------+------------------------+-------+
20982099
| ``%Z`` | Time zone name (empty string | (empty), UTC, EST, CST | |
20992100
| | if the object is naive). | | |
@@ -2206,12 +2207,12 @@ Notes:
22062207

22072208
``%z``
22082209
:meth:`utcoffset` is transformed into a string of the form
2209-
±HHMM[SS[.uuuuuu]], where HH is a 2-digit string giving the number of UTC
2210-
offset hours, and MM is a 2-digit string giving the number of UTC offset
2210+
±HHMM[SS[.ffffff]], where HH is a 2-digit string giving the number of UTC
2211+
offset hours, MM is a 2-digit string giving the number of UTC offset
22112212
minutes, SS is a 2-digit string giving the number of UTC offset
2212-
seconds and uuuuuu is a 2-digit string giving the number of UTC
2213-
offset microseconds. The uuuuuu part is omitted when the offset is a
2214-
whole number of minutes and both the uuuuuu and the SS parts are omitted
2213+
seconds and ffffff is a 6-digit string giving the number of UTC
2214+
offset microseconds. The ffffff part is omitted when the offset is a
2215+
whole number of seconds and both the ffffff and the SS part is omitted
22152216
when the offset is a whole number of minutes. For example, if
22162217
:meth:`utcoffset` returns ``timedelta(hours=-3, minutes=-30)``, ``%z`` is
22172218
replaced with the string ``'-0330'``.

Doc/library/re.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ The special characters are:
204204
Standard #18`_ might be added in the future. This would change the
205205
syntax, so to facilitate this change a :exc:`FutureWarning` will be raised
206206
in ambiguous cases for the time being.
207-
That include sets starting with a literal ``'['`` or containing literal
207+
That includes sets starting with a literal ``'['`` or containing literal
208208
character sequences ``'--'``, ``'&&'``, ``'~~'``, and ``'||'``. To
209209
avoid a warning escape them with a backslash.
210210

Doc/library/stdtypes.rst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,8 +1700,19 @@ expression support in the :mod:`re` module).
17001700
Return true if the string is a valid identifier according to the language
17011701
definition, section :ref:`identifiers`.
17021702

1703-
Use :func:`keyword.iskeyword` to test for reserved identifiers such as
1704-
:keyword:`def` and :keyword:`class`.
1703+
Call :func:`keyword.iskeyword` to test whether string ``s`` is a reserved
1704+
identifier, such as :keyword:`def` and :keyword:`class`.
1705+
1706+
Example:
1707+
::
1708+
1709+
>>> from keyword import iskeyword
1710+
1711+
>>> 'hello'.isidentifier(), iskeyword('hello')
1712+
True, False
1713+
>>> 'def'.isidentifier(), iskeyword('def')
1714+
True, True
1715+
17051716

17061717
.. method:: str.islower()
17071718

Doc/library/sys.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ always available.
345345
:const:`debug` :option:`-d`
346346
:const:`inspect` :option:`-i`
347347
:const:`interactive` :option:`-i`
348+
:const:`isolated` :option:`-I`
348349
:const:`optimize` :option:`-O` or :option:`-OO`
349350
:const:`dont_write_bytecode` :option:`-B`
350351
:const:`no_user_site` :option:`-s`
@@ -367,6 +368,9 @@ always available.
367368
.. versionchanged:: 3.3
368369
Removed obsolete ``division_warning`` attribute.
369370

371+
.. versionchanged:: 3.4
372+
Added ``isolated`` attribute for :option:`-I` ``isolated`` flag.
373+
370374
.. versionchanged:: 3.7
371375
Added ``dev_mode`` attribute for the new :option:`-X` ``dev`` flag
372376
and ``utf8_mode`` attribute for the new :option:`-X` ``utf8`` flag.

Doc/whatsnew/3.3.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ The launcher can also be used explicitly from the command line as the ``py``
303303
application. Running ``py`` follows the same version selection rules as
304304
implicitly launching scripts, but a more specific version can be selected
305305
by passing appropriate arguments (such as ``-3`` to request Python 3 when
306-
Python 2 is also installed, or ``-2.6`` to specifclly request an earlier
306+
Python 2 is also installed, or ``-2.6`` to specifically request an earlier
307307
Python version when a more recent version is installed).
308308

309309
In addition to the launcher, the Windows installer now includes an
@@ -2386,7 +2386,7 @@ Porting Python code
23862386
finder, you will need to remove keys paired with values of ``None`` **and**
23872387
:class:`imp.NullImporter` to be backwards-compatible. This will lead to extra
23882388
overhead on older versions of Python that re-insert ``None`` into
2389-
:attr:`sys.path_importer_cache` where it repesents the use of implicit
2389+
:attr:`sys.path_importer_cache` where it represents the use of implicit
23902390
finders, but semantically it should not change anything.
23912391

23922392
* :class:`importlib.abc.Finder` no longer specifies a `find_module()` abstract

Doc/whatsnew/3.5.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2471,7 +2471,7 @@ Changes in the Python API
24712471
parameter to help control the ``opt-`` tag. Because of this, the
24722472
*debug_override* parameter of the function is now deprecated. `.pyo` files
24732473
are also no longer supported as a file argument to the Python interpreter and
2474-
thus serve no purpose when distributed on their own (i.e. sourcless code
2474+
thus serve no purpose when distributed on their own (i.e. sourceless code
24752475
distribution). Due to the fact that the magic number for bytecode has changed
24762476
in Python 3.5, all old `.pyo` files from previous versions of Python are
24772477
invalid regardless of this PEP.

Doc/whatsnew/3.7.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,7 @@ feature. Instances must be created with :class:`~ssl.SSLContext` methods
13551355
OpenSSL 1.1 APIs for setting the minimum and maximum TLS protocol version are
13561356
available as :attr:`SSLContext.minimum_version <ssl.SSLContext.minimum_version>`
13571357
and :attr:`SSLContext.maximum_version <ssl.SSLContext.maximum_version>`.
1358-
Supported protocols are indicated by serveral new flags, such as
1358+
Supported protocols are indicated by several new flags, such as
13591359
:data:`~ssl.HAS_TLSv1_1`.
13601360
(Contributed by Christian Heimes in :issue:`32609`.)
13611361

@@ -2023,7 +2023,7 @@ Use :mod:`threading` instead.
20232023
socket
20242024
------
20252025

2026-
The silent argument value trunctation in :func:`socket.htons` and
2026+
The silent argument value truncation in :func:`socket.htons` and
20272027
:func:`socket.ntohs` has been deprecated. In future versions of Python,
20282028
if the passed argument is larger than 16 bits, an exception will be raised.
20292029
(Contributed by Oren Milman in :issue:`28332`.)

Lib/ctypes/test/test_win32.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class S(Structure):
6868
for i, f in enumerate(fields):
6969
value = getattr(res, f[0])
7070
expected = bytes([ord('a') + i])
71-
self.assertEquals(value, expected)
71+
self.assertEqual(value, expected)
7272

7373

7474

Lib/enum.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ def _find_data_type(bases):
486486
if base is object:
487487
continue
488488
elif '__new__' in base.__dict__:
489-
if issubclass(base, Enum) and not hasattr(base, '__new_member__'):
489+
if issubclass(base, Enum):
490490
continue
491491
return base
492492

@@ -499,7 +499,6 @@ def _find_data_type(bases):
499499
member_type = _find_data_type(bases) or object
500500
if first_enum._member_names_:
501501
raise TypeError("Cannot extend enumerations")
502-
503502
return member_type, first_enum
504503

505504
@staticmethod
@@ -545,7 +544,6 @@ def _find_new_(classdict, member_type, first_enum):
545544
use_args = False
546545
else:
547546
use_args = True
548-
549547
return __new__, save_new, use_args
550548

551549

Lib/idlelib/NEWS.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ To see the example in action, enable it on options extensions tab.
222222

223223
bpo-31421: Document how IDLE runs tkinter programs.
224224
IDLE calls tcl/tk update in the background in order to make live
225-
interaction and experimentatin with tkinter applications much easier.
225+
interaction and experimentation with tkinter applications much easier.
226226

227227
bpo-31414: Fix tk entry box tests by deleting first.
228228
Adding to an int entry is not the same as deleting and inserting
@@ -460,7 +460,7 @@ Released on 2016-12-23
460460
-w option but without -jn. Fix warning from test_config.
461461

462462
- Issue #27621: Put query response validation error messages in the query
463-
box itself instead of in a separate massagebox. Redo tests to match.
463+
box itself instead of in a separate messagebox. Redo tests to match.
464464
Add Mac OSX refinements. Original patch by Mark Roseman.
465465

466466
- Issue #27620: Escape key now closes Query box as cancelled.
@@ -526,7 +526,7 @@ Released on 2016-12-23
526526

527527
- Issue #27239: idlelib.macosx.isXyzTk functions initialize as needed.
528528

529-
- Issue #27262: move Aqua unbinding code, which enable context menus, to maxosx.
529+
- Issue #27262: move Aqua unbinding code, which enable context menus, to macosx.
530530

531531
- Issue #24759: Make clear in idlelib.idle_test.__init__ that the directory
532532
is a private implementation of test.test_idle and tool for maintainers.

Lib/sre_compile.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def _compile(code, pattern, flags):
8080
tolower = None
8181
fixes = None
8282
if flags & SRE_FLAG_IGNORECASE and not flags & SRE_FLAG_LOCALE:
83-
if flags & SRE_FLAG_UNICODE and not flags & SRE_FLAG_ASCII:
83+
if flags & SRE_FLAG_UNICODE:
8484
iscased = _sre.unicode_iscased
8585
tolower = _sre.unicode_tolower
8686
fixes = _ignorecase_fixes
@@ -196,7 +196,7 @@ def _compile(code, pattern, flags):
196196
av = AT_MULTILINE.get(av, av)
197197
if flags & SRE_FLAG_LOCALE:
198198
av = AT_LOCALE.get(av, av)
199-
elif (flags & SRE_FLAG_UNICODE) and not (flags & SRE_FLAG_ASCII):
199+
elif flags & SRE_FLAG_UNICODE:
200200
av = AT_UNICODE.get(av, av)
201201
emit(av)
202202
elif op is BRANCH:
@@ -217,7 +217,7 @@ def _compile(code, pattern, flags):
217217
emit(op)
218218
if flags & SRE_FLAG_LOCALE:
219219
av = CH_LOCALE[av]
220-
elif (flags & SRE_FLAG_UNICODE) and not (flags & SRE_FLAG_ASCII):
220+
elif flags & SRE_FLAG_UNICODE:
221221
av = CH_UNICODE[av]
222222
emit(av)
223223
elif op is GROUPREF:
@@ -265,7 +265,7 @@ def _compile_charset(charset, flags, code):
265265
elif op is CATEGORY:
266266
if flags & SRE_FLAG_LOCALE:
267267
emit(CH_LOCALE[av])
268-
elif (flags & SRE_FLAG_UNICODE) and not (flags & SRE_FLAG_ASCII):
268+
elif flags & SRE_FLAG_UNICODE:
269269
emit(CH_UNICODE[av])
270270
else:
271271
emit(av)
@@ -453,7 +453,7 @@ def _generate_overlap_table(prefix):
453453
def _get_iscased(flags):
454454
if not flags & SRE_FLAG_IGNORECASE:
455455
return None
456-
elif flags & SRE_FLAG_UNICODE and not flags & SRE_FLAG_ASCII:
456+
elif flags & SRE_FLAG_UNICODE:
457457
return _sre.unicode_iscased
458458
else:
459459
return _sre.ascii_iscased

Lib/test/test_enum.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,6 +1842,27 @@ class ReformedColor(StrMixin, IntEnum, SomeEnum, AnotherEnum):
18421842
self.assertEqual(ConfusedColor.RED.social(), "what's up?")
18431843
self.assertTrue(issubclass(ReformedColor, int))
18441844

1845+
def test_multiple_inherited_mixin(self):
1846+
class StrEnum(str, Enum):
1847+
def __new__(cls, *args, **kwargs):
1848+
for a in args:
1849+
if not isinstance(a, str):
1850+
raise TypeError("Enumeration '%s' (%s) is not"
1851+
" a string" % (a, type(a).__name__))
1852+
return str.__new__(cls, *args, **kwargs)
1853+
@unique
1854+
class Decision1(StrEnum):
1855+
REVERT = "REVERT"
1856+
REVERT_ALL = "REVERT_ALL"
1857+
RETRY = "RETRY"
1858+
class MyEnum(StrEnum):
1859+
pass
1860+
@unique
1861+
class Decision2(MyEnum):
1862+
REVERT = "REVERT"
1863+
REVERT_ALL = "REVERT_ALL"
1864+
RETRY = "RETRY"
1865+
18451866

18461867
class TestOrder(unittest.TestCase):
18471868

Lib/test/test_grammar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ def g(): f((yield from ()))
989989
def g(): f((yield from ()), 1)
990990
# Do not require parenthesis for tuple unpacking
991991
def g(): rest = 4, 5, 6; yield 1, 2, 3, *rest
992-
self.assertEquals(list(g()), [(1, 2, 3, 4, 5, 6)])
992+
self.assertEqual(list(g()), [(1, 2, 3, 4, 5, 6)])
993993
check_syntax_error(self, "def g(): f(yield 1)")
994994
check_syntax_error(self, "def g(): f(yield 1, 1)")
995995
check_syntax_error(self, "def g(): f(yield from ())")

0 commit comments

Comments
 (0)