8000 Merge branch 'master' into rename_internal · python/cpython@fadca69 · GitHub
[go: up one dir, main page]

Skip to content

Commit fadca69

Browse files
committed
Merge branch 'master' into rename_internal
2 parents 6ebd35c + 19c46a4 commit fadca69

Some content is hidden

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

53 files changed

+258
-178
lines changed

Doc/library/collections.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ For example::
225225
.. class:: Counter([iterable-or-mapping])
226226

227227
A :class:`Counter` is a :class:`dict` subclass for counting hashable objects.
228-
It is an unordered collection where elements are stored as dictionary keys
228+
It is a collection where elements are stored as dictionary keys
229229
and their counts are stored as dictionary values. Counts are allowed to be
230230
any integer value including zero or negative counts. The :class:`Counter`
231231
class is similar to bags or multisets in other languages.

Doc/library/idle.rst

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,17 @@ Menus
4040
-----
4141

4242
IDLE has two main window types, the Shell window and the Editor window. It is
43-
possible to have multiple editor windows simultaneously. Output windows, such
44-
as used for Edit / Find in Files, are a subtype of edit window. They currently
45-
have the same top menu as Editor windows but a different default title and
46-
context menu.
43+
possible to have multiple editor windows simultaneously. On Windows and
44+
Linux, each has its own top menu. Each menu documented below indicates
45+
which window type it is associated with.
4746

48-
IDLE's menus dynamically change based on which window is currently selected.
49-
Each menu documented below indicates which window type it is associated with.
47+
Output windows, such as used for Edit => Find in Files, are a subtype of editor
48+
window. They currently have the same top menu but a different
49+
default title and context menu.
50+
51+
On MacOS, there is one application menu. It dynamically changes according
52+
to the window currently selected. It has an IDLE menu, and some entries
53+
described below are moved around to conform to Apple guidlines.
5054

5155
File menu (Shell and Editor)
5256
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -792,6 +796,13 @@ changed via Configure IDLE on the Option menu. Keys can be user defined;
792796
IDLE ships with four built-in key sets. In addition, a user can create a
793797
custom key set in the Configure IDLE dialog under the keys tab.
794798

799+
IDLE on MacOS
800+
^^^^^^^^^^^^^
801+
802+
Under System Preferences: Dock, one can set "Prefer tabs when opening
803+
documents" to "Always". This setting is not compatible with the tk/tkinter
804+
GUI framework used by IDLE, and it breaks a few IDLE features.
805+
795806
Extensions
796807
^^^^^^^^^^
797808

Doc/library/io.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ be used for each of them. A concrete object belonging to any of these
3131
categories is called a :term:`file object`. Other common terms are *stream*
3232
and *file-like object*.
3333

34-
Independently of its category, each concrete stream object will also have
34+
Independent of its category, each concrete stream object will also have
3535
various capabilities: it can be read-only, write-only, or read-write. It can
3636
also allow arbitrary random access (seeking forwards or backwards to any
3737
location), or only sequential access (for example in the case of a socket or

Doc/library/subprocess.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ compatibility with older versions, see the :ref:`call-function-trio` section.
3939

4040
.. function:: run(args, *, stdin=None, input=None, stdout=None, stderr=None,\
4141
capture_output=False, shell=False, cwd=None, timeout=None, \
42-
check=False, encoding=None, errors=None, text=None, env=None)
42+
check=False, encoding=None, errors=None, text=None, env=None, \
43+
universal_newlines=None)
4344

4445
Run the command described by *args*. Wait for command to complete, then
4546
return a :class:`CompletedProcess` instance.
@@ -334,7 +335,7 @@ functions.
334335

335336
.. class:: Popen(args, bufsize=-1, executable=None, stdin=None, stdout=None, \
336337
stderr=None, preexec_fn=None, close_fds=True, shell=False, \
337-
cwd=None, env=None, universal_newlines=False, \
338+
cwd=None, env=None, universal_newlines=None, \
338339
startupinfo=None, creationflags=0, restore_signals=True, \
339340
start_new_session=False, pass_fds=(), *, \
340341
encoding=None, errors=None, text=None)
@@ -1055,7 +1056,7 @@ calls these functions.
10551056

