Skip to content

Commit d27c71b

Browse files
authored
Merge branch 'main' into idle
2 parents a689fd1 + b362632 commit d27c71b

54 files changed

Lines changed: 1539 additions & 197 deletions

Some content is hidden

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

Doc/c-api/dict.rst

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,3 +477,92 @@ Dictionary View Objects
477477
478478
Return true if *op* is an instance of a dictionary items view. This function
479479
always succeeds.
480+
481+
482+
Ordered Dictionaries
483+
^^^^^^^^^^^^^^^^^^^^
484+
485+
Python's C API provides interface for :class:`collections.OrderedDict` from C.
486+
Since Python 3.7, dictionaries are ordered by default, so there is usually
487+
little need for these functions; prefer ``PyDict*`` where possible.
488+
489+
490+
.. c:var:: PyTypeObject PyODict_Type
491+
492+
Type object for ordered dictionaries. This is the same object as
493+
:class:`collections.OrderedDict` in the Python layer.
494+
495+
496+
.. c:function:: int PyODict_Check(PyObject *od)
497+
498+
Return true if *od* is an ordered dictionary object or an instance of a
499+
subtype of the :class:`~collections.OrderedDict` type. This function
500+
always succeeds.
501+
502+
503+
.. c:function:: int PyODict_CheckExact(PyObject *od)
504+
505+
Return true if *od* is an ordered dictionary object, but not an instance of
506+
a subtype of the :class:`~collections.OrderedDict` type.
507+
This function always succeeds.
508+
509+
510+
.. c:var:: PyTypeObject PyODictKeys_Type
511+
512+
Analogous to :c:type:`PyDictKeys_Type` for ordered dictionaries.
513+
514+
515+
.. c:var:: PyTypeObject PyODictValues_Type
516+
517+
Analogous to :c:type:`PyDictValues_Type` for ordered dictionaries.
518+
519+
520+
.. c:var:: PyTypeObject PyODictItems_Type
521+
522+
Analogous to :c:type:`PyDictItems_Type` for ordered dictionaries.
523+
524+
525+
.. c:function:: PyObject *PyODict_New(void)
526+
527+
Return a new empty ordered dictionary, or ``NULL`` on failure.
528+
529+
This is analogous to :c:func:`PyDict_New`.
530+
531+
532+
.. c:function:: int PyODict_SetItem(PyObject *od, PyObject *key, PyObject *value)
533+
534+
Insert *value* into the ordered dictionary *od* with a key of *key*.
535+
Return ``0`` on success or ``-1`` with an exception set on failure.
536+
537+
This is analogous to :c:func:`PyDict_SetItem`.
538+
539+
540+
.. c:function:: int PyODict_DelItem(PyObject *od, PyObject *key)
541+
542+
Remove the entry in the ordered dictionary *od* with key *key*.
543+
Return ``0`` on success or ``-1`` with an exception set on failure.
544+
545+
This is analogous to :c:func:`PyDict_DelItem`.
546+
547+
548+
These are :term:`soft deprecated` aliases to ``PyDict`` APIs:
549+
550+
551+
.. list-table::
552+
:widths: auto
553+
:header-rows: 1
554+
555+
* * ``PyODict``
556+
* ``PyDict``
557+
* * .. c:macro:: PyODict_GetItem(od, key)
558+
* :c:func:`PyDict_GetItem`
559+
* * .. c:macro:: PyODict_GetItemWithError(od, key)
560+
* :c:func:`PyDict_GetItemWithError`
561+
* * .. c:macro:: PyODict_GetItemString(od, key)
562+
* :c:func:`PyDict_GetItemString`
563+
* * .. c:macro:: PyODict_Contains(od, key)
564+
* :c:func:`PyDict_Contains`
565+
* * .. c:macro:: PyODict_Size(od)
566+
* :c:func:`PyDict_Size`
567+
* * .. c:macro:: PyODict_SIZE(od)
568+
* :c:func:`PyDict_GET_SIZE`

Doc/c-api/iterator.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ Other Iterator Objects
108108
.. c:var:: PyTypeObject PyDictRevIterValue_Type
109109
.. c:var:: PyTypeObject PyDictIterItem_Type
110110
.. c:var:: PyTypeObject PyDictRevIterItem_Type
111+
.. c:var:: PyTypeObject PyODictIter_Type
111112
112113
Type objects for iterators of various built-in objects.
113114

