Skip to content

Commit 544b30c

Browse files
committed
Merge branch 'main' into inlinecomp
* main: (225 commits) pythongh-102056: Fix a few bugs in error handling of exception printing code (python#102078) pythongh-102011: use sys.exception() instead of sys.exc_info() in docs where possible (python#102012) pythongh-101566: Sync with zipp 3.14. (pythonGH-102018) pythonGH-99818: improve the documentation for zipfile.Path and Traversable (pythonGH-101589) pythongh-88233: zipfile: handle extras after a zip64 extra (pythonGH-96161) pythongh-101981: Apply HOMEBREW related environment variables (pythongh-102074) pythongh-101907: Stop using `_Py_OPCODE` and `_Py_OPARG` macros (pythonGH-101912) pythongh-101819: Adapt _io types to heap types, batch 1 (pythonGH-101949) pythongh-101981: Build macOS as recommended by the devguide (pythonGH-102070) pythongh-97786: Fix compiler warnings in pytime.c (python#101826) pythongh-101578: Amend PyErr_{Set,Get}RaisedException docs (python#101962) Misc improvements to the float tutorial (pythonGH-102052) pythongh-85417: Clarify behaviour on branch cuts in cmath module (python#102046) pythongh-100425: Update tutorial docs related to sum() accuracy (FH-101854) Add missing 'is' to `cmath.log()` docstring (python#102049) pythongh-100210: Correct the comment link for unescaping HTML (python#100212) pythongh-97930: Also include subdirectory in makefile. (python#102030) pythongh-99735: Use required=True in argparse subparsers example (python#100927) Fix incorrectly documented attribute in csv docs (python#101250) pythonGH-84783: Make the slice object hashable (pythonGH-101264) ...
2 parents ee2ad56 + 022b44f commit 544b30c

File tree

464 files changed

+24020
-14723
lines changed

Some content is hidden

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

464 files changed

+24020
-14723
lines changed

.azure-pipelines/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
variables:
5858
testRunTitle: '$(build.sourceBranchName)-linux'
5959
testRunPlatform: linux
60-
openssl_version: 1.1.1q
60+
openssl_version: 1.1.1t
6161

6262
steps:
6363
- template: ./posix-steps.yml
@@ -83,7 +83,7 @@ jobs:
8383
variables:
8484
testRunTitle: '$(Build.SourceBranchName)-linux-coverage'
8585
testRunPlatform: linux-coverage
86-
openssl_version: 1.1.1q
86+
openssl_version: 1.1.1t
8787

8888
steps:
8989
- template: ./posix-steps.yml

.azure-pipelines/pr.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
variables:
5858
testRunTitle: '$(system.pullRequest.TargetBranch)-linux'
5959
testRunPlatform: linux
60-
openssl_version: 1.1.1q
60+
openssl_version: 1.1.1t
6161

6262
steps:
6363
- template: ./posix-steps.yml
@@ -83,7 +83,7 @@ jobs:
8383
variables:
8484
testRunTitle: '$(Build.SourceBranchName)-linux-coverage'
8585
testRunPlatform: linux-coverage
86-
openssl_version: 1.1.1q
86+
openssl_version: 1.1.1t
8787

8888
steps:
8989
- template: ./posix-steps.yml

.github/CODEOWNERS

+2
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ Lib/ast.py @isidentical
151151

152152
**/*sysconfig* @FFY00
153153

154+
**/*cjkcodecs* @corona10
155+
154156
# macOS
155157
/Mac/ @python/macos-team
156158
**/*osx_support* @python/macos-team

.github/workflows/build.yml

+16-6
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,25 @@ 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
163+
- name: Install Homebrew dependencies
164+
run: brew install pkg-config openssl@1.1 xz gdbm tcl-tk
165+
- name: Prepare Homebrew environment variables
161166
run: |
162-
echo "LDFLAGS=-L$(brew --prefix tcl-tk)/lib" >> $GITHUB_ENV
167+
echo "CFLAGS=-I$(brew --prefix gdbm)/include -I$(brew --prefix xz)/include" >> $GITHUB_ENV
168+
echo "LDFLAGS=-L$(brew --prefix gdbm)/lib -I$(brew --prefix xz)/lib" >> $GITHUB_ENV
163169
echo "PKG_CONFIG_PATH=$(brew --prefix openssl@1.1)/lib/pkgconfig:$(brew --prefix tcl-tk)/lib/pkgconfig" >> $GITHUB_ENV
164170
- name: Configure CPython
165-
run: ./configure --with-pydebug --prefix=/opt/python-dev
171+
run: |
172+
./configure \
173+
--with-pydebug \
174+
--prefix=/opt/python-dev \
175+
--with-openssl="$(brew --prefix openssl@1.1)"
166176
- name: Build CPython
167177
run: make -j4
168178
- name: Display build info
@@ -176,7 +186,7 @@ jobs:
176186
needs: check_source
177187
if: needs.check_source.outputs.run_tests == 'true'
178188
env:
179-
OPENSSL_VER: 1.1.1s
189+
OPENSSL_VER: 1.1.1t
180190
PYTHONSTRICTEXTENSIONBUILD: 1
181191
steps:
182192
- uses: actions/checkout@v3
@@ -235,7 +245,7 @@ jobs:
235245
strategy:
236246
fail-fast: false
237247
matrix:
238-
openssl_ver: [1.1.1s, 3.0.7, 3.1.0-beta1]
248+
openssl_ver: [1.1.1t, 3.0.8, 3.1.0-beta1]
239249
env:
240250
OPENSSL_VER: ${{ matrix.openssl_ver }}
241251
MULTISSL_DIR: ${{ github.workspace }}/multissl
@@ -282,7 +292,7 @@ jobs:
282292
needs: check_source
283293
if: needs.check_source.outputs.run_tests == 'true'
284294
env:
285-
OPENSSL_VER: 1.1.1s
295+
OPENSSL_VER: 1.1.1t
286296
PYTHONSTRICTEXTENSIONBUILD: 1
287297
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
288298
steps:

Doc/Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ VENVDIR = ./venv
99
SPHINXBUILD = PATH=$(VENVDIR)/bin:$$PATH sphinx-build
1010
SPHINXLINT = PATH=$(VENVDIR)/bin:$$PATH sphinx-lint
1111
BLURB = PATH=$(VENVDIR)/bin:$$PATH blurb
12+
JOBS = auto
1213
PAPER =
1314
SOURCES =
1415
DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py)
@@ -18,7 +19,7 @@ SPHINXERRORHANDLING = -W
1819
PAPEROPT_a4 = -D latex_elements.papersize=a4paper
1920
PAPEROPT_letter = -D latex_elements.papersize=letterpaper
2021

21-
ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees $(PAPEROPT_$(PAPER)) -j auto \
22+
ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees $(PAPEROPT_$(PAPER)) -j $(JOBS) \
2223
$(SPHINXOPTS) $(SPHINXERRORHANDLING) . build/$(BUILDER) $(SOURCES)
2324

2425
.PHONY: help

Doc/bugs.rst

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ If you find a bug in this documentation or would like to propose an improvement,
1919
please submit a bug report on the :ref:`tracker <using-the-tracker>`. If you
2020
have a suggestion on how to fix it, include that as well.
2121

22+
You can also open a discussion item on our
23+
`Documentation Discourse forum <https://discuss.python.org/c/documentation/26>`_.
24+
2225
If you're short on time, you can also email documentation bug reports to
2326
docs@python.org (behavioral bugs can be sent to python-list@python.org).
2427
'docs@' is a mailing list run by volunteers; your request will be noticed,

Doc/c-api/code.rst

+2
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ bound into a function.
7777
7878
Returns ``1`` if the function succeeds and 0 otherwise.
7979
80+
.. versionadded:: 3.11
81+
8082
.. c:function:: PyObject* PyCode_GetCode(PyCodeObject *co)
8183
8284
Equivalent to the Python code ``getattr(co, 'co_code')``.

Doc/c-api/dict.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Dictionary Objects
8080
8181
.. c:function:: int PyDict_DelItem(PyObject *p, PyObject *key)
8282
83-
Remove the entry in dictionary *p* with key *key*. *key* must be hashable;
83+
Remove the entry in dictionary *p* with key *key*. *key* must be :term:`hashable`;
8484
if it isn't, :exc:`TypeError` is raised.
8585
If *key* is not in the dictionary, :exc:`KeyError` is raised.
8686
Return ``0`` on success or ``-1`` on failure.

Doc/c-api/exceptions.rst

+63-1
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,46 @@ Querying the error indicator
400400
recursively in subtuples) are searched for a match.
401401
402402
403+
.. c:function:: PyObject *PyErr_GetRaisedException(void)
404+
405+
Return the exception currently being raised, clearing the error indicator at
406+
the same time.
407+
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.
410+
411+
For example::
412+
413+
{
414+
PyObject *exc = PyErr_GetRaisedException();
415+
416+
/* ... code that might produce other errors ... */
417+
418+
PyErr_SetRaisedException(exc);
419+
}
420+
421+
.. seealso:: :c:func:`PyErr_GetHandledException`,
422+
to save the exception currently being handled.
423+
424+
.. versionadded:: 3.12
425+
426+
427+
.. c:function:: void PyErr_SetRaisedException(PyObject *exc)
428+
429+
Set *exc* as the exception currently being raised,
430+
clearing the existing exception if one is set.
431+
432+
.. warning::
433+
434+
This call steals a reference to *exc*, which must be a valid exception.
435+
436+
.. versionadded:: 3.12
437+
438+
403439
.. c:function:: void PyErr_Fetch(PyObject **ptype, PyObject **pvalue, PyObject **ptraceback)
404440
441+
As of 3.12, this function is deprecated. Use :c:func:`PyErr_GetRaisedException` instead.
442+
405443
Retrieve the error indicator into three variables whose addresses are passed.
406444
If the error indicator is not set, set all three variables to ``NULL``. If it is
407445
set, it will be cleared and you own a reference to each object retrieved. The
@@ -421,10 +459,14 @@ Querying the error indicator
421459
PyErr_Restore(type, value, traceback);
422460
}
423461
462+
.. deprecated:: 3.12
463+
424464
425465
.. c:function:: void PyErr_Restore(PyObject *type, PyObject *value, PyObject *traceback)
426466
427-
Set the error indicator from the three objects. If the error indicator is
467+
As of 3.12, this function is deprecated. Use :c:func:`PyErr_SetRaisedException` instead.
468+
469+
Set the error indicator from the three objects. If the error indicator is
428470
already set, it is cleared first. If the objects are ``NULL``, the error
429471
indicator is cleared. Do not pass a ``NULL`` type and non-``NULL`` value or
430472
traceback. The exception type should be a class. Do not pass an invalid
@@ -440,9 +482,15 @@ Querying the error indicator
440482
error indicator temporarily. Use :c:func:`PyErr_Fetch` to save the current
441483
error indicator.
442484
485+
.. deprecated:: 3.12
486+
443487
444488
.. c:function:: void PyErr_NormalizeException(PyObject **exc, PyObject **val, PyObject **tb)
445489
490+
As of 3.12, this function is deprecated.
491+
Use :c:func:`PyErr_GetRaisedException` instead of :c:func:`PyErr_Fetch` to avoid
492+
any possible de-normalization.
493+
446494
Under certain circumstances, the values returned by :c:func:`PyErr_Fetch` below
447495
can be "unnormalized", meaning that ``*exc`` is a class object but ``*val`` is
448496
not an instance of the same class. This function can be used to instantiate
@@ -459,6 +507,8 @@ Querying the error indicator
459507
PyException_SetTraceback(val, tb);
460508
}
461509
510+
.. deprecated:: 3.12
511+
462512
463513
.. c:function:: PyObject* PyErr_GetHandledException(void)
464514
@@ -704,6 +754,18 @@ Exception Objects
704754
:attr:`__suppress_context__` is implicitly set to ``True`` by this function.
705755
706756
757+
.. c:function:: PyObject* PyException_GetArgs(PyObject *ex)
758+
759+
Return args of the given exception as a new reference,
760+
as accessible from Python through :attr:`args`.
761+
762+
763+
.. c:function:: void PyException_SetArgs(PyObject *ex, PyObject *args)
764+
765+
Set the args of the given exception,
766+
as accessible from Python through :attr:`args`.
767+
768+
707769
.. _unicodeexceptions:
708770
709771
Unicode Exception Objects

