Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8c53a58

Browse filesBrowse files
authored
Merge branch 'main' into capi_type_check
2 parents bf4d78a + 31a4fb3 commit 8c53a58
Copy full SHA for 8c53a58

File tree

Expand file treeCollapse file tree

185 files changed

+6262
-4154
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

185 files changed

+6262
-4154
lines changed

‎.github/CODEOWNERS

Copy file name to clipboardExpand all lines: .github/CODEOWNERS
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Python/ceval*.h @markshannon
3434
Python/compile.c @markshannon @iritkatriel
3535
Python/assemble.c @markshannon @iritkatriel
3636
Python/flowgraph.c @markshannon @iritkatriel
37+
Python/instruction_sequence.c @iritkatriel
3738
Python/ast_opt.c @isidentical
3839
Python/bytecodes.c @markshannon
3940
Python/optimizer*.c @markshannon
@@ -74,11 +75,8 @@ Programs/python.c @ericsnowcurrently
7475
Tools/build/generate_global_objects.py @ericsnowcurrently
7576

7677
# Exceptions
77-
Lib/traceback.py @iritkatriel
7878
Lib/test/test_except*.py @iritkatriel
79-
Lib/test/test_traceback.py @iritkatriel
8079
Objects/exceptions.c @iritkatriel
81-
Python/traceback.c @iritkatriel
8280

