Skip to content

Commit 28b43f6

Browse files
authored
Merge branch 'main' into fix-referencelink
2 parents 545fb04 + 6c450f4 commit 28b43f6

28 files changed

+725
-448
lines changed

Doc/c-api/unicode.rst

+41
Original file line numberDiff line numberDiff line change
@@ -1398,6 +1398,20 @@ They all return ``NULL`` or ``-1`` if an exception occurs.
13981398
separator. At most *maxsplit* splits will be done. If negative, no limit is
13991399
set. Separators are not included in the resulting list.
14001400
1401+
On error, return ``NULL`` with an exception set.
1402+
1403+
Equivalent to :py:meth:`str.split`.
1404+
1405+
1406+
.. c:function:: PyObject* PyUnicode_RSplit(PyObject *unicode, PyObject *sep, Py_ssize_t maxsplit)
1407+
1408+
Similar to :c:func:`PyUnicode_Split`, but splitting will be done beginning
1409+
at the end of the string.
1410+
1411+
On error, return ``NULL`` with an exception set.
1412+
1413+
Equivalent to :py:meth:`str.rsplit`.
1414+
14011415
14021416
.. c:function:: PyObject* PyUnicode_Splitlines(PyObject *unicode, int keepends)
14031417
@@ -1406,6 +1420,33 @@ They all return ``NULL`` or ``-1`` if an exception occurs.
14061420
characters are not included in the resulting strings.
14071421
14081422
1423+
.. c:function:: PyObject* PyUnicode_Partition(PyObject *unicode, PyObject *sep)
1424+
1425+
Split a Unicode string at the first occurrence of *sep*, and return
1426+
a 3-tuple containing the part before the separator, the separator itself,
1427+
and the part after the separator. If the separator is not found,
1428+
return a 3-tuple containing the string itself, followed by two empty strings.
1429+
1430+
*sep* must not be empty.
1431+
1432+
On error, return ``NULL`` with an exception set.
1433+
1434+
Equivalent to :py:meth:`str.partition`.
1435+
1436+
1437+
.. c:function:: PyObject* PyUnicode_RPartition(PyObject *unicode, PyObject *sep)
1438+
1439+
Similar to :c:func:`PyUnicode_Partition`, but split a Unicode string at the
1440+
last occurrence of *sep*. If the separator is not found, return a 3-tuple
1441+
containing two empty strings, followed by the string itself.
1442+
1443+
*sep* must not be empty.
1444+
1445+
On error, return ``NULL`` with an exception set.
1446+
1447+
Equivalent to :py:meth:`str.rpartition`.
1448+
1449+
14091450
.. c:function:: PyObject* PyUnicode_Join(PyObject *separator, PyObject *seq)
14101451
14111452
Join a sequence of strings using the given *separator* and return the resulting

Doc/data/refcounts.dat

+16-3
Original file line numberDiff line numberDiff line change
@@ -2655,13 +2655,26 @@ PyUnicode_Concat:PyObject*::+1:
26552655
PyUnicode_Concat:PyObject*:left:0:
26562656
PyUnicode_Concat:PyObject*:right:0:
26572657

2658+
PyUnicode_Partition:PyObject*::+1:
2659+
PyUnicode_Partition:PyObject*:unicode:0:
2660+
PyUnicode_Partition:PyObject*:sep:0:
2661+
2662+
PyUnicode_RPartition:PyObject*::+1:
2663+
PyUnicode_RPartition:PyObject*:unicode:0:
2664+
PyUnicode_RPartition:PyObject*:sep:0:
2665+
2666+
PyUnicode_RSplit:PyObject*::+1:
2667+
PyUnicode_RSplit:PyObject*:unicode:0:
2668+
PyUnicode_RSplit:PyObject*:sep:0:
2669+
PyUnicode_RSplit:Py_ssize_t:maxsplit::
2670+
26582671
PyUnicode_Split:PyObject*::+1:
2659-
PyUnicode_Split:PyObject*:left:0:
2660-
PyUnicode_Split:PyObject*:right:0:
2672+
PyUnicode_Split:PyObject*:unicode:0:
2673+
PyUnicode_Split:PyObject*:sep:0:
26612674
PyUnicode_Split:Py_ssize_t:maxsplit::
26622675

26632676
PyUnicode_Splitlines:PyObject*::+1:
2664-
PyUnicode_Splitlines:PyObject*:s:0:
2677+
PyUnicode_Splitlines:PyObject*:unicode:0:
26652678
PyUnicode_Splitlines:int:keepend::
26662679

