Skip to content

Commit 0271b4a

Browse files
Merge branch 'main' into channel-send-buffer
2 parents dea173a + 80dc39e commit 0271b4a

File tree

105 files changed

+2608
-1315
lines changed

Some content is hidden

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

105 files changed

+2608
-1315
lines changed

Doc/c-api/init.rst

+13
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,19 @@ code, or when embedding the Python interpreter:
870870
When the current thread state is ``NULL``, this issues a fatal error (so that
871871
the caller needn't check for ``NULL``).
872872
873+
See also :c:func:`PyThreadState_GetUnchecked`.
874+
875+
876+
.. c:function:: PyThreadState* PyThreadState_GetUnchecked()
877+
878+
Similar to :c:func:`PyThreadState_Get`, but don't kill the process with a
879+
fatal error if it is NULL. The caller is responsible to check if the result
880+
is NULL.
881+
882+
.. versionadded:: 3.13
883+
In Python 3.5 to 3.12, the function was private and known as
884+
``_PyThreadState_UncheckedGet()``.
885+
873886
874887
.. c:function:: PyThreadState* PyThreadState_Swap(PyThreadState *tstate)
875888

Doc/library/ast.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -2483,26 +2483,26 @@ The following options are accepted:
24832483

24842484
.. program:: ast
24852485

2486-
.. cmdoption:: -h, --help
2486+
.. option:: -h, --help
24872487

24882488
Show the help message and exit.
24892489

2490-
.. cmdoption:: -m <mode>
2491-
--mode <mode>
2490+
.. option:: -m <mode>
2491+
--mode <mode>
24922492

24932493
Specify what kind of code must be compiled, like the *mode* argument
24942494
in :func:`parse`.
24952495

2496-
.. cmdoption:: --no-type-comments
2496+
.. option:: --no-type-comments
24972497

24982498
Don't parse type comments.
24992499

2500-
.. cmdoption:: -a, --include-attributes
2500+
.. option:: -a, --include-attributes
25012501

25022502
Include attributes such as line numbers and column offsets.
25032503

2504-
.. cmdoption:: -i <indent>
2505-
--indent <indent>
2504+
.. option:: -i <indent>
2505+
--indent <indent>
25062506

25072507
Indentation of nodes in AST (number of spaces).
25082508

Doc/library/compileall.rst

+17-17
Original file line numberDiff line numberDiff line change
@@ -26,74 +26,74 @@ compile Python sources.
2626

2727
.. program:: compileall
2828

29-
.. cmdoption:: directory ...
30-
file ...
29+
.. option:: directory ...
30+
file ...
3131

3232
Positional arguments are files to compile or directories that contain
3333
source files, traversed recursively. If no argument is given, behave as if
3434
the command line was :samp:`-l {<directories from sys.path>}`.
3535

36-
.. cmdoption:: -l
36+
.. option:: -l
3737

3838
Do not recurse into subdirectories, only compile source code files directly
3939
contained in the named or implied directories.
4040

41-
.. cmdoption:: -f
41+
.. option:: -f
4242

4343
Force rebuild even if timestamps are up-to-date.
4444

45-
.. cmdoption:: -q
45+
.. option:: -q
4646

4747
Do not print the list of files compiled. If passed once, error messages will
4848
still be printed. If passed twice (``-qq``), all output is suppressed.
4949

50-
.. cmdoption:: -d destdir
50+
.. option:: -d destdir
5151

5252
Directory prepended to the path to each file being compiled. This will
5353
appear in compilation time tracebacks, and is also compiled in to the
5454
byte-code file, where it will be used in tracebacks and other messages in
5555
cases where the source file does not exist at the time the byte-code file is
5656
executed.
5757

58-
.. cmdoption:: -s strip_prefix
59-
.. cmdoption:: -p prepend_prefix
58+
.. option:: -s strip_prefix
59+
.. option:: -p prepend_prefix
6060

6161
Remove (``-s``) or append (``-p``) the given prefix of paths
6262
recorded in the ``.pyc`` files.
6363
Cannot be combined with ``-d``.
6464

65-
.. cmdoption:: -x regex
65+
.. option:: -x regex
6666

6767
regex is used to search the full path to each file considered for
6868
compilation, and if the regex produces a match, the file is skipped.
6969

70-
.. cmdoption:: -i list
70+
.. option:: -i list
7171

7272
Read the file ``list`` and add each line that it contains to the list of
7373
files and directories to compile. If ``list`` is ``-``, read lines from
7474
``stdin``.
7575

76-
.. cmdoption:: -b
76+
.. option:: -b
7777

7878
Write the byte-code files to their legacy locations and names, which may
7979
overwrite byte-code files created by another version of Python. The default
8080
is to write files to their :pep:`3147` locations and names, which allows
8181
byte-code files from multiple versions of Python to coexist.
8282

83-
.. cmdoption:: -r
83+
.. option:: -r
8484

8585
Control the maximum recursion level for subdirectories.
8686
If this is given, then ``-l`` option will not be taken into account.
8787
:program:`python -m compileall <directory> -r 0` is equivalent to
8888
:program:`python -m compileall <directory> -l`.
8989

90-
.. cmdoption:: -j N
90+
.. option:: -j N
9191

9292
Use *N* workers to compile the files within the given directory.
9393
If ``0`` is used, then the result of :func:`os.process_cpu_count()`
9494
will be used.
9595

96-
.. cmdoption:: --invalidation-mode [timestamp|checked-hash|unchecked-hash]
96+
.. option:: --invalidation-mode [timestamp|checked-hash|unchecked-hash]
9797

9898
Control how the generated byte-code files are invalidated at runtime.
9999
The ``timestamp`` value, means that ``.pyc`` files with the source timestamp
@@ -106,17 +106,17 @@ compile Python sources.
106106
variable is not set, and ``checked-hash`` if the ``SOURCE_DATE_EPOCH``
107107
environment variable is set.
108108

109-
.. cmdoption:: -o level
109+
.. option:: -o level
110110

111111
Compile with the given optimization level. May be used multiple times
112112
to compile for multiple levels at a time (for example,
113113
``compileall -o 1 -o 2``).
114114

115-
.. cmdoption:: -e dir
115+
.. option:: -e dir
116116

117117
Ignore symlinks pointing outside the given directory.
118118

119-
.. cmdoption:: --hardlink-dupes
119+
.. option:: --hardlink-dupes
120120

121121
If two ``.pyc`` files with different optimization level have
122122
the same content, use hard links to consolidate duplicate files.

Doc/library/gzip.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -268,23 +268,23 @@ Once executed the :mod:`gzip` module keeps the input file(s).
268268
Command line options
269269
^^^^^^^^^^^^^^^^^^^^
270270

271-
.. cmdoption:: file
271+
.. option:: file
272272

273273
If *file* is not specified, read from :data:`sys.stdin`.
274274

275-
.. cmdoption:: --fast
275+
.. option:: --fast
276276

277277
Indicates the fastest compression method (less compression).
278278

279-
.. cmdoption:: --best
279+
.. option:: --best
280280

281281
Indicates the slowest compression method (best compression).
282282

283-
.. cmdoption:: -d, --decompress
283+
.. option:: -d, --decompress
284284

285285
Decompress the given file.
286286

287-
.. cmdoption:: -h, --help
287+
.. option:: -h, --help
288288

289289
Show the help message.
290290

Doc/library/inspect.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1655,6 +1655,6 @@ By default, accepts the name of a module and prints the source of that
16551655
module. A class or function within the module can be printed instead by
16561656
appended a colon and the qualified name of the target object.
16571657

1658-
.. cmdoption:: --details
1658+
.. option:: --details
16591659

16601660
Print information about the specified object rather than the source code

Doc/library/json.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ specified, :data:`sys.stdin` and :data:`sys.stdout` will be used respectively:
714714
Command line options
715715
^^^^^^^^^^^^^^^^^^^^
716716

717-
.. cmdoption:: infile
717+
.. option:: infile
718718

719719
The JSON file to be validated or pretty-printed:
720720

@@ -734,36 +734,36 @@ Command line options
734734
735735
If *infile* is not specified, read from :data:`sys.stdin`.
736736

737-
.. cmdoption:: outfile
737+
.. option:: outfile
738738

739739
Write the output of the *infile* to the given *outfile*. Otherwise, write it
740740
to :data:`sys.stdout`.
741741

742-
.. cmdoption:: --sort-keys
742+
.. option:: --sort-keys
743743

744744
Sort the output of dictionaries alphabetically by key.
745745

746746
.. versionadded:: 3.5
747747

748-
.. cmdoption:: --no-ensure-ascii
748+
.. option:: --no-ensure-ascii
749749

750750
Disable escaping of non-ascii characters, see :func:`json.dumps` for more information.
751751

752752
.. versionadded:: 3.9
753753

754-
.. cmdoption:: --json-lines
754+
.. option:: --json-lines
755755

756756
Parse every input line as separate JSON object.
757757

758758
.. versionadded:: 3.8
759759

760-
.. cmdoption:: --indent, --tab, --no-indent, --compact
760+
.. option:: --indent, --tab, --no-indent, --compact
761761

762762
Mutually exclusive options for whitespace control.
763763

764764
.. versionadded:: 3.9
765765

766-
.. cmdoption:: -h, --help
766+
.. option:: -h, --help
767767

768768
Show the help message.
769769

Doc/library/pickletools.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,24 @@ Command line options
5353

5454
.. program:: pickletools
5555

56-
.. cmdoption:: -a, --annotate
56+
.. option:: -a, --annotate
5757

5858
Annotate each line with a short opcode description.
5959

60-
.. cmdoption:: -o, --output=<file>
60+
.. option:: -o, --output=<file>
6161

6262
Name of a file where the output should be written.
6363

64-
.. cmdoption:: -l, --indentlevel=<num>
64+
.. option:: -l, --indentlevel=<num>
6565

6666
The number of blanks by which to indent a new MARK level.
6767

68-
.. cmdoption:: -m, --memo
68+
.. option:: -m, --memo
6969

7070
When multiple objects are disassembled, preserve memo between
7171
disassemblies.
7272

73-
.. cmdoption:: -p, --preamble=<preamble>
73+
.. option:: -p, --preamble=<preamble>
7474

7575
When more than one pickle file are specified, print given preamble
7676
before each disassembly.

Doc/library/py_compile.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,13 @@ not be compiled.
139139

140140
.. program:: python -m py_compile
141141

142-
.. cmdoption:: <file> ... <fileN>
143-
-
142+
.. option:: <file> ... <fileN>
143+
-
144144

145145
Positional arguments are files to compile. If ``-`` is the only
146146
parameter, the list of files is taken from standard input.
147147

148-
.. cmdoption:: -q, --quiet
148+
.. option:: -q, --quiet
149149

150150
Suppress errors output.
151151

Doc/library/site.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,11 @@ If it is called without arguments, it will print the contents of
266266
:data:`USER_BASE` and whether the directory exists, then the same thing for
267267
:data:`USER_SITE`, and finally the value of :data:`ENABLE_USER_SITE`.
268268

269-
.. cmdoption:: --user-base
269+
.. option:: --user-base
270270

271271
Print the path to the user base directory.
272272

273-
.. cmdoption:: --user-site
273+
.. option:: --user-site
274274

275275
Print the path to the user site-packages directory.
276276

Doc/library/sqlite3.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -2437,9 +2437,9 @@ or if :attr:`~Connection.autocommit` is ``True``,
24372437
the context manager does nothing.
24382438

24392439
.. note::
2440-
24412440
The context manager neither implicitly opens a new transaction
2442-
nor closes the connection.
2441+
nor closes the connection. If you need a closing context manager, consider
2442+
using :meth:`contextlib.closing`.
24432443

24442444
.. testcode::
24452445

Doc/library/stdtypes.rst

+1
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,7 @@ number, :class:`float`, or :class:`complex`::
804804
hash_value = -2
805805
return hash_value
806806

807+
.. _bltin-boolean-values:
807808
.. _typebool:
808809

809810
Boolean Type - :class:`bool`

Doc/library/tarfile.rst

+10-10
Original file line numberDiff line numberDiff line change
@@ -1156,31 +1156,31 @@ For a list of the files in a tar archive, use the :option:`-l` option:
11561156
Command-line options
11571157
~~~~~~~~~~~~~~~~~~~~
11581158

1159-
.. cmdoption:: -l <tarfile>
1160-
--list <tarfile>
1159+
.. option:: -l <tarfile>
1160+
--list <tarfile>
11611161

11621162
List files in a tarfile.
11631163

1164-
.. cmdoption:: -c <tarfile> <source1> ... <sourceN>
1165-
--create <tarfile> <source1> ... <sourceN>
1164+
.. option:: -c <tarfile> <source1> ... <sourceN>
1165+
--create <tarfile> <source1> ... <sourceN>
11661166

11671167
Create tarfile from source files.
11681168

1169-
.. cmdoption:: -e <tarfile> [<output_dir>]
1170-
--extract <tarfile> [<output_dir>]
1169+
.. option:: -e <tarfile> [<output_dir>]
1170+
--extract <tarfile> [<output_dir>]
11711171

11721172
Extract tarfile into the current directory if *output_dir* is not specified.
11731173

1174-
.. cmdoption:: -t <tarfile>
1175-
--test <tarfile>
1174+
.. option:: -t <tarfile>
1175+
--test <tarfile>
11761176

11771177
Test whether the tarfile is valid or not.
11781178

1179-
.. cmdoption:: -v, --verbose
1179+
.. option:: -v, --verbose
11801180

11811181
Verbose output.
11821182

1183-
.. cmdoption:: --filter <filtername>
1183+
.. option:: --filter <filtername>
11841184

11851185
Specifies the *filter* for ``--extract``.
11861186
See :ref:`tarfile-extraction-filter` for details.

0 commit comments

Comments
 (0)