Skip to content

Commit 9c25b35

Browse files
authored
Merge branch 'main' into fix-issue21914
2 parents 262189d + cb944d0 commit 9c25b35

File tree

274 files changed

+8435
-4449
lines changed

Some content is hidden

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

274 files changed

+8435
-4449
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,23 @@ jobs:
154154
needs: check_source
155155
if: needs.check_source.outputs.run_tests == 'true'
156156
env:
157+
HOMEBREW_NO_ANALYTICS: 1
158+
HOMEBREW_NO_AUTO_UPDATE: 1
159+
HOMEBREW_NO_INSTALL_CLEANUP: 1
157160
PYTHONSTRICTEXTENSIONBUILD: 1
158161
steps:
159162
- uses: actions/checkout@v3
160-
- name: Prepare homebrew environment variables
161-
run: |
162-
echo "LDFLAGS=-L$(brew --prefix tcl-tk)/lib" >> $GITHUB_ENV
163-
echo "PKG_CONFIG_PATH=$(brew --prefix [email protected])/lib/pkgconfig:$(brew --prefix tcl-tk)/lib/pkgconfig" >> $GITHUB_ENV
163+
- name: Install Homebrew dependencies
164+
run: brew install pkg-config [email protected] xz gdbm tcl-tk
164165
- name: Configure CPython
165-
run: ./configure --with-pydebug --prefix=/opt/python-dev
166+
run: |
167+
CFLAGS="-I$(brew --prefix gdbm)/include -I$(brew --prefix xz)/include" \
168+
LDFLAGS="-L$(brew --prefix gdbm)/lib -I$(brew --prefix xz)/lib" \
169+
PKG_CONFIG_PATH="$(brew --prefix tcl-tk)/lib/pkgconfig" \
170+
./configure \
171+
--with-pydebug \
172+
--prefix=/opt/python-dev \
173+
--with-openssl="$(brew --prefix [email protected])"
166174
- name: Build CPython
167175
run: make -j4
168176
- name: Display build info