8381
# Hashing
8482
**/*hashlib* @gpshead @tiran

‎.github/workflows/build.yml

Copy file name to clipboardExpand all lines: .github/workflows/build.yml
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ jobs:
199199
uses: ./.github/workflows/reusable-macos.yml
200200
with:
201201
config_hash: ${{ needs.check_source.outputs.config_hash }}
202-
# macos-14 is M1, macos-13 is Intel
203-
os-matrix: '["macos-14", "macos-13"]'
202+
# Cirrus is M1, macos-13 is default GHA Intel
203+
os-matrix: '["ghcr.io/cirruslabs/macos-runner:sonoma", "macos-13"]'
204204

205205
build_macos_free_threading:
206206
name: 'macOS (free-threading)'
@@ -210,8 +210,8 @@ jobs:
210210
with:
211211
config_hash: ${{ needs.check_source.outputs.config_hash }}
212212
free-threading: true
213-
# macos-14-large is Intel with 12 cores (most parallelism)
214-
os-matrix: '["macos-14"]'
213+
# Cirrus is M1
214+
os-matrix: '["ghcr.io/cirruslabs/macos-runner:sonoma"]'
215215

216216
build_ubuntu:
217217
name: 'Ubuntu'

‎Doc/c-api/long.rst

Copy file name to clipboardExpand all lines: Doc/c-api/long.rst
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,19 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
494494
.. versionadded:: 3.13
495495
496496
497+
.. c:function:: int PyLong_GetSign(PyObject *obj, int *sign)
498+
499+
Get the sign of the integer object *obj*.
500+
501+
On success, set *\*sign* to the integer sign (0, -1 or +1 for zero, negative or
502+
positive integer, respectively) and return 0.
503+
504+
On failure, return -1 with an exception set. This function always succeeds
505+
if *obj* is a :c:type:`PyLongObject` or its subtype.
506+
507+
.. versionadded:: 3.14
508+
509+
497510
.. c:function:: int PyUnstable_Long_IsCompact(const PyLongObject* op)
498511
499512
Return 1 if *op* is compact, 0 otherwise.

‎Doc/c-api/monitoring.rst

Copy file name to clipboardExpand all lines: Doc/c-api/monitoring.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
.. _monitoring:
44

5-
Monitorong C API
5+
Monitoring C API
66
================
77

88
Added in version 3.13.

‎Doc/c-api/reflection.rst

Copy file name to clipboardExpand all lines: Doc/c-api/reflection.rst
+61-1Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,48 @@ Reflection
77

88
.. c:function:: PyObject* PyEval_GetBuiltins(void)
99
10+
.. deprecated:: 3.13
11+
12+
Use :c:func:`PyEval_GetFrameBuiltins` instead.
13+
1014
Return a dictionary of the builtins in the current execution frame,
1115
or the interpreter of the thread state if no frame is currently executing.
1216
1317
1418
.. c:function:: PyObject* PyEval_GetLocals(void)
1519
16-
Return a dictionary of the local variables in the current execution frame,
20+
.. deprecated:: 3.13
21+
22+
Use either :c:func:`PyEval_GetFrameLocals` to obtain the same behaviour as calling
23+
:func:`locals` in Python code, or else call :c:func:`PyFrame_GetLocals` on the result
24+
of :c:func:`PyEval_GetFrame` to access the :attr:`~frame.f_locals` attribute of the
25+
currently executing frame.
26+
27+
Return a mapping providing access to the local variables in the current execution frame,
1728
or ``NULL`` if no frame is currently executing.
1829
30+
Refer to :func:`locals` for details of the mapping returned at different scopes.
31+
32+
As this function returns a :term:`borrowed reference`, the dictionary returned for
33+
:term:`optimized scopes <optimized scope>` is cached on the frame object and will remain
34+
alive as long as the frame object does. Unlike :c:func:`PyEval_GetFrameLocals` and
35+
:func:`locals`, subsequent calls to this function in the same frame will update the
36+
contents of the cached dictionary to reflect changes in the state of the local variables
37+
rather than returning a new snapshot.
38+
39+
.. versionchanged:: 3.13
40+
As part of :pep:`667`, :c:func:`PyFrame_GetLocals`, :func:`locals`, and
41+
:attr:`FrameType.f_locals <frame.f_locals>` no longer make use of the shared cache
42+
dictionary. Refer to the :ref:`What's New entry <whatsnew313-locals-semantics>` for
43+
additional details.
44+
1945
2046
.. c:function:: PyObject* PyEval_GetGlobals(void)
2147
48+
.. deprecated:: 3.13
49+
50+
Use :c:func:`PyEval_GetFrameGlobals` instead.
51+
2252
Return a dictionary of the global variables in the current execution frame,
2353
or ``NULL`` if no frame is currently executing.
2454
@@ -31,6 +61,36 @@ Reflection
3161
See also :c:func:`PyThreadState_GetFrame`.
3262
3363
64+
.. c:function:: PyObject* PyEval_GetFrameBuiltins(void)
65+
66+
Return a dictionary of the builtins in the current execution frame,
67+
or the interpreter of the thread state if no frame is currently executing.
68+
69+
.. versionadded:: 3.13
70+
71+
72+
.. c:function:: PyObject* PyEval_GetFrameLocals(void)
73+
74+
Return a dictionary of the local variables in the current execution frame,
75+
or ``NULL`` if no frame is currently executing. Equivalent to calling
76+
:func:`locals` in Python code.
77+
78+
To access :attr:`~frame.f_locals` on the current frame without making an independent
79+
snapshot in :term:`optimized scopes <optimized scope>`, call :c:func:`PyFrame_GetLocals`
80+
on the result of :c:func:`PyEval_GetFrame`.
81+
82+
.. versionadded:: 3.13
83+
84+
85+
.. c:function:: PyObject* PyEval_GetFrameGlobals(void)
86+
87+
Return a dictionary of the global variables in the current execution frame,
88+
or ``NULL`` if no frame is currently executing. Equivalent to calling
89+
:func:`globals` in Python code.
90+
91+
.. versionadded:: 3.13
92+
93+
3494
.. c:function:: const char* PyEval_GetFuncName(PyObject *func)
3595
3696
Return the name of *func* if it is a function, class or instance object, else the

‎Doc/data/refcounts.dat

Copy file name to clipboardExpand all lines: Doc/data/refcounts.dat
+32Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,12 @@ PyEval_GetGlobals:PyObject*::0:
790790

791791
PyEval_GetFrame:PyObject*::0:
792792

793+
PyEval_GetFrameBuiltins:PyObject*::+1:
794+
795+
PyEval_GetFrameLocals:PyObject*::+1:
796+
797+
PyEval_GetFrameGlobals:PyObject*::+1:
798+
793799
PyEval_GetFuncDesc:const char*:::
794800
PyEval_GetFuncDesc:PyObject*:func:0:
795801

@@ -916,6 +922,32 @@ PyFloat_FromString:PyObject*:str:0:
916922
PyFloat_GetInfo:PyObject*::+1:
917923
PyFloat_GetInfo::void::
918924

925+
PyFrame_GetBack:PyObject*::+1:
926+
PyFrame_GetBack:PyFrameObject*:frame:0:
927+
928+
PyFrame_GetBuiltins:PyObject*::+1:
929+
PyFrame_GetBuiltins:PyFrameObject*:frame:0:
930+
931+
PyFrame_GetCode:PyObject*::+1:
932+
PyFrame_GetCode:PyFrameObject*:frame:0:
933+
934+
PyFrame_GetGenerator:PyObject*::+1:
935+
PyFrame_GetGenerator:PyFrameObject*:frame:0:
936+
937+
PyFrame_GetGlobals:PyObject*::+1:
938+
PyFrame_GetGlobals:PyFrameObject*:frame:0:
939+
940+
PyFrame_GetLocals:PyObject*::+1:
941+
PyFrame_GetLocals:PyFrameObject*:frame:0:
942+
943+
PyFrame_GetVar:PyObject*::+1:
944+
PyFrame_GetVar:PyFrameObject*:frame:0:
945+
PyFrame_GetVar:PyObject*:name:0:
946+
947+
PyFrame_GetVarString:PyObject*::+1:
948+
PyFrame_GetVarString:PyFrameObject*:frame:0:
949+
PyFrame_GetVarString:const char*:name::
950+
919951
PyFrozenSet_Check:int:::
920952
PyFrozenSet_Check:PyObject*:p:0:
921953

‎Doc/faq/library.rst

Copy file name to clipboardExpand all lines: Doc/faq/library.rst
-78Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -541,84 +541,6 @@ Thus, to read *n* bytes from a pipe *p* created with :func:`os.popen`, you need
541541
use ``p.read(n)``.
542542
543543
544-
.. XXX update to use subprocess. See the :ref:`subprocess-replacements` section.
545-
546-
How do I run a subprocess with pipes connected to both input and output?
547-
------------------------------------------------------------------------
548-
549-
Use the :mod:`popen2` module. For example::
550-
551-
import popen2
552-
fromchild, tochild = popen2.popen2("command")
553-
tochild.write("input\n")
554-
tochild.flush()
555-
output = fromchild.readline()
556-
557-
Warning: in general it is unwise to do this because you can easily cause a
558-
deadlock where your process is blocked waiting for output from the child
559-
while the child is blocked waiting for input from you. This can be caused
560-
by the parent expecting the child to output more text than it does or
561-
by data being stuck in stdio buffers due to lack of flushing.
562-
The Python parent can of course explicitly flush the data it sends to the
563-
child before it reads any output, but if the child is a naive C program it
564-
may have been written to never explicitly flush its output, even if it is
565-
interactive, since flushing is normally automatic.
566-
567-
Note that a deadlock is also possible if you use :func:`popen3` to read
568-
stdout and stderr. If one of the two is too large for the internal buffer
569-
(increasing the buffer size does not help) and you ``read()`` the other one
570-
first, there is a deadlock, too.
571-
572-
Note on a bug in popen2: unless your program calls ``wait()`` or
573-
``waitpid()``, finished child processes are never removed, and eventually
574-
calls to popen2 will fail because of a limit on the number of child
575-
processes. Calling :func:`os.waitpid` with the :const:`os.WNOHANG` option can
576-
prevent this; a good place to insert such a call would be before calling
577-
``popen2`` again.
578-
579-
In many cases, all you really need is to run some data through a command and
580-
get the result back. Unless the amount of data is very large, the easiest
581-
way to do this is to write it to a temporary file and run the command with
582-
that temporary file as input. The standard module :mod:`tempfile` exports a
583-
:func:`~tempfile.mktemp` function to generate unique temporary file names. ::
584-
585-
import tempfile
586-
import os
587-
588-
class Popen3:
589-
"""
590-
This is a deadlock-safe version of popen that returns
591-
an object with errorlevel, out (a string) and err (a string).
592-
(capturestderr may not work under windows.)
593-
Example: print(Popen3('grep spam','\n\nhere spam\n\n').out)
594-
"""
595-
def __init__(self,command,input=None,capturestderr=None):
596-
outfile=tempfile.mktemp()
597-
command="( %s ) > %s" % (command,outfile)
598-
if input:
599-
infile=tempfile.mktemp()
600-
open(infile,"w").write(input)
601-
command=command+" <"+infile
602-
if capturestderr:
603-
errfile=tempfile.mktemp()
604-
command=command+" 2>"+errfile
605-
self.errorlevel=os.system(command) >> 8
606-
self.out=open(outfile,"r").read()
607-
os.remove(outfile)
608-
if input:
609-
os.remove(infile)
610-
if capturestderr:
611-
self.err=open(errfile,"r").read()
612-
os.remove(errfile)
613-
614-
Note that many interactive programs (e.g. vi) don't work well with pipes
615-
substituted for standard input and output. You will have to use pseudo ttys
616-
("ptys") instead of pipes. Or you can use a Python interface to Don Libes'
617-
"expect" library. A Python extension that interfaces to expect is called
618-
"expy" and available from https://expectpy.sourceforge.net. A pure Python
619-
solution that works like expect is :pypi:`pexpect`.
620-
621-
622544
How do I access the serial (RS232) port?
623545
----------------------------------------
624546

‎Doc/glossary.rst

Copy file name to clipboardExpand all lines: Doc/glossary.rst
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,12 @@ Glossary
438438
division. Note that ``(-11) // 4`` is ``-3`` because that is ``-2.75``
439439
rounded *downward*. See :pep:`238`.
440440

441+
free threading
442+
A threading model where multiple threads can run Python bytecode
443+
simultaneously within the same interpreter. This is in contrast to
444+
the :term:`global interpreter lock` which allows only one thread to
445+
execute Python bytecode at a time. See :pep:`703`.
446+
441447
function
442448
A series of statements which returns some value to a caller. It can also
443449
be passed zero or more :term:`arguments <argument>` which may be used in

‎Doc/howto/logging-cookbook.rst

Copy file name to clipboardExpand all lines: Doc/howto/logging-cookbook.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2950,7 +2950,7 @@ When run, this produces a file with exactly two lines:
29502950
.. code-block:: none
29512951
29522952
28/01/2015 07:21:23|INFO|Sample message|
2953-
28/01/2015 07:21:23|ERROR|ZeroDivisionError: integer division or modulo by zero|'Traceback (most recent call last):\n File "logtest7.py", line 30, in main\n x = 1 / 0\nZeroDivisionError: integer division or modulo by zero'|
2953+
28/01/2015 07:21:23|ERROR|ZeroDivisionError: division by zero|'Traceback (most recent call last):\n File "logtest7.py", line 30, in main\n x = 1 / 0\nZeroDivisionError: division by zero'|
29542954
29552955
While the above treatment is simplistic, it points the way to how exception
29562956
information can be formatted to your liking. The :mod:`traceback` module may be

‎Doc/howto/pyporting.rst

Copy file name to clipboardExpand all lines: Doc/howto/pyporting.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ please see :ref:`cporting-howto`.
1818

1919
The archived python-porting_ mailing list may contain some useful guidance.
2020

21-
Since Python 3.13 the original porting guide was discontinued.
21+
Since Python 3.11 the original porting guide was discontinued.
2222
You can find the old guide in the
23-
`archive <https://docs.python.org/3.12/howto/pyporting.html>`_.
23+
`archive <https://docs.python.org/3.10/howto/pyporting.html>`_.
2424

2525

2626
Third-party guides

‎Doc/library/cmath.rst

Copy file name to clipboardExpand all lines: Doc/library/cmath.rst
+2-5Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ Conversions to and from polar coordinates
4343

4444
A Python complex number ``z`` is stored internally using *rectangular*
4545
or *Cartesian* coordinates. It is completely determined by its *real
46-
part* ``z.real`` and its *imaginary part* ``z.imag``. In other
47-
words::
48-
49-
z == z.real + z.imag*1j
46+
part* ``z.real`` and its *imaginary part* ``z.imag``.
5047

5148
*Polar coordinates* give an alternative way to represent a complex
5249
number. In polar coordinates, a complex number *z* is defined by the
@@ -90,7 +87,7 @@ rectangular coordinates to polar coordinates and back.
9087
.. function:: rect(r, phi)
9188

9289
Return the complex number *x* with polar coordinates *r* and *phi*.
93-
Equivalent to ``r * (math.cos(phi) + math.sin(phi)*1j)``.
90+
Equivalent to ``complex(r * math.cos(phi), r * math.sin(phi))``.
9491

9592

9693
Power and logarithmic functions

‎Doc/library/contextlib.rst

Copy file name to clipboardExpand all lines: Doc/library/contextlib.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ executing that callback::
796796
if result:
797797
stack.pop_all()
798798

799-
This allows the intended cleanup up behaviour to be made explicit up front,
799+
This allows the intended cleanup behaviour to be made explicit up front,
800800
rather than requiring a separate flag variable.
801801

802802
If a particular application uses this pattern a lot, it can be simplified

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.