Skip to content

Commit 9700dd1

Browse files
committed
Merge branch 'main' into pythongh-77609-glob-follow-symlinks
2 parents 3722b64 + ae00b81 commit 9700dd1

File tree

583 files changed

+20975
-30268
lines changed

Some content is hidden

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

583 files changed

+20975
-30268
lines changed

Diff for: .github/CODEOWNERS

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ configure* @erlend-aasland @corona10
2222
**/*hamt* @1st1
2323
Objects/set* @rhettinger
2424
Objects/dict* @methane @markshannon
25+
Objects/typevarobject.c @JelleZijlstra
2526
Objects/type* @markshannon
2627
Objects/codeobject.c @markshannon
2728
Objects/frameobject.c @markshannon
@@ -33,6 +34,7 @@ Python/flowgraph.c @markshannon @iritkatriel
3334
Python/ast_opt.c @isidentical
3435
Lib/test/test_patma.py @brandtbucher
3536
Lib/test/test_peepholer.py @brandtbucher
37+
Lib/test/test_type_*.py @JelleZijlstra
3638

3739
# Exceptions
3840
Lib/traceback.py @iritkatriel
@@ -95,6 +97,8 @@ Include/pytime.h @pganssle @abalkin
9597
/Tools/peg_generator/ @pablogsal @lysnikolaou
9698
/Lib/test/test_peg_generator/ @pablogsal @lysnikolaou
9799
/Grammar/python.gram @pablogsal @lysnikolaou
100+
/Lib/tokenize.py @pablogsal @lysnikolaou
101+
/Lib/test/test_tokenize.py @pablogsal @lysnikolaou
98102

99103
# AST
100104
Python/ast.c @isidentical

Diff for: .github/workflows/build.yml

+15
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
push:
99
branches:
1010
- 'main'
11+
- '3.12'
1112
- '3.11'
1213
- '3.10'
1314
- '3.9'
@@ -16,6 +17,7 @@ on:
1617
pull_request:
1718
branches:
1819
- 'main'
20+
- '3.12'
1921
- '3.11'
2022
- '3.10'
2123
- '3.9'
@@ -368,6 +370,14 @@ jobs:
368370
echo "HYPOVENV=${VENV_LOC}" >> $GITHUB_ENV
369371
echo "VENV_PYTHON=${VENV_PYTHON}" >> $GITHUB_ENV
370372
./python -m venv $VENV_LOC && $VENV_PYTHON -m pip install -U hypothesis
373+
- name: 'Restore Hypothesis database'
374+
id: cache-hypothesis-database
375+
uses: actions/cache@v3
376+
with:
377+
path: ./hypothesis
378+
key: hypothesis-database-${{ github.head_ref || github.run_id }}
379+
restore-keys: |
380+
- hypothesis-database-
371381
- name: "Run tests"
372382
working-directory: ${{ env.CPYTHON_BUILDDIR }}
373383
run: |
@@ -388,6 +398,11 @@ jobs:
388398
-x test_subprocess \
389399
-x test_signal \
390400
-x test_sysconfig
401+
- uses: actions/upload-artifact@v3
402+
if: always()
403+
with:
404+
name: hypothesis-example-db
405+
path: .hypothesis/examples/
391406

392407

393408
build_asan:

Diff for: .github/workflows/doc.yml

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
#push:
66
# branches:
77
# - 'main'
8+
# - '3.12'
89
# - '3.11'
910
# - '3.10'
1011
# - '3.9'
@@ -15,6 +16,7 @@ on:
1516
pull_request:
1617
branches:
1718
- 'main'
19+
- '3.12'
1820
- '3.11'
1921
- '3.10'
2022
- '3.9'

Diff for: .gitignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
*.gc??
2424
*.profclang?
2525
*.profraw
26+
# Copies of binaries before BOLT optimizations.
27+
*.prebolt
28+
# BOLT profile data.
29+
*.fdata
2630
*.dyn
2731
.gdb_history
2832
.purify
@@ -57,7 +61,6 @@ Doc/.venv/
5761
Doc/env/
5862
Doc/.env/
5963
Include/pydtrace_probes.h
60-
Lib/lib2to3/*.pickle
6164
Lib/site-packages/*
6265
!Lib/site-packages/README.txt
6366
Lib/test/data/*
@@ -124,6 +127,7 @@ Tools/unicode/data/
124127
/platform
125128
/profile-clean-stamp
126129
/profile-run-stamp
130+
/profile-bolt-stamp
127131
/Python/deepfreeze/*.c
128132
/pybuilddir.txt
129133
/pyconfig.h

Diff for: Doc/c-api/frame.rst

+35
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,38 @@ See also :ref:`Reflection <reflection>`.
130130
.. c:function:: int PyFrame_GetLineNumber(PyFrameObject *frame)
131131
132132
Return the line number that *frame* is currently executing.
133+
134+
135+
136+
Internal Frames
137+
---------------
138+
139+
Unless using :pep:`523`, you will not need this.
140+
141+
.. c:struct:: _PyInterpreterFrame
142+
143+
The interpreter's internal frame representation.
144+
145+
.. versionadded:: 3.11
146+
147+
.. c:function:: PyObject* PyUnstable_InterpreterFrame_GetCode(struct _PyInterpreterFrame *frame);
148+
149+
Return a :term:`strong reference` to the code object for the frame.
150+
151+
.. versionadded:: 3.12
152+
153+
154+
.. c:function:: int PyUnstable_InterpreterFrame_GetLasti(struct _PyInterpreterFrame *frame);
155+
156+
Return the byte offset into the last executed instruction.
157+
158+
.. versionadded:: 3.12
159+
160+
161+
.. c:function:: int PyUnstable_InterpreterFrame_GetLine(struct _PyInterpreterFrame *frame);
162+
163+
Return the currently executing line number, or -1 if there is no line number.
164+
165+
.. versionadded:: 3.12
166+
167+

Diff for: Doc/c-api/long.rst

+24
Original file line numberDiff line numberDiff line change
@@ -322,3 +322,27 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
322322
with :c:func:`PyLong_FromVoidPtr`.
323323
324324
Returns ``NULL`` on error. Use :c:func:`PyErr_Occurred` to disambiguate.
325+
326+
327+
.. c:function:: int PyUnstable_Long_IsCompact(const PyLongObject* op)
328+
329+
Return 1 if *op* is compact, 0 otherwise.
330+
331+
This function makes it possible for performance-critical code to implement
332+
a “fast path” for small integers. For compact values use
333+
:c:func:`PyUnstable_Long_CompactValue`; for others fall back to a
334+
:c:func:`PyLong_As* <PyLong_AsSize_t>` function or
335+
:c:func:`calling <PyObject_CallMethod>` :meth:`int.to_bytes`.
336+
337+
The speedup is expected to be negligible for most users.
338+
339+
Exactly what values are considered compact is an implementation detail
340+
and is subject to change.
341+
342+
.. c:function:: Py_ssize_t PyUnstable_Long_CompactValue(const PyLongObject* op)
343+
344+
If *op* is compact, as determined by :c:func:`PyUnstable_Long_IsCompact`,
345+
return its value.
346+
347+
Otherwise, the return value is undefined.
348+

Diff for: Doc/c-api/perfmaps.rst

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
.. highlight:: c
2+
3+
.. _perfmaps:
4+
5+
Support for Perf Maps
6+
----------------------
7+
8+
On supported platforms (as of this writing, only Linux), the runtime can take
9+
advantage of *perf map files* to make Python functions visible to an external
10+
profiling tool (such as `perf <https://perf.wiki.kernel.org/index.php/Main_Page>`_).
11+
A running process may create a file in the ``/tmp`` directory, which contains entries
12+
that can map a section of executable code to a name. This interface is described in the
13+
`documentation of the Linux Perf tool <https://git.kernel.org/pub/scm/linux/
14+
kernel/git/torvalds/linux.git/tree/tools/perf/Documentation/jit-interface.txt>`_.
15+
16+
In Python, these helper APIs can be used by libraries and features that rely
17+
on generating machine code on the fly.
18+
19+
Note that holding the Global Interpreter Lock (GIL) is not required for these APIs.
20+
21+
.. c:function:: int PyUnstable_PerfMapState_Init(void)
22+
23+
Open the ``/tmp/perf-$pid.map`` file, unless it's already opened, and create
24+
a lock to ensure thread-safe writes to the file (provided the writes are
25+
done through :c:func:`PyUnstable_WritePerfMapEntry`). Normally, there's no need
26+
to call this explicitly; just use :c:func:`PyUnstable_WritePerfMapEntry`
27+
and it will initialize the state on first call.
28+
29+
Returns ``0`` on success, ``-1`` on failure to create/open the perf map file,
30+
or ``-2`` on failure to create a lock. Check ``errno`` for more information
31+
about the cause of a failure.
32+
33+
.. c:function:: int PyUnstable_WritePerfMapEntry(const void *code_addr, unsigned int code_size, const char *entry_name)
34+
35+
Write one single entry to the ``/tmp/perf-$pid.map`` file. This function is
36+
thread safe. Here is what an example entry looks like::
37+
38+
# address size name
39+
7f3529fcf759 b py::bar:/run/t.py
40+
41+
Will call :c:func:`PyUnstable_PerfMapState_Init` before writing the entry, if
42+
the perf map file is not already opened. Returns ``0`` on success, or the
43+
same error codes as :c:func:`PyUnstable_PerfMapState_Init` on failure.
44+
45+
.. c:function:: void PyUnstable_PerfMapState_Fini(void)
46+
47+
Close the perf map file opened by :c:func:`PyUnstable_PerfMapState_Init`.
48+
This is called by the runtime itself during interpreter shut-down. In
49+
general, there shouldn't be a reason to explicitly call this, except to
50+
handle specific scenarios such as forking.

0 commit comments

Comments
 (0)