Skip to content

Commit 3ddbcf2

Browse files
committed
Merge remote-tracking branch 'upstream/main' into gh-139270
2 parents 44e9cf7 + d2deb8f commit 3ddbcf2

File tree

13 files changed

+1602
-234
lines changed

13 files changed

+1602
-234
lines changed

Doc/c-api/init.rst

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ code, or when embedding the Python interpreter:
11131113
This function is safe to call without an :term:`attached thread state`; it
11141114
will simply return ``NULL`` indicating that there was no prior thread state.
11151115
1116-
.. seealso:
1116+
.. seealso::
11171117
:c:func:`PyEval_ReleaseThread`
11181118
11191119
.. note::
@@ -1124,6 +1124,19 @@ code, or when embedding the Python interpreter:
11241124
The following functions use thread-local storage, and are not compatible
11251125
with sub-interpreters:
11261126
1127+
.. c:type:: PyGILState_STATE
1128+
1129+
The type of the value returned by :c:func:`PyGILState_Ensure` and passed to
1130+
:c:func:`PyGILState_Release`.
1131+
1132+
.. c:enumerator:: PyGILState_LOCKED
1133+
1134+
The GIL was already held when :c:func:`PyGILState_Ensure` was called.
1135+
1136+
.. c:enumerator:: PyGILState_UNLOCKED
1137+
1138+
The GIL was not held when :c:func:`PyGILState_Ensure` was called.
1139+
11271140
.. c:function:: PyGILState_STATE PyGILState_Ensure()
11281141
11291142
Ensure that the current thread is ready to call the Python C API regardless
@@ -1174,12 +1187,12 @@ with sub-interpreters:
11741187
made on the main thread. This is mainly a helper/diagnostic function.
11751188
11761189
.. note::
1177-
This function does not account for :term:`thread states <thread state>` created
1178-
by something other than :c:func:`PyGILState_Ensure` (such as :c:func:`PyThreadState_New`).
1190+
This function may return non-``NULL`` even when the :term:`thread state`
1191+
is detached.
11791192
Prefer :c:func:`PyThreadState_Get` or :c:func:`PyThreadState_GetUnchecked`
11801193
for most cases.
11811194
1182-
.. seealso: :c:func:`PyThreadState_Get``
1195+
.. seealso:: :c:func:`PyThreadState_Get`
11831196
11841197
.. c:function:: int PyGILState_Check()
11851198
@@ -1278,11 +1291,11 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
12781291
must be :term:`attached <attached thread state>`
12791292
12801293
.. versionchanged:: 3.9
1281-
This function now calls the :c:member:`PyThreadState.on_delete` callback.
1294+
This function now calls the :c:member:`!PyThreadState.on_delete` callback.
12821295
Previously, that happened in :c:func:`PyThreadState_Delete`.
12831296
12841297
.. versionchanged:: 3.13
1285-
The :c:member:`PyThreadState.on_delete` callback was removed.
1298+
The :c:member:`!PyThreadState.on_delete` callback was removed.
12861299
12871300
12881301
.. c:function:: void PyThreadState_Delete(PyThreadState *tstate)

Doc/library/ssl.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,8 @@ Random generation
354354
.. function:: RAND_status()
355355

356356
Return ``True`` if the SSL pseudo-random number generator has been seeded
357-
with 'enough' randomness, and ``False`` otherwise. You can use
358-
:func:`ssl.RAND_egd` and :func:`ssl.RAND_add` to increase the randomness of
359-
the pseudo-random number generator.
357+
with 'enough' randomness, and ``False`` otherwise. Use :func:`ssl.RAND_add`
358+
to increase the randomness of the pseudo-random number generator.
360359

361360
.. function:: RAND_add(bytes, entropy, /)
362361

Doc/tools/.nitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
Doc/c-api/descriptor.rst
66
Doc/c-api/float.rst
7-
Doc/c-api/init.rst
87
Doc/c-api/init_config.rst
98
Doc/c-api/intro.rst
109
Doc/c-api/module.rst

Lib/idlelib/colorizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def make_pat():
4747
name not in keyword.kwlist]
4848
builtin = r"([^.'\"\\#]\b|^)" + any("BUILTIN", builtinlist) + r"\b"
4949
comment = any("COMMENT", [r"#[^\n]*"])
50-
stringprefix = r"(?i:r|u|f|fr|rf|b|br|rb)?"
50+
stringprefix = r"(?i:r|u|f|fr|rf|b|br|rb|t|rt|tr)?"
5151
sqstring = stringprefix + r"'[^'\\\n]*(\\.[^'\\\n]*)*'?"
5252
dqstring = stringprefix + r'"[^"\\\n]*(\\.[^"\\\n]*)*"?'
5353
sq3string = stringprefix + r"'''[^'\\]*((\\.|'(?!''))[^'\\]*)*(''')?"

Lib/idlelib/idle_test/test_colorizer.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ async def f(): await g()
3636
# All valid prefixes for unicode and byte strings should be colored.
3737
r'x', u'x', R'x', U'x', f'x', F'x'
3838
fr'x', Fr'x', fR'x', FR'x', rf'x', rF'x', Rf'x', RF'x'
39+
tr'x', Tr'x', tR'x', TR'x', rt'x', rT'x', Rt'x', RT'x'
3940
b'x',B'x', br'x',Br'x',bR'x',BR'x', rb'x', rB'x',Rb'x',RB'x'
4041
# Invalid combinations of legal characters should be half colored.
4142
ur'x', ru'x', uf'x', fu'x', UR'x', ufr'x', rfu'x', xf'x', fx'x'
@@ -390,19 +391,19 @@ def test_recolorize_main(self, mock_notify):
390391
('6.0', ('KEYWORD',)), ('6.10', ('DEFINITION',)), ('6.11', ()),
391392
('8.0', ('STRING',)), ('8.4', ()), ('8.5', ('STRING',)),
392393
('8.12', ()), ('8.14', ('STRING',)),
393-
('19.0', ('KEYWORD',)),
394-
('20.4', ('KEYWORD',)), ('20.16', ('KEYWORD',)),# ('20.19', ('KEYWORD',)),
395-
#('22.4', ('KEYWORD',)), ('22.10', ('KEYWORD',)), ('22.14', ('KEYWORD',)), ('22.19', ('STRING',)),
396-
#('23.12', ('KEYWORD',)),
397-
('24.8', ('KEYWORD',)),
398-
('25.4', ('KEYWORD',)), ('25.9', ('KEYWORD',)),
399-
('25.11', ('KEYWORD',)), ('25.15', ('STRING',)),
400-
('25.19', ('KEYWORD',)), ('25.22', ()),
401-
('25.24', ('KEYWORD',)), ('25.29', ('BUILTIN',)), ('25.37', ('KEYWORD',)),
402-
('26.4', ('KEYWORD',)), ('26.9', ('KEYWORD',)),# ('26.11', ('KEYWORD',)), ('26.14', (),),
403-
('27.25', ('STRING',)), ('27.38', ('STRING',)),
404-
('29.0', ('STRING',)),
405-
('30.1', ('STRING',)),
394+
('20.0', ('KEYWORD',)),
395+
('21.4', ('KEYWORD',)), ('21.16', ('KEYWORD',)),# ('21.19', ('KEYWORD',)),
396+
#('23.4', ('KEYWORD',)), ('23.10', ('KEYWORD',)), ('23.14', ('KEYWORD',)), ('23.19', ('STRING',)),
397+
#('24.12', ('KEYWORD',)),
398+
('25.8', ('KEYWORD',)),
399+
('26.4', ('KEYWORD',)), ('26.9', ('KEYWORD',)),
400+
('26.11', ('KEYWORD',)), ('26.15', ('STRING',)),
401+
('26.19', ('KEYWORD',)), ('26.22', ()),
402+
('26.24', ('KEYWORD',)), ('26.29', ('BUILTIN',)), ('26.37', ('KEYWORD',)),
403+
('27.4', ('KEYWORD',)), ('27.9', ('KEYWORD',)),# ('27.11', ('KEYWORD',)), ('27.14', (),),
404+
('28.25', ('STRING',)), ('28.38', ('STRING',)),
405+
('30.0', ('STRING',)),
406+
('31.1', ('STRING',)),
406407
# SYNC at the end of every line.
407408
('1.55', ('SYNC',)), ('2.50', ('SYNC',)), ('3.34', ('SYNC',)),
408409
)
@@ -433,7 +434,7 @@ def test_recolorize_main(self, mock_notify):
433434
eq(text.tag_nextrange('STRING', '8.12'), ('8.14', '8.17'))
434435
eq(text.tag_nextrange('STRING', '8.17'), ('8.19', '8.26'))
435436
eq(text.tag_nextrange('SYNC', '8.0'), ('8.26', '9.0'))
436-
eq(text.tag_nextrange('SYNC', '30.0'), ('30.10', '32.0'))
437+
eq(text.tag_nextrange('SYNC', '31.0'), ('31.10', '33.0'))
437438

438439
def _assert_highlighting(self, source, tag_ranges):
439440
"""Check highlighting of a given piece of code.

Lib/ssl.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,6 @@
110110
)
111111
from _ssl import txt2obj as _txt2obj, nid2obj as _nid2obj
112112
from _ssl import RAND_status, RAND_add, RAND_bytes
113-
try:
114-
from _ssl import RAND_egd
115-
except ImportError:
116-
# RAND_egd is not supported on some platforms
117-
pass
118113
from _ssl import get_sigalgs
119114

120115

0 commit comments

Comments
 (0)