26672680
PyUnicode_Translate:PyObject*::+1:

Doc/deprecations/c-api-pending-removal-in-3.18.rst

+26
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,32 @@ Pending removal in Python 3.18
1111
use :c:func:`PyLongWriter_Create`.
1212
* :c:func:`!_PyThreadState_UncheckedGet`: use :c:func:`PyThreadState_GetUnchecked`.
1313
* :c:func:`!_PyUnicode_AsString`: use :c:func:`PyUnicode_AsUTF8`.
14+
* :c:func:`!_PyUnicodeWriter_Init`:
15+
replace ``_PyUnicodeWriter_Init(&writer)`` with
16+
:c:func:`writer = PyUnicodeWriter_Create(0) <PyUnicodeWriter_Create>`.
17+
* :c:func:`!_PyUnicodeWriter_Finish`:
18+
replace ``_PyUnicodeWriter_Finish(&writer)`` with
19+
:c:func:`PyUnicodeWriter_Finish(writer) <PyUnicodeWriter_Finish>`.
20+
* :c:func:`!_PyUnicodeWriter_Dealloc`:
21+
replace ``_PyUnicodeWriter_Dealloc(&writer)`` with
22+
:c:func:`PyUnicodeWriter_Discard(writer) <PyUnicodeWriter_Discard>`.
23+
* :c:func:`!_PyUnicodeWriter_WriteChar`:
24+
replace ``_PyUnicodeWriter_WriteChar(&writer, ch)`` with
25+
:c:func:`PyUnicodeWriter_WriteChar(writer, ch) <PyUnicodeWriter_WriteChar>`.
26+
* :c:func:`!_PyUnicodeWriter_WriteStr`:
27+
replace ``_PyUnicodeWriter_WriteStr(&writer, str)`` with
28+
:c:func:`PyUnicodeWriter_WriteStr(writer, str) <PyUnicodeWriter_WriteStr>`.
29+
* :c:func:`!_PyUnicodeWriter_WriteSubstring`:
30+
replace ``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` with
31+
:c:func:`PyUnicodeWriter_WriteSubstring(writer, str, start, end) <PyUnicodeWriter_WriteSubstring>`.
32+
* :c:func:`!_PyUnicodeWriter_WriteASCIIString`:
33+
replace ``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` with
34+
:c:func:`PyUnicodeWriter_WriteUTF8(writer, str) <PyUnicodeWriter_WriteUTF8>`.
35+
* :c:func:`!_PyUnicodeWriter_WriteLatin1String`:
36+
replace ``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` with
37+
:c:func:`PyUnicodeWriter_WriteUTF8(writer, str) <PyUnicodeWriter_WriteUTF8>`.
38+
* :c:func:`!_PyUnicodeWriter_Prepare`: (no replacement).
39+
* :c:func:`!_PyUnicodeWriter_PrepareKind`: (no replacement).
1440
* :c:func:`!_Py_HashPointer`: use :c:func:`Py_HashPointer`.
1541
* :c:func:`!_Py_fopen_obj`: use :c:func:`Py_fopen`.
1642

Doc/howto/logging-cookbook.rst

+16-3
Original file line numberDiff line numberDiff line change
@@ -825,16 +825,29 @@ To test these files, do the following in a POSIX environment:
825825
which will lead to records being written to the log.
826826

827827
#. Inspect the log files in the :file:`run` subdirectory. You should see the
828-
most recent log lines in files matching the pattern :file:`app.log*`. They won't be in
829-
any particular order, since they have been handled concurrently by different
830-
worker processes in a non-deterministic way.
828+
most recent log lines in files matching the pattern :file:`app.log*`. They
829+
won't be in any particular order, since they have been handled concurrently
830+
by different worker processes in a non-deterministic way.
831831

832832
#. You can shut down the listener and the web application by running
833833
``venv/bin/supervisorctl -c supervisor.conf shutdown``.
834834

835835
You may need to tweak the configuration files in the unlikely event that the
836836
configured ports clash with something else in your test environment.
837837

838+
The default configuration uses a TCP socket on port 9020. You can use a Unix
839+
Domain socket instead of a TCP socket by doing the following:
840+
841+
#. In :file:`listener.json`, add a ``socket`` key with the path to the domain
842+
socket you want to use. If this key is present, the listener listens on the
843+
corresponding domain socket and not on a TCP socket (the ``port`` key is
844+
ignored).
845+
846+
#. In :file:`webapp.json`, change the socket handler configuration dictionary
847+
so that the ``host`` value is the path to the domain socket, and set the
848+
``port`` value to ``null``.
849+
850+
838851
.. currentmodule:: logging
839852

840853
.. _context-info:

Doc/library/readline.rst

+23-23
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ The following functions relate to the init file and user configuration:
6565
.. function:: parse_and_bind(string)
6666

6767
Execute the init line provided in the *string* argument. This calls
68-
:c:func:`rl_parse_and_bind` in the underlying library.
68+
:c:func:`!rl_parse_and_bind` in the underlying library.
6969

7070

7171
.. function:: read_init_file([filename])
7272

7373
Execute a readline initialization file. The default filename is the last filename
74-
used. This calls :c:func:`rl_read_init_file` in the underlying library.
74+
used. This calls :c:func:`!rl_read_init_file` in the underlying library.
7575

7676

7777
Line buffer
@@ -82,21 +82,21 @@ The following functions operate on the line buffer:
8282

8383
.. function:: get_line_buffer()
8484

85-
Return the current contents of the line buffer (:c:data:`rl_line_buffer`
85+
Return the current contents of the line buffer (:c:data:`!rl_line_buffer`
8686
in the underlying library).
8787

8888

8989
.. function:: insert_text(string)
9090

9191
Insert text into the line buffer at the cursor position. This calls
92-
:c:func:`rl_insert_text` in the underlying library, but ignores
92+
:c:func:`!rl_insert_text` in the underlying library, but ignores
9393
the return value.
9494

9595

9696
.. function:: redisplay()
9797

9898
Change what's displayed on the screen to reflect the current contents of the
99-
line buffer. This calls :c:func:`rl_redisplay` in the underlying library.
99+
line buffer. This calls :c:func:`!rl_redisplay` in the underlying library.
100100

101101

102102
History file
@@ -109,21 +109,21 @@ The following functions operate on a history file:
109109

110110
Load a readline history file, and append it to the history list.
111111
The default filename is :file:`~/.history`. This calls
112-
:c:func:`read_history` in the underlying library.
112+
:c:func:`!read_history` in the underlying library.
113113

114114

115115
.. function:: write_history_file([filename])
116116

117117
Save the history list to a readline history file, overwriting any
118118
existing file. The default filename is :file:`~/.history`. This calls
119-
:c:func:`write_history` in the underlying library.
119+
:c:func:`!write_history` in the underlying library.
120120

121121

122122
.. function:: append_history_file(nelements[, filename])
123123

124124
Append the last *nelements* items of history to a file. The default filename is
125125
:file:`~/.history`. The file must already exist. This calls
126-
:c:func:`append_history` in the underlying library. This function
126+
:c:func:`!append_history` in the underlying library. This function
127127
only exists if Python was compiled for a version of the library
128128
that supports it.
129129

@@ -135,7 +135,7 @@ The following functions operate on a history file:
135135

136136
Set or return the desired number of lines to save in the history file.
137137
The :func:`write_history_file` function uses this value to truncate
138-
the history file, by calling :c:func:`history_truncate_file` in
138+
the history file, by calling :c:func:`!history_truncate_file` in
139139
the underlying library. Negative values imply
140140
unlimited history file size.
141141

@@ -148,7 +148,7 @@ The following functions operate on a global history list:
148148

149149
.. function:: clear_history()
150150

151-
Clear the current history. This calls :c:func:`clear_history` in the
151+
Clear the current history. This calls :c:func:`!clear_history` in the
152152
underlying library. The Python function only exists if Python was
153153
compiled for a version of the library that supports it.
154154

@@ -163,32 +163,32 @@ The following functions operate on a global history list:
163163
.. function:: get_history_item(index)
164164

165165
Return the current contents of history item at *index*. The item index
166-
is one-based. This calls :c:func:`history_get` in the underlying library.
166+
is one-based. This calls :c:func:`!history_get` in the underlying library.
167167

168168

169169
.. function:: remove_history_item(pos)
170170

171171
Remove history item specified by its position from the history.
172-
The position is zero-based. This calls :c:func:`remove_history` in
172+
The position is zero-based. This calls :c:func:`!remove_history` in
173173
the underlying library.
174174

175175

176176
.. function:: replace_history_item(pos, line)
177177

178178
Replace history item specified by its position with *line*.
179-
The position is zero-based. This calls :c:func:`replace_history_entry`
179+
The position is zero-based. This calls :c:func:`!replace_history_entry`
180180
in the underlying library.
181181

182182

183183
.. function:: add_history(line)
184184

185185
Append *line* to the history buffer, as if it was the last line typed.
186-
This calls :c:func:`add_history` in the underlying library.
186+
This calls :c:func:`!add_history` in the underlying library.
187187

188188

189189
.. function:: set_auto_history(enabled)
190190

191-
Enable or disable automatic calls to :c:func:`add_history` when reading
191+
Enable or disable automatic calls to :c:func:`!add_history` when reading
192192
input via readline. The *enabled* argument should be a Boolean value
193193
that when true, enables auto history, and that when false, disables
194194
auto history.
@@ -206,7 +206,7 @@ Startup hooks
206206

207207
.. function:: set_startup_hook([function])
208208

209-
Set or remove the function invoked by the :c:data:`rl_startup_hook`
209+
Set or remove the function invoked by the :c:data:`!rl_startup_hook`
210210
callback of the underlying library. If *function* is specified, it will
211211
be used as the new hook function; if omitted or ``None``, any function
212212
already installed is removed. The hook is called with no
@@ -215,7 +215,7 @@ Startup hooks
215215

216216
.. function:: set_pre_input_hook([function])
217217

218-
Set or remove the function invoked by the :c:data:`rl_pre_input_hook`
218+
Set or remove the function invoked by the :c:data:`!rl_pre_input_hook`
219219
callback of the underlying library. If *function* is specified, it will
220220
be used as the new hook function; if omitted or ``None``, any
221221
function already installed is removed. The hook is called
@@ -247,9 +247,9 @@ with a custom completer, a different set of word delimiters should be set.
247247
starting with *text*.
248248

249249
The installed completer function is invoked by the *entry_func* callback
250-
passed to :c:func:`rl_completion_matches` in the underlying library.
250+
passed to :c:func:`!rl_completion_matches` in the underlying library.
251251
The *text* string comes from the first parameter to the
252-
:c:data:`rl_attempted_completion_function` callback of the
252+
:c:data:`!rl_attempted_completion_function` callback of the
253253
underlying library.
254254

255255

@@ -261,7 +261,7 @@ with a custom completer, a different set of word delimiters should be set.
261261
.. function:: get_completion_type()
262262

263263
Get the type of completion being attempted. This returns the
264-
:c:data:`rl_completion_type` variable in the underlying library as
264+
:c:data:`!rl_completion_type` variable in the underlying library as
265265
an integer.
266266

267267

@@ -270,7 +270,7 @@ with a custom completer, a different set of word delimiters should be set.
270270

271271
Get the beginning or ending index of the completion scope.
272272
These indexes are the *start* and *end* arguments passed to the
273-
:c:data:`rl_attempted_completion_function` callback of the
273+
:c:data:`!rl_attempted_completion_function` callback of the
274274
underlying library. The values may be different in the same
275275
input editing scenario based on the underlying C readline implementation.
276276
Ex: libedit is known to behave differently than libreadline.
@@ -281,7 +281,7 @@ with a custom completer, a different set of word delimiters should be set.
281281

282282
Set or get the word delimiters for completion. These determine the
283283
start of the word to be considered for completion (the completion scope).
284-
These functions access the :c:data:`rl_completer_word_break_characters`
284+
These functions access the :c:data:`!rl_completer_word_break_characters`
285285
variable in the underlying library.
286286

287287

@@ -291,7 +291,7 @@ with a custom completer, a different set of word delimiters should be set.
291291
specified, it will be used as the new completion display function;
292292
if omitted or ``None``, any completion display function already
293293
installed is removed. This sets or clears the
294-
:c:data:`rl_completion_display_matches_hook` callback in the
294+
:c:data:`!rl_completion_display_matches_hook` callback in the
295295
underlying library. The completion display function is called as
296296
``function(substitution, [matches], longest_match_length)`` once
297297
each time matches need to be displayed.

Doc/tools/.nitignore

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ Doc/library/platform.rst
3838
Doc/library/plistlib.rst
3939
Doc/library/profile.rst
4040
Doc/library/pyexpat.rst
41-
Doc/library/readline.rst
4241
Doc/library/resource.rst
4342
Doc/library/select.rst
4443
Doc/library/signal.rst

0 commit comments

Comments
 (0)