10561057
.. function:: check_output(args, *, stdin=None, stderr=None, shell=False, \
10571058
cwd=None, encoding=None, errors=None, \
1058-
universal_newlines=False, timeout=None)
1059+
universal_newlines=None, timeout=None, text=None)
10591060

10601061
Run command with arguments and return its output.
10611062

@@ -1101,6 +1102,10 @@ calls these functions.
11011102
.. versionchanged:: 3.6
11021103
*encoding* and *errors* were added. See :func:`run` for details.
11031104

1105+
.. versionadded:: 3.7
1106+
*text* was added as a more readable alias for *universal_newlines*.
1107+
1108+
11041109
.. _subprocess-replacements:
11051110

11061111
Replacing Older Functions with the :mod:`subprocess` Module

Doc/library/unittest.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ Distinguishing test iterations using subtests
607607

608608
.. versionadded:: 3.4
609609

610-
When some of your tests differ only by a some very small differences, for
610+
When there are very small differences among your tests, for
611611
instance some parameters, unittest allows you to distinguish them inside
612612
the body of a test method using the :meth:`~TestCase.subTest` context manager.
613613

Doc/reference/compound_stmts.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,11 @@ from a function that handled an exception.
314314
statement: break
315315
statement: continue
316316

317-
The optional :keyword:`else` clause is executed if and when control flows off
318-
the end of the :keyword:`try` clause. [#]_ Exceptions in the :keyword:`else`
319-
clause are not handled by the preceding :keyword:`except` clauses.
317+
The optional :keyword:`else` clause is executed if the control flow leaves the
318+
:keyword:`try` suite, no exception was raised, and no :keyword:`return`,
319+
:keyword:`continue`, or :keyword:`break` statement was executed. Exceptions in
320+
the :keyword:`else` clause are not handled by the preceding :keyword:`except`
321+
clauses.
320322

321323
.. index:: keyword: finally
322324

@@ -847,10 +849,6 @@ body of a coroutine function.
847849
there is a :keyword:`finally` clause which happens to raise another
848850
exception. That new exception causes the old one to be lost.
849851
850-
.. [#] Currently, control "flows off the end" except in the case of an exception
851-
or the execution of a :keyword:`return`, :keyword:`continue`, or
852-
:keyword:`break` statement.
853-
854852
.. [#] A string literal appearing as the first statement in the function body is
855853
transformed into the function's ``__doc__`` attribute and therefore the
856854
function's :term:`docstring`.

Doc/reference/simple_stmts.rst

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,10 @@ given with the definition of the object types (see section :ref:`types`).
121121
Assignment of an object to a target list, optionally enclosed in parentheses or
122122
square brackets, is recursively defined as follows.
123123

124-
* If the target list is empty: The object must also be an empty iterable.
124+
* If the target list is a single target with no trailing comma,
125+
optionally in parentheses, the object is assigned to that target.
125126

126-
* If the target list is a single target in parentheses: The object is assigned
127-
to that target.
128-
129-
* If the target list is a comma-separated list of targets, or a single target
130-
in square brackets: The object must be an iterable with the same number of
127+
* Else: The object must be an iterable with the same number of
131128
items as there are targets in the target list, and the items are assigned,
132129
from left to right, to the corresponding targets.
133130

Doc/whatsnew/3.8.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,14 @@ Optimizations
277277
See :ref:`shutil-platform-dependent-efficient-copy-operations` section.
278278
(Contributed by Giampaolo Rodola' in :issue:`25427`.)
279279

280+
* :func:`shutil.copytree` uses :func:`os.scandir` function and all copy
281+
functions depending from it use cached :func:`os.stat` values. The speedup
282+
for copying a directory with 8000 files is around +9% on Linux, +20% on
283+
Windows and +30% on a Windows SMB share. Also the number of :func:`os.stat`
284+
syscalls is reduced by 38% making :func:`shutil.copytree` especially faster
285+
on network filesystems. (Contributed by Giampaolo Rodola' in :issue:`33695`.)
286+
287+
280288
* The default protocol in the :mod:`pickle` module is now Protocol 4,
281289
first introduced in Python 3.4. It offers better performance and smaller
282290
size compared to Protocol 3 available since Python 3.0.

Include/Python-ast.h

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/ast.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
extern "C" {
55
#endif
66

7+
#include "Python-ast.h" /* mod_ty */
8+
#include "node.h" /* node */
9+
710
PyAPI_FUNC(int) PyAST_Validate(mod_ty);
811
PyAPI_FUNC(mod_ty) PyAST_FromNode(
912
const node *n,

Include/parsetok.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
21
/* Parser-tokenizer link interface */
2+
33
#ifndef Py_LIMITED_API
44
#ifndef Py_PARSETOK_H
55
#define Py_PARSETOK_H
66
#ifdef __cplusplus
77
extern "C" {
88
#endif
99

10+
#include "grammar.h" /* grammar */
11+
#include "node.h" /* node */
12+
1013
typedef struct {
1114
int error;
1215
#ifndef PGEN

Include/symtable.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#ifndef Py_LIMITED_API
22
#ifndef Py_SYMTABLE_H
33
#define Py_SYMTABLE_H
4-
54
#ifdef __cplusplus
65
extern "C" {
76
#endif
87

8+
#include "Python-ast.h" /* mod_ty */
9+
910
/* XXX(ncoghlan): This is a weird mix of public names and interpreter internal
1011
* names.
1112
*/
@@ -115,4 +116,4 @@ PyAPI_FUNC(void) PySymtable_Free(struct symtable *);
115116
}
116117
#endif
117118
#endif /* !Py_SYMTABLE_H */
118-
#endif /* Py_LIMITED_API */
119+
#endif /* !Py_LIMITED_API */

Include/tupleobject.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *);
5858
#define PyTuple_GET_ITEM(op, i) (((PyTupleObject *)(op))->ob_item[i])
5959
#define PyTuple_GET_SIZE(op) (assert(PyTuple_Check(op)),Py_SIZE(op))
6060

61+
#ifdef Py_BUILD_CORE
62+
# define _PyTuple_ITEMS(op) ((((PyTupleObject *)(op))->ob_item))
63+
#endif
64+
6165
/* Macro, *only* to be used to fill in brand new tuples */
6266
#define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)
6367
#endif

Lib/idlelib/codecontext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from sys import maxsize as INFINITY
1414

1515
import tkinter
16-
from tkinter.constants import TOP, LEFT, X, W, SUNKEN
16+
from tkinter.constants import TOP, X, SUNKEN
1717

1818
from idlelib.config import idleConf
1919

Lib/idlelib/filelist.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ def _test(): # TODO check and convert to htest
115115
from tkinter import Tk
116116
from idlelib.editor import fixwordbreaks
117117
from idlelib.run import fix_scaling
118-
import sys
119118
root = Tk()
120119
fix_scaling(root)
121120
fixwordbreaks(root)

Lib/idlelib/help.html

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,15 @@ <h3>Navigation</h3>
122122
<div class="section" id="menus">
123123
<h2>Menus<a class="headerlink" href="#menus" title="Permalink to this headline"></a></h2>
124124
<p>IDLE has two main window types, the Shell window and the Editor window. It is
125-
possible to have multiple editor windows simultaneously. Output windows, such
126-
as used for Edit / Find in Files, are a subtype of edit window. They currently
127-
have the same top menu as Editor windows but a different default title and
128-
context menu.</p>
129-
<p>IDLE’s menus dynamically change based on which window is currently selected.
130-
Each menu documented below indicates which window type it is associated with.</p>
125+
possible to have multiple editor windows simultaneously. On Windows and
126+
Linux, each has its own top menu. Each menu documented below indicates
127+
which window type it is associated with.</p>
128+
<p>Output windows, such as used for Edit =&gt; Find in Files, are a subtype of editor
129+
window. They currently have the same top menu but a different
130+
default title and context menu.</p>
131+
<p>On MacOS, there is one application menu. It dynamically changes according
132+
to the window currently selected. It has an IDLE menu, and some entries
133+
described below are moved around to conform to Apple guidlines.</p>
131134
<div class="section" id="file-menu-shell-and-editor">
132135
<h3>File menu (Shell and Editor)<a class="headerlink" href="#file-menu-shell-and-editor" title="Permalink to this headline"></a></h3>
133136
<dl class="docutils">
@@ -753,6 +756,12 @@ <h3>Setting preferences<a class="headerlink" href="#setting-preferences" title="
753756
IDLE ships with four built-in key sets. In addition, a user can create a
754757
custom key set in the Configure IDLE dialog under the keys tab.</p>
755758
</div>
759+
<div class="section" id="idle-on-macos">
760+
<h3>IDLE on MacOS<a class="headerlink" href="#idle-on-macos" title="Permalink to this headline"></a></h3>
761+
<p>Under System Preferences: Dock, one can set “Prefer tabs when opening
762+
documents” to “Always”. This setting is not compatible with the tk/tkinter
763+
GUI framework used by IDLE, and it breaks a few IDLE features.</p>
764+
</div>
756765
<div class="section" id="extensions">
757766
<h3>Extensions<a class="headerlink" href="#extensions" title="Permalink to this headline"></a></h3>
758767
<p>IDLE contains an extension facility. Preferences for extensions can be
@@ -808,6 +817,7 @@ <h3><a href="../contents.html">Table of Contents</a></h3>
808817
<li><a class="reference internal" href="#help-and-preferences">Help and preferences</a><ul>
809818
<li><a class="reference internal" href="#help-sources">Help sources</a></li>
810819
<li><a class="reference internal" href="#setting-preferences">Setting preferences</a></li>
820+
<li><a class="reference internal" href="#idle-on-macos">IDLE on MacOS</a></li>
811821
<li><a class="reference internal" href="#extensions">Extensions</a></li>
812822
</ul>
813823
</li>
@@ -889,7 +899,7 @@ <h3>Navigation</h3>
889899
<br />
890900
<br />
891901

892-
Last updated on Nov 06, 2018.
902+
Last updated on Nov 10, 2018.
893903
<a href="https://docs.python.org/3/bugs.html">Found a bug</a>?
894904
<br />
895905

Lib/idlelib/idle_test/test_config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
Much of IdleConf is also exercised by ConfigDialog and test_configdialog.
55
"""
66
from idlelib import config
7-
import copy
87
import sys
98
import os
109
import tempfile

Lib/idlelib/idle_test/test_config_key.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from idlelib import config_key
44
from test.support import requires
5-
import sys
65
import unittest
76
from tkinter import Tk
87
from idlelib.idle_test.mock_idle import Func

Lib/idlelib/idle_test/test_rpc.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from idlelib import rpc
44
import unittest
55

6-
import marshal
76

87

98
class CodePicklerTest(unittest.TestCase):

Lib/idlelib/pyparse.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
_chew_ordinaryre - non-special characters.
1212
"""
1313
import re
14-
import sys
1514

1615
# Reason last statement is continued (or C_NONE if it's not).
1716
(C_NONE, C_BACKSLASH, C_STRING_FIRST_LINE,

Lib/lib2to3/pgen2/driver.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
__all__ = ["Driver", "load_grammar"]
1717

1818
# Python imports
19-
import codecs
2019
import io
2120
import os
2221
import logging

Lib/lib2to3/pgen2/grammar.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"""
1414

1515
# Python imports
16-
import collections
1716
import pickle
1817

1918
# Local imports

Lib/multiprocessing/popen_fork.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import os
2-
import sys
32
import signal
43

54
from . import util

0 commit comments

Comments
 (0)
0