.github/workflows/new-bugs-announce-notifier.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ jobs:
1919
- name: Send notification
2020
uses: actions/github-script@v6
2121
env:
22-
MAILGUN_API_KEY: ${{ secrets.PSF_MAILGUN_KEY }}
22+
MAILGUN_API_KEY: ${{ secrets.MAILGUN_PYTHON_ORG_MAILGUN_KEY }}
2323
with:
2424
script: |
2525
const Mailgun = require("mailgun.js");
2626
const formData = require('form-data');
2727
const mailgun = new Mailgun(formData);
28-
const DOMAIN = "mg.python.org";
28+
const DOMAIN = "mailgun.python.org";
2929
const mg = mailgun.client({username: 'api', key: process.env.MAILGUN_API_KEY});
3030
github.rest.issues.get({
3131
issue_number: context.issue.number,
@@ -44,7 +44,7 @@ jobs:
4444
};
4545
4646
const data = {
47-
from: "CPython Issues <github@mg.python.org>",
47+
from: "CPython Issues <github@mailgun.python.org>",
4848
4949
subject: `[Issue ${issue.data.number}] ${issue.data.title}`,
5050
template: "new-github-issue",

Doc/bugs.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Click on the "New issue" button in the top bar to report a new issue.
7070
The submission form has two fields, "Title" and "Comment".
7171

7272
For the "Title" field, enter a *very* short description of the problem;
73-
less than ten words is good.
73+
fewer than ten words is good.
7474

7575
In the "Comment" field, describe the problem in detail, including what you
7676
expected to happen and what did happen. Be sure to include whether any

Doc/c-api/buffer.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ Buffer-related functions
499499
This function fails if *len* != *src->len*.
500500
501501
502-
.. c:function:: int PyObject_CopyData(Py_buffer *dest, Py_buffer *src)
502+
.. c:function:: int PyObject_CopyData(PyObject *dest, PyObject *src)
503503
504504
Copy data from *src* to *dest* buffer. Can convert between C-style and
505505
or Fortran-style buffers.

Doc/c-api/code.rst

Lines changed: 92 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,28 +33,47 @@ bound into a function.
3333
3434
Return the number of free variables in *co*.
3535
36-
.. c:function:: PyCodeObject* PyCode_New(int argcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *linetable, PyObject *exceptiontable)
36+
.. c:function:: PyCodeObject* PyUnstable_Code_New(int argcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *linetable, PyObject *exceptiontable)
3737
3838
Return a new code object. If you need a dummy code object to create a frame,
39-
use :c:func:`PyCode_NewEmpty` instead. Calling :c:func:`PyCode_New` directly
40-
will bind you to a precise Python version since the definition of the bytecode
41-
changes often. The many arguments of this function are inter-dependent in complex
39+
use :c:func:`PyCode_NewEmpty` instead.
40+
41+
Since the definition of the bytecode changes often, calling
42+
:c:func:`PyCode_New` directly can bind you to a precise Python version.
43+
44+
The many arguments of this function are inter-dependent in complex
4245
ways, meaning that subtle changes to values are likely to result in incorrect
4346
execution or VM crashes. Use this function only with extreme care.
4447
4548
.. versionchanged:: 3.11
4649
Added ``exceptiontable`` parameter.
4750
48-
.. c:function:: PyCodeObject* PyCode_NewWithPosOnlyArgs(int argcount, int posonlyargcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *linetable, PyObject *exceptiontable)
51+
.. index:: single: PyCode_New
52+
53+
.. versionchanged:: 3.12
54+
55+
Renamed from ``PyCode_New`` as part of :ref:`unstable-c-api`.
56+
The old name is deprecated, but will remain available until the
57+
signature changes again.
58+
59+
.. c:function:: PyCodeObject* PyUnstable_Code_NewWithPosOnlyArgs(int argcount, int posonlyargcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *linetable, PyObject *exceptiontable)
4960
5061
Similar to :c:func:`PyCode_New`, but with an extra "posonlyargcount" for positional-only arguments.
5162
The same caveats that apply to ``PyCode_New`` also apply to this function.
5263
53-
.. versionadded:: 3.8
64+
.. index:: single: PyCode_NewWithPosOnlyArgs
65+
66+
.. versionadded:: 3.8 as ``PyCode_NewWithPosOnlyArgs``
5467
5568
.. versionchanged:: 3.11
5669
Added ``exceptiontable`` parameter.
5770
71+
.. versionchanged:: 3.12
72+
73+
Renamed to ``PyUnstable_Code_NewWithPosOnlyArgs``.
74+
The old name is deprecated, but will remain available until the
75+
signature changes again.
76+
5877
.. c:function:: PyCodeObject* PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno)
5978
6079
Return a new empty code object with the specified filename,
@@ -165,3 +184,70 @@ bound into a function.
165184
:c:func:`PyErr_WriteUnraisable`. Otherwise it should return ``0``.
166185
167186
.. versionadded:: 3.12
187+
188+
189+
Extra information
190+
-----------------
191+
192+
To support low-level extensions to frame evaluation, such as external
193+
just-in-time compilers, it is possible to attach arbitrary extra data to
194+
code objects.
195+
196+
These functions are part of the unstable C API tier:
197+
this functionality is a CPython implementation detail, and the API
198+
may change without deprecation warnings.
199+
200+
.. c:function:: Py_ssize_t PyUnstable_Eval_RequestCodeExtraIndex(freefunc free)
201+
202+
Return a new an opaque index value used to adding data to code objects.
203+
204+
You generally call this function once (per interpreter) and use the result
205+
with ``PyCode_GetExtra`` and ``PyCode_SetExtra`` to manipulate
206+
data on individual code objects.
207+
208+
If *free* is not ``NULL``: when a code object is deallocated,
209+
*free* will be called on non-``NULL`` data stored under the new index.
210+
Use :c:func:`Py_DecRef` when storing :c:type:`PyObject`.
211+
212+
.. index:: single: _PyEval_RequestCodeExtraIndex
213+
214+
.. versionadded:: 3.6 as ``_PyEval_RequestCodeExtraIndex``
215+
216+
.. versionchanged:: 3.12
217+
218+
Renamed to ``PyUnstable_Eval_RequestCodeExtraIndex``.
219+
The old private name is deprecated, but will be available until the API
220+
changes.
221+
222+
.. c:function:: int PyUnstable_Code_GetExtra(PyObject *code, Py_ssize_t index, void **extra)
223+
224+
Set *extra* to the extra data stored under the given index.
225+
Return 0 on success. Set an exception and return -1 on failure.
226+
227+
If no data was set under the index, set *extra* to ``NULL`` and return
228+
0 without setting an exception.
229+
230+
.. index:: single: _PyCode_GetExtra
231+
232+
.. versionadded:: 3.6 as ``_PyCode_GetExtra``
233+
234+
.. versionchanged:: 3.12
235+
236+
Renamed to ``PyUnstable_Code_GetExtra``.
237+
The old private name is deprecated, but will be available until the API
238+
changes.
239+
240+
.. c:function:: int PyUnstable_Code_SetExtra(PyObject *code, Py_ssize_t index, void *extra)
241+
242+
Set the extra data stored under the given index to *extra*.
243+
Return 0 on success. Set an exception and return -1 on failure.
244+
245+
.. index:: single: _PyCode_SetExtra
246+
247+
.. versionadded:: 3.6 as ``_PyCode_SetExtra``
248+
249+
.. versionchanged:: 3.12
250+
251+
Renamed to ``PyUnstable_Code_SetExtra``.
252+
The old private name is deprecated, but will be available until the API
253+
changes.

Doc/c-api/exceptions.rst

Lines changed: 40 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -402,58 +402,45 @@ Querying the error indicator
402402
403403
.. c:function:: PyObject *PyErr_GetRaisedException(void)
404404
405-
Returns the exception currently being raised, clearing the exception at
406-
the same time. Do not confuse this with the exception currently being
407-
handled which can be accessed with :c:func:`PyErr_GetHandledException`.
405+
Return the exception currently being raised, clearing the error indicator at
406+
the same time.
408407
409-
.. note::
408+
This function is used by code that needs to catch exceptions,
409+
or code that needs to save and restore the error indicator temporarily.
410410
411-
This function is normally only used by code that needs to catch exceptions or
412-
by code that needs to save and restore the error indicator temporarily, e.g.::
411+
For example::
413412
414-
{
415-
PyObject *exc = PyErr_GetRaisedException();
413+
{
414+
PyObject *exc = PyErr_GetRaisedException();
416415
417-
/* ... code that might produce other errors ... */
416+
/* ... code that might produce other errors ... */
418417
419-
PyErr_SetRaisedException(exc);
420-
}
418+
PyErr_SetRaisedException(exc);
419+
}
420+
421+
.. seealso:: :c:func:`PyErr_GetHandledException`,
422+
to save the exception currently being handled.
421423
422424
.. versionadded:: 3.12
423425
424426
425427
.. c:function:: void PyErr_SetRaisedException(PyObject *exc)
426428
427-
Sets the exception currently being raised ``exc``.
428-
If the exception is already set, it is cleared first.
429-
430-
``exc`` must be a valid exception.
431-
(Violating this rules will cause subtle problems later.)
432-
This call consumes a reference to the ``exc`` object: you must own a
433-
reference to that object before the call and after the call you no longer own
434-
that reference.
435-
(If you don't understand this, don't use this function. I warned you.)
429+
Set *exc* as the exception currently being raised,
430+
clearing the existing exception if one is set.
436431
437-
.. note::
432+
.. warning::
438433
439-
This function is normally only used by code that needs to save and restore the
440-
error indicator temporarily. Use :c:func:`PyErr_GetRaisedException` to save
441-
the current exception, e.g.::
442-
443-
{
444-
PyObject *exc = PyErr_GetRaisedException();
445-
446-
/* ... code that might produce other errors ... */
447-
448-
PyErr_SetRaisedException(exc);
449-
}
434+
This call steals a reference to *exc*, which must be a valid exception.
450435
451436
.. versionadded:: 3.12
452437
453438
454439
.. c:function:: void PyErr_Fetch(PyObject **ptype, PyObject **pvalue, PyObject **ptraceback)
455440
456-
As of 3.12, this function is deprecated. Use :c:func:`PyErr_GetRaisedException` instead.
441+
.. deprecated:: 3.12
442+
443+
Use :c:func:`PyErr_GetRaisedException` instead.
457444
458445
Retrieve the error indicator into three variables whose addresses are passed.
459446
If the error indicator is not set, set all three variables to ``NULL``. If it is
@@ -462,8 +449,10 @@ Querying the error indicator
462449
463450
.. note::
464451
465-
This function is normally only used by code that needs to catch exceptions or
466-
by code that needs to save and restore the error indicator temporarily, e.g.::
452+
This function is normally only used by legacy code that needs to catch
453+
exceptions or save and restore the error indicator temporarily.
454+
455+
For example::
467456
468457
{
469458
PyObject *type, *value, *traceback;
@@ -474,15 +463,17 @@ Querying the error indicator
474463
PyErr_Restore(type, value, traceback);
475464
}
476465
477-
.. deprecated:: 3.12
478-
479466
480467
.. c:function:: void PyErr_Restore(PyObject *type, PyObject *value, PyObject *traceback)
481468
482-
As of 3.12, this function is deprecated. Use :c:func:`PyErr_SetRaisedException` instead.
469+
.. deprecated:: 3.12
470+
471+
Use :c:func:`PyErr_SetRaisedException` instead.
483472
484-
Set the error indicator from the three objects. If the error indicator is
485-
already set, it is cleared first. If the objects are ``NULL``, the error
473+
Set the error indicator from the three objects,
474+
*type*, *value*, and *traceback*,
475+
clearing the existing exception if one is set.
476+
If the objects are ``NULL``, the error
486477
indicator is cleared. Do not pass a ``NULL`` type and non-``NULL`` value or
487478
traceback. The exception type should be a class. Do not pass an invalid
488479
exception type or value. (Violating these rules will cause subtle problems
@@ -493,18 +484,17 @@ Querying the error indicator
493484
494485
.. note::
495486
496-
This function is normally only used by code that needs to save and restore the
497-
error indicator temporarily. Use :c:func:`PyErr_Fetch` to save the current
498-
error indicator.
499-
500-
.. deprecated:: 3.12
487+
This function is normally only used by legacy code that needs to
488+
save and restore the error indicator temporarily.
489+
Use :c:func:`PyErr_Fetch` to save the current error indicator.
501490
502491
503492
.. c:function:: void PyErr_NormalizeException(PyObject **exc, PyObject **val, PyObject **tb)
504493
505-
As of 3.12, this function is deprecated.
506-
Use :c:func:`PyErr_GetRaisedException` instead of :c:func:`PyErr_Fetch` to avoid
507-
any possible de-normalization.
494+
.. deprecated:: 3.12
495+
496+
Use :c:func:`PyErr_GetRaisedException` instead,
497+
to avoid any possible de-normalization.
508498
509499
Under certain circumstances, the values returned by :c:func:`PyErr_Fetch` below
510500
can be "unnormalized", meaning that ``*exc`` is a class object but ``*val`` is
@@ -522,8 +512,6 @@ Querying the error indicator
522512
PyException_SetTraceback(val, tb);
523513
}
524514
525-
.. deprecated:: 3.12
526-
527515
528516
.. c:function:: PyObject* PyErr_GetHandledException(void)
529517
@@ -771,14 +759,12 @@ Exception Objects
771759
772760
.. c:function:: PyObject* PyException_GetArgs(PyObject *ex)
773761
774-
Return args of the given exception as a new reference,
775-
as accessible from Python through :attr:`args`.
762+
Return :attr:`~BaseException.args` of exception *ex*.
776763
777764
778765
.. c:function:: void PyException_SetArgs(PyObject *ex, PyObject *args)
779766
780-
Set the args of the given exception,
781-
as accessible from Python through :attr:`args`.
767+
Set :attr:`~BaseException.args` of exception *ex* to *args*.
782768
783769
784770
.. _unicodeexceptions:

Doc/c-api/init.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ Process-wide parameters
818818
.. deprecated:: 3.11
819819
820820
821-
.. c:function:: w_char* Py_GetPythonHome()
821+
.. c:function:: wchar_t* Py_GetPythonHome()
822822
823823
Return the default "home", that is, the value set by a previous call to
824824
:c:func:`Py_SetPythonHome`, or the value of the :envvar:`PYTHONHOME`

0 commit comments

Comments
 (0)