Skip to content

Commit b2adc44

Browse files
GH-137759: Limit _PyObject_HashFast to dict keys
1 parent 47b7dc7 commit b2adc44

252 files changed

Lines changed: 2667 additions & 4345 deletions

File tree

Some content is hidden

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

.github/SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Security Policy
22

33
Python [provides a security policy and threat model](https://devguide.python.org/security/policy/)
4-
in the Python Developer's Guide documenting what bugs are vulnerabilities,
4+
in the Python Development Guide documenting what bugs are vulnerabilities,
55
how to structure reports, and what versions of Python accept reports.
66

77
Python Security Response Team (PSRT) members

.github/workflows/build.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -278,13 +278,14 @@ jobs:
278278
# unsupported as it most resembles other 1.1.1-work-a-like ssl APIs
279279
# supported by important vendors such as AWS-LC.
280280
- { name: openssl, version: 1.1.1w }
281-
- { name: openssl, version: 3.0.21 }
282-
- { name: openssl, version: 3.4.6 }
283-
- { name: openssl, version: 3.5.7 }
284-
- { name: openssl, version: 3.6.3 }
285-
- { name: openssl, version: 4.0.1 }
281+
- { name: openssl, version: 3.0.20 }
282+
- { name: openssl, version: 3.3.7 }
283+
- { name: openssl, version: 3.4.5 }
284+
- { name: openssl, version: 3.5.6 }
285+
- { name: openssl, version: 3.6.2 }
286+
- { name: openssl, version: 4.0.0 }
286287
## AWS-LC
287-
- { name: aws-lc, version: 5.0.0 }
288+
- { name: aws-lc, version: 1.72.1 }
288289
env:
289290
SSLLIB_VER: ${{ matrix.ssllib.version }}
290291
MULTISSL_DIR: ${{ github.workspace }}/multissl
@@ -398,7 +399,7 @@ jobs:
398399
needs: build-context
399400
if: needs.build-context.outputs.run-ubuntu == 'true'
400401
env:
401-
OPENSSL_VER: 3.5.7
402+
OPENSSL_VER: 3.5.6
402403
PYTHONSTRICTEXTENSIONBUILD: 1
403404
steps:
404405
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -506,7 +507,7 @@ jobs:
506507
matrix:
507508
os: [ubuntu-24.04]
508509
env:
509-
OPENSSL_VER: 3.5.7
510+
OPENSSL_VER: 3.5.6
510511
PYTHONSTRICTEXTENSIONBUILD: 1
511512
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
512513
steps:

.github/workflows/reusable-san.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,19 @@ jobs:
8282
run: make -j4
8383
- name: Display build info
8484
run: make pythoninfo
85+
# test_{capi,faulthandler} are skipped under UBSan because
86+
# they raise signals that UBSan with halt_on_error=1 intercepts.
8587
- name: Tests
8688
run: >-
8789
./python -m test
8890
${{ inputs.sanitizer == 'TSan' && '--tsan' || '' }}
89-
-j4 -W
91+
${{ inputs.sanitizer == 'UBSan' && '-x test_capi -x test_faulthandler' || '' }}
92+
-j4
9093
- name: Parallel tests
9194
if: >-
9295
inputs.sanitizer == 'TSan'
9396
&& fromJSON(inputs.free-threading)
94-
run: ./python -m test --tsan-parallel --parallel-threads=4 -j4 -W
97+
run: ./python -m test --tsan-parallel --parallel-threads=4 -j4
9598
- name: Display logs
9699
if: always()
97100
run: find "${GITHUB_WORKSPACE}" -name 'san_log.*' | xargs head -n 1000

.github/workflows/reusable-ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
runs-on: ${{ inputs.os }}
3636
timeout-minutes: 60
3737
env:
38-
OPENSSL_VER: 3.5.7
38+
OPENSSL_VER: 3.5.6
3939
PYTHONSTRICTEXTENSIONBUILD: 1
4040
TERM: linux
4141
steps:

Doc/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ htmlhelp: build
8888
"build/htmlhelp/pydoc.hhp project file."
8989

9090
.PHONY: latex
91-
latex: BUILDER = latex
9291
latex: _ensure-sphinxcontrib-svg2pdfconverter
93-
$(MAKE) build BUILDER=$(BUILDER)
92+
latex: BUILDER = latex
93+
latex: build
9494
@echo "Build finished; the LaTeX files are in build/latex."
9595
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
9696
"run these through (pdf)latex."

Doc/c-api/coro.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,3 @@ return.
3333
with ``__name__`` and ``__qualname__`` set to *name* and *qualname*.
3434
A reference to *frame* is stolen by this function. The *frame* argument
3535
must not be ``NULL``.
36-
37-
.. deprecated-removed:: 3.16 3.18
38-
39-
This function has not been used since 3.10.
40-
It is also impossible to construct a proper *frame*
41-
object to call this function.

Doc/c-api/gen.rst

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,13 @@ than explicitly calling :c:func:`PyGen_New` or :c:func:`PyGen_NewWithQualName`.
3838
A reference to *frame* is stolen by this function. The argument must not be
3939
``NULL``.
4040
41-
.. deprecated-removed:: 3.16 3.18
42-
43-
This function has not been used since 3.10.
44-
It is also impossible to construct a proper *frame*
45-
object to call this function.
46-
4741
.. c:function:: PyObject* PyGen_NewWithQualName(PyFrameObject *frame, PyObject *name, PyObject *qualname)
4842
4943
Create and return a new generator object based on the *frame* object,
5044
with ``__name__`` and ``__qualname__`` set to *name* and *qualname*.
5145
A reference to *frame* is stolen by this function. The *frame* argument
5246
must not be ``NULL``.
5347
54-
.. deprecated-removed:: 3.16 3.18
55-
56-
This function has not been used since 3.10.
57-
It is also impossible to construct a proper *frame*
58-
object to call this function.
59-
6048
6149
.. c:function:: PyCodeObject* PyGen_GetCode(PyGenObject *gen)
6250
@@ -89,12 +77,6 @@ Asynchronous Generator Objects
8977
9078
.. versionadded:: 3.6
9179
92-
.. deprecated-removed:: 3.16 3.18
93-
94-
This function has not been used since 3.10.
95-
It is also impossible to construct a proper *frame*
96-
object to call this function.
97-
9880
.. c:function:: int PyAsyncGen_CheckExact(PyObject *op)
9981
10082
Return true if *op* is an asynchronous generator object, false otherwise.

Doc/c-api/memory.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ memory footprint as a whole. Consequently, under certain circumstances, the
7777
Python memory manager may or may not trigger appropriate actions, like garbage
7878
collection, memory compaction or other preventive procedures. Note that by using
7979
the C library allocator as shown in the previous example, the allocated memory
80-
for the I/O buffer completely escapes the Python memory manager.
80+
for the I/O buffer escapes completely the Python memory manager.
8181

8282
.. seealso::
8383

@@ -157,7 +157,7 @@ zero bytes.
157157
158158
.. c:function:: void* PyMem_RawCalloc(size_t nelem, size_t elsize)
159159
160-
Allocates *nelem* elements each of size *elsize* bytes and returns
160+
Allocates *nelem* elements each whose size in bytes is *elsize* and returns
161161
a pointer of type :c:expr:`void*` to the allocated memory, or ``NULL`` if the
162162
request fails. The memory is initialized to zeros.
163163
@@ -235,7 +235,7 @@ In the GIL-enabled build (default build) the
235235
236236
.. c:function:: void* PyMem_Calloc(size_t nelem, size_t elsize)
237237
238-
Allocates *nelem* elements each of size *elsize* bytes and returns
238+
Allocates *nelem* elements each whose size in bytes is *elsize* and returns
239239
a pointer of type :c:expr:`void*` to the allocated memory, or ``NULL`` if the
240240
request fails. The memory is initialized to zeros.
241241
@@ -368,7 +368,7 @@ The :ref:`default object allocator <default-memory-allocators>` uses the
368368
369369
.. c:function:: void* PyObject_Calloc(size_t nelem, size_t elsize)
370370
371-
Allocates *nelem* elements each of size *elsize* bytes and returns
371+
Allocates *nelem* elements each whose size in bytes is *elsize* and returns
372372
a pointer of type :c:expr:`void*` to the allocated memory, or ``NULL`` if the
373373
request fails. The memory is initialized to zeros.
374374

Doc/c-api/module.rst

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -247,15 +247,6 @@ Feature slots
247247
If ``Py_mod_multiple_interpreters`` is not specified, the import
248248
machinery defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED``.
249249
250-
For historical reasons, the values are declared as pointers (``void *``).
251-
When using :c:type:`PySlot` arrays, use :c:macro:`PySlot_DATA` for
252-
:c:macro:`!Py_mod_multiple_interpreters`:
253-
254-
.. code-block:: c
255-
256-
PySlot_DATA(Py_mod_multiple_interpreters,
257-
Py_MOD_PER_INTERPRETER_GIL_SUPPORTED)
258-
259250
.. versionadded:: 3.12
260251
261252
.. c:macro:: Py_mod_gil
@@ -281,14 +272,6 @@ Feature slots
281272
If ``Py_mod_gil`` is not specified, the import machinery defaults to
282273
``Py_MOD_GIL_USED``.
283274
284-
For historical reasons, the values are declared as pointers (``void *``).
285-
When using :c:type:`PySlot` arrays, use :c:macro:`PySlot_DATA` for
286-
:c:macro:`!Py_mod_gil`:
287-
288-
.. code-block:: c
289-
290-
PySlot_DATA(Py_mod_gil, Py_MOD_GIL_NOT_USED)
291-
292275
.. versionadded:: 3.13
293276
294277

Doc/c-api/typeobj.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2975,13 +2975,13 @@ Buffer Object Structures
29752975
steps:
29762976

29772977
(1) Check if the request can be met. If not, raise :exc:`BufferError`,
2978-
set ``view->obj`` to ``NULL`` and return ``-1``.
2978+
set :c:expr:`view->obj` to ``NULL`` and return ``-1``.
29792979

29802980
(2) Fill in the requested fields.
29812981

29822982
(3) Increment an internal counter for the number of exports.
29832983

2984-
(4) Set ``view->obj`` to *exporter* and increment ``view->obj``.
2984+
(4) Set :c:expr:`view->obj` to *exporter* and increment :c:expr:`view->obj`.
29852985

29862986
(5) Return ``0``.
29872987

@@ -3007,10 +3007,10 @@ Buffer Object Structures
30073007
schemes can be used:
30083008

30093009
* Re-export: Each member of the tree acts as the exporting object and
3010-
sets ``view->obj`` to a new reference to itself.
3010+
sets :c:expr:`view->obj` to a new reference to itself.
30113011

30123012
* Redirect: The buffer request is redirected to the root object of the
3013-
tree. Here, ``view->obj`` will be a new reference to the root
3013+
tree. Here, :c:expr:`view->obj` will be a new reference to the root
30143014
object.
30153015

30163016
The individual fields of *view* are described in section
@@ -3064,7 +3064,7 @@ Buffer Object Structures
30643064
*view* argument.
30653065

30663066

3067-
This function MUST NOT decrement ``view->obj``, since that is
3067+
This function MUST NOT decrement :c:expr:`view->obj`, since that is
30683068
done automatically in :c:func:`PyBuffer_Release` (this scheme is
30693069
useful for breaking reference cycles).
30703070

0 commit comments

Comments
 (0)