Skip to content

Commit 5749575

Browse files
Merge branch 'master' into randrange-index
2 parents 3ad3c36 + 4140f10 commit 5749575

File tree

87 files changed

+2524
-757
lines changed

Some content is hidden

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

87 files changed

+2524
-757
lines changed

.github/CODEOWNERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Objects/frameobject.c @markshannon
1919
Objects/call.c @markshannon
2020
Python/ceval.c @markshannon
2121
Python/compile.c @markshannon
22+
Python/ast_opt.c @isidentical
2223

2324
# Hashing
2425
**/*hashlib* @python/crypto-team @tiran
@@ -84,6 +85,12 @@ Include/pytime.h @pganssle @abalkin
8485
/Lib/test/test_peg_generator/ @pablogsal @lysnikolaou
8586
/Grammar/python.gram @pablogsal @lysnikolaou
8687

88+
# AST
89+
Python/ast.c @isidentical
90+
Parser/asdl.py @isidentical
91+
Parser/asdl_c.py @isidentical
92+
Lib/ast.py @isidentical
93+
8794
# SQLite 3
8895
**/*sqlite* @berkerpeksag
8996

.github/problem-matchers/msvc.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"__comment": "Taken from vscode's vs/workbench/contrib/tasks/common/problemMatcher.ts msCompile rule",
3+
"problemMatcher": [
4+
{
5+
"owner": "msvc-problem-matcher",
6+
"pattern": [
7+
{
8+
"regexp": "^(?:\\s+\\d+\\>)?([^\\s].*)\\((\\d+),?(\\d+)?(?:,\\d+,\\d+)?\\)\\s*:\\s+(error|warning|info)\\s+(\\w{1,2}\\d+)\\s*:\\s*(.*)$",
9+
"file": 1,
10+
"line": 2,
11+
"column": 3,
12+
"severity": 4,
13+
"code": 5,
14+
"message": 6
15+
}
16+
]
17+
}
18+
]
19+
}

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ jobs:
9999
if: needs.check_source.outputs.run_tests == 'true'
100100
steps:
101101
- uses: actions/checkout@v2
102+
- name: Register MSVC problem matcher
103+
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
102104
- name: Build CPython
103105
run: .\PCbuild\build.bat -e -p x64
104106
- name: Display build info

Doc/library/itertools.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,18 @@ which incur interpreter overhead.
786786
def dotproduct(vec1, vec2):
787787
return sum(map(operator.mul, vec1, vec2))
788788

789+
def convolve(signal, kernel):
790+
# See: https://betterexplained.com/articles/intuitive-convolution/
791+
# convolve(data, [0.25, 0.25, 0.25, 0.25]) --> Moving average (blur)
792+
# convolve(data, [1, -1]) --> 1st finite difference (1st derivative)
793+
# convolve(data, [1, -2, 1]) --> 2nd finite difference (2nd derivative)
794+
kernel = list(reversed(kernel))
795+
n = len(kernel)
796+
window = collections.deque([0] * n, maxlen=n)
797+
for x in chain(signal, repeat(0, n-1)):
798+
window.append(x)
799+
yield sum(map(operator.mul, kernel, window))
800+
789801
def flatten(list_of_lists):
790802
"Flatten one level of nesting"
791803
return chain.from_iterable(list_of_lists)

Doc/library/random.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ Functions for integers
145145
or ``randrange('10')`` will be changed from :exc:`ValueError` to
146146
:exc:`TypeError`.
147147

148-
149148
.. function:: randint(a, b)
150149

151150
Return a random integer *N* such that ``a <= N <= b``. Alias for

Doc/library/sqlite3.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ Connection Objects
546546
con.close()
547547

548548

549-
.. method:: backup(target, *, pages=0, progress=None, name="main", sleep=0.250)
549+
.. method:: backup(target, *, pages=-1, progress=None, name="main", sleep=0.250)
550550

551551
This method makes a backup of a SQLite database even while it's being accessed
552552
by other clients, or concurrently by the same connection. The copy will be