Doc/library/cmdline.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ The following modules have a command-line interface.
1616
* :ref:`dis <dis-cli>`
1717
* :ref:`doctest <doctest-cli>`
1818
* :mod:`!encodings.rot_13`
19-
* :mod:`ensurepip`
19+
* :ref:`ensurepip <ensurepip-cli>`
2020
* :mod:`filecmp`
2121
* :mod:`fileinput`
2222
* :mod:`ftplib`
2323
* :ref:`gzip <gzip-cli>`
2424
* :ref:`http.server <http-server-cli>`
25-
* :mod:`!idlelib`
25+
* :ref:`idlelib <idlelib-cli>`
2626
* :ref:`inspect <inspect-module-cli>`
2727
* :ref:`json <json-commandline>`
2828
* :ref:`mimetypes <mimetypes-cli>`
29-
* :mod:`pdb`
29+
* :ref:`pdb <pdb-cli>`
3030
* :ref:`pickle <pickle-cli>`
3131
* :ref:`pickletools <pickletools-cli>`
3232
* :ref:`platform <platform-cli>`
@@ -52,8 +52,8 @@ The following modules have a command-line interface.
5252
* :mod:`turtledemo`
5353
* :ref:`unittest <unittest-command-line-interface>`
5454
* :ref:`uuid <uuid-cli>`
55-
* :mod:`venv`
56-
* :mod:`webbrowser`
55+
* :ref:`venv <venv-cli>`
56+
* :ref:`webbrowser <webbrowser-cli>`
5757
* :ref:`zipapp <zipapp-command-line-interface>`
5858
* :ref:`zipfile <zipfile-commandline>`
5959

Doc/library/ensurepip.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ when creating a virtual environment) or after explicitly uninstalling
4242

4343
.. include:: ../includes/wasm-mobile-notavail.rst
4444

45-
Command line interface
45+
.. _ensurepip-cli:
46+
47+
Command-line interface
4648
----------------------
4749

4850
.. program:: ensurepip

Doc/library/gzip.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ Example of how to GZIP compress a binary string::
283283

284284
.. _gzip-cli:
285285

286-
Command Line Interface
286+
Command-line interface
287287
----------------------
288288

289289
The :mod:`gzip` module provides a simple command line interface to compress or
@@ -296,7 +296,7 @@ Once executed the :mod:`gzip` module keeps the input file(s).
296296
Add a new command line interface with a usage.
297297
By default, when you will execute the CLI, the default compression level is 6.
298298

299-
Command line options
299+
Command-line options
300300
^^^^^^^^^^^^^^^^^^^^
301301

302302
.. option:: file

Doc/library/idle.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,9 @@ looked for in the user's home directory. Statements in this file will be
661661
executed in the Tk namespace, so this file is not useful for importing
662662
functions to be used from IDLE's Python shell.
663663

664-
Command line usage
664+
.. _idlelib-cli:
665+
666+
Command-line usage
665667
^^^^^^^^^^^^^^^^^^
666668

667669
.. program:: idle

Doc/library/inspect.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1788,7 +1788,7 @@ Buffer flags
17881788

17891789
.. _inspect-module-cli:
17901790

1791-
Command Line Interface
1791+
Command-line interface
17921792
----------------------
17931793

17941794
The :mod:`inspect` module also provides a basic introspection capability

Doc/library/pdb.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ The debugger's prompt is ``(Pdb)``, which is the indicator that you are in debug
7676

7777

7878
.. _pdb-cli:
79+
80+
Command-line interface
81+
----------------------
82+
7983
.. program:: pdb
8084

8185
You can also invoke :mod:`pdb` from the command line to debug other scripts. For
@@ -334,7 +338,7 @@ access further features, you have to do this yourself:
334338

335339
.. _debugger-commands:
336340

337-
Debugger Commands
341+
Debugger commands
338342
-----------------
339343

340344
The commands recognized by the debugger are listed below. Most commands can be

Doc/library/profile.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,14 @@ Profile with real-time sampling statistics::
265265

266266
Sample all threads in the process instead of just the main thread
267267

268+
.. option:: --native
269+
270+
Include artificial ``<native>`` frames to denote calls to non-Python code.
271+
272+
.. option:: --no-gc
273+
274+
Don't include artificial ``<GC>`` frames to denote active garbage collection.
275+
268276
.. option:: --realtime-stats
269277

270278
Print real-time sampling statistics during profiling
@@ -349,7 +357,7 @@ This section documents the programmatic interface for the :mod:`!profiling.sampl
349357
For command-line usage, see :ref:`sampling-profiler-cli`. For conceptual information
350358
about statistical profiling, see :ref:`statistical-profiling`
351359

352-
.. function:: sample(pid, *, sort=2, sample_interval_usec=100, duration_sec=10, filename=None, all_threads=False, limit=None, show_summary=True, output_format="pstats", realtime_stats=False)
360+
.. function:: sample(pid, *, sort=2, sample_interval_usec=100, duration_sec=10, filename=None, all_threads=False, limit=None, show_summary=True, output_format="pstats", realtime_stats=False, native=False, gc=True)
353361

354362
Sample a Python process and generate profiling data.
355363

@@ -367,6 +375,8 @@ about statistical profiling, see :ref:`statistical-profiling`
367375
:param bool show_summary: Whether to show summary statistics (default: True)
368376
:param str output_format: Output format - 'pstats' or 'collapsed' (default: 'pstats')
369377
:param bool realtime_stats: Whether to display real-time statistics (default: False)
378+
:param bool native: Whether to include ``<native>`` frames (default: False)
379+
:param bool gc: Whether to include ``<GC>`` frames (default: True)
370380

371381
:raises ValueError: If output_format is not 'pstats' or 'collapsed'
372382

Doc/library/site.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ Module contents
270270

271271
.. _site-commandline:
272272

273-
Command Line Interface
273+
Command-line interface
274274
----------------------
275275

276276
.. program:: site

0 commit comments

Comments
 (0)