Doc/c-api/function.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ There are a few functions specific to Python functions.
169169
before the modification to *func* takes place, so the prior state of *func*
170170
can be inspected. The runtime is permitted to optimize away the creation of
171171
function objects when possible. In such cases no event will be emitted.
172-
Although this creates the possitibility of an observable difference of
172+
Although this creates the possibility of an observable difference of
173173
runtime behavior depending on optimization decisions, it does not change
174174
the semantics of the Python code being executed.
175175

Doc/c-api/init_config.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ PyConfig
839839
will produce an error.
840840
841841
Configured by the :option:`-X int_max_str_digits <-X>` command line
842-
flag or the :envvar:`PYTHONINTMAXSTRDIGITS` environment varable.
842+
flag or the :envvar:`PYTHONINTMAXSTRDIGITS` environment variable.
843843
844844
Default: ``-1`` in Python mode. 4300
845845
(:data:`sys.int_info.default_max_str_digits`) in isolated mode.
@@ -1582,7 +1582,7 @@ applied during the "Main" phase. It may allow to customize Python in Python to
15821582
override or tune the :ref:`Path Configuration <init-path-config>`, maybe
15831583
install a custom :data:`sys.meta_path` importer or an import hook, etc.
15841584
1585-
It may become possible to calculatin the :ref:`Path Configuration
1585+
It may become possible to calculate the :ref:`Path Configuration
15861586
<init-path-config>` in Python, after the Core phase and before the Main phase,
15871587
which is one of the :pep:`432` motivation.
15881588

Doc/c-api/module.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -388,15 +388,15 @@ objects dynamically. Note that both ``PyModule_FromDefAndSpec`` and
388388
389389
.. c:function:: PyObject * PyModule_FromDefAndSpec(PyModuleDef *def, PyObject *spec)
390390
391-
Create a new module object, given the definition in *module* and the
391+
Create a new module object, given the definition in *def* and the
392392
ModuleSpec *spec*. This behaves like :c:func:`PyModule_FromDefAndSpec2`
393393
with *module_api_version* set to :const:`PYTHON_API_VERSION`.
394394
395395
.. versionadded:: 3.5
396396
397397
.. c:function:: PyObject * PyModule_FromDefAndSpec2(PyModuleDef *def, PyObject *spec, int module_api_version)
398398
399-
Create a new module object, given the definition in *module* and the
399+
Create a new module object, given the definition in *def* and the
400400
ModuleSpec *spec*, assuming the API version *module_api_version*.
401401
If that version does not match the version of the running interpreter,
402402
a :exc:`RuntimeWarning` is emitted.

Doc/c-api/object.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ Object Protocol
281281
282282
.. c:function:: Py_hash_t PyObject_HashNotImplemented(PyObject *o)
283283
284-
Set a :exc:`TypeError` indicating that ``type(o)`` is not hashable and return ``-1``.
284+
Set a :exc:`TypeError` indicating that ``type(o)`` is not :term:`hashable` and return ``-1``.
285285
This function receives special treatment when stored in a ``tp_hash`` slot,
286286
allowing a type to explicitly indicate to the interpreter that it is not
287287
hashable.

Doc/c-api/typeobj.rst

+10
Original file line numberDiff line numberDiff line change
@@ -1313,6 +1313,16 @@ and :c:type:`PyType_Type` effectively act as defaults.)
13131313
.. versionadded:: 3.10
13141314

13151315

1316+
.. data:: Py_TPFLAGS_VALID_VERSION_TAG
1317+
1318+
Internal. Do not set or unset this flag.
1319+
To indicate that a class has changed call :c:func:`PyType_Modified`
1320+
1321+
.. warning::
1322+
This flag is present in header files, but is an internal feature and should
1323+
not be used. It will be removed in a future version of CPython
1324+
1325+
13161326
.. c:member:: const char* PyTypeObject.tp_doc
13171327
13181328
An optional pointer to a NUL-terminated C string giving the docstring for this

Doc/data/refcounts.dat

+3
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,9 @@ PyErr_GetExcInfo:PyObject**:ptype:+1:
606606
PyErr_GetExcInfo:PyObject**:pvalue:+1:
607607
PyErr_GetExcInfo:PyObject**:ptraceback:+1:
608608

609+
PyErr_GetRaisedException:PyObject*::+1:
610+
PyErr_SetRaisedException::::
611+
609612
PyErr_GivenExceptionMatches:int:::
610613
PyErr_GivenExceptionMatches:PyObject*:given:0:
611614
PyErr_GivenExceptionMatches:PyObject*:exc:0:

Doc/data/stable_abi.dat

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Doc/faq/general.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ Are there any published articles about Python that I can reference?
248248

249249
It's probably best to cite your favorite book about Python.
250250

251-
The very first article about Python was written in 1991 and is now quite
252-
outdated.
251+
The `very first article <https://ir.cwi.nl/pub/18204>`_ about Python was
252+
written in 1991 and is now quite outdated.
253253

254254
Guido van Rossum and Jelke de Boer, "Interactively Testing Remote Servers
255255
Using the Python Programming Language", CWI Quarterly, Volume 4, Issue 4

Doc/faq/programming.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1979,7 +1979,7 @@ method result will be released right away. The disadvantage is that if
19791979
instances accumulate, so too will the accumulated method results. They
19801980
can grow without bound.
19811981

1982-
The *lru_cache* approach works with methods that have hashable
1982+
The *lru_cache* approach works with methods that have :term:`hashable`
19831983
arguments. It creates a reference to the instance unless special
19841984
efforts are made to pass in weak references.
19851985

0 commit comments

Comments
 (0)