Doc/library/subprocess.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,8 +1187,9 @@ calls these functions.
11871187
The arguments shown above are merely some common ones.
11881188
The full function signature is largely the same as that of :func:`run` -
11891189
most arguments are passed directly through to that interface.
1190-
However, explicitly passing ``input=None`` to inherit the parent's
1191-
standard input file handle is not supported.
1190+
One API deviation from :func:`run` behavior exists: passing ``input=None``
1191+
will behave the same as ``input=b''`` (or ``input=''``, depending on other
1192+
arguments) rather than using the parent's standard input file handle.
11921193

11931194
By default, this function will return the data as encoded bytes. The actual
11941195
encoding of the output data may depend on the command being invoked, so the

Doc/library/tkinter.font.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ The different font weights and slants are:
9191

9292
Return the names of defined fonts.
9393

94-
.. function:: nametofont(name)
94+
.. function:: nametofont(name, root=None)
9595

96-
Return a :class:`Font` representation of a tk named font.
96+
Return a :class:`Font` representation of a tk named font.
97+
98+
.. versionchanged:: 3.10
99+
The *root* parameter was added.

Doc/whatsnew/3.9.rst

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1482,4 +1482,37 @@ and to match the behavior of static type checkers specified in the PEP.
14821482
File "<stdin>", line 1, in <module>
14831483
TypeError: unhashable type: 'set'
14841484

1485-
(Contributed by Yurii Karabas in :issue:`42345`.)
1485+
(Contributed by Yurii Karabas in :issue:`42345`.)
1486+
1487+
macOS 11.0 (Big Sur) and Apple Silicon Mac support
1488+
--------------------------------------------------
1489+
1490+
As of 3.9.1, Python now fully supports building and running on macOS 11.0
1491+
(Big Sur) and on Apple Silicon Macs (based on the ``ARM64`` architecture).
1492+
A new universal build variant, ``universal2``, is now available to natively
1493+
support both ``ARM64`` and ``Intel 64`` in one set of executables. Binaries
1494+
can also now be built on current versions of macOS to be deployed on a range
1495+
of older macOS versions (tested to 10.9) while making some newer OS
1496+
functions and options conditionally available based on the operating system
1497+
version in use at runtime ("weaklinking").
1498+
1499+
(Contributed by Ronald Oussoren and Lawrence D'Anna in :issue:`41100`.)
1500+
1501+
Notable changes in Python 3.9.2
1502+
===============================
1503+
1504+
collections.abc
1505+
---------------
1506+
1507+
:class:`collections.abc.Callable` generic now flattens type parameters, similar
1508+
to what :data:`typing.Callable` currently does. This means that
1509+
``collections.abc.Callable[[int, str], str]`` will have ``__args__`` of
1510+
``(int, str, str)``; previously this was ``([int, str], str)``. To allow this
1511+
change, :class:`types.GenericAlias` can now be subclassed, and a subclass will
1512+
be returned when subscripting the :class:`collections.abc.Callable` type.
1513+
Code which accesses the arguments via :func:`typing.get_args` or ``__args__``
1514+
need to account for this change. A :exc:`DeprecationWarning` may be emitted for
1515+
invalid forms of parameterizing :class:`collections.abc.Callable` which may have
1516+
passed silently in Python 3.9.1. This :exc:`DeprecationWarning` will
1517+
become a :exc:`TypeError` in Python 3.10.
1518+
(Contributed by Ken Jin in :issue:`42195`.)

Include/cpython/object.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,13 @@ PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void);
3535
_PyObject_{Get,Set,Has}AttrId are __getattr__ versions using _Py_Identifier*.
3636
*/
3737
typedef struct _Py_Identifier {
38-
struct _Py_Identifier *next;
3938
const char* string;
40-
PyObject *object;
39+
// Index in PyInterpreterState.unicode.ids.array. It is process-wide
40+
// unique and must be initialized to -1.
41+
Py_ssize_t index;
4142
} _Py_Identifier;
4243

43-
#define _Py_static_string_init(value) { .next = NULL, .string = value, .object = NULL }
44+
#define _Py_static_string_init(value) { .string = value, .index = -1 }
4445
#define _Py_static_string(varname, value) static _Py_Identifier varname = _Py_static_string_init(value)
4546
#define _Py_IDENTIFIER(varname) _Py_static_string(PyId_##varname, #varname)
4647

0 commit comments

Comments
 (0)