Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 70a29b9

Browse files
committed
Merge remote-tracking branch 'upstream/main' into gh-107265
2 parents fb0ab4e + 04f7875 commit 70a29b9

File tree

13 files changed

+186
-369
lines changed

13 files changed

+186
-369
lines changed

Doc/faq/design.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,9 +584,9 @@ exhaustive test suites that exercise every line of code in a module.
584584
An appropriate testing discipline can help build large complex applications in
585585
Python as well as having interface specifications would. In fact, it can be
586586
better because an interface specification cannot test certain properties of a
587-
program. For example, the :meth:`list.append` method is expected to add new elements
587+
program. For example, the :meth:`!list.append` method is expected to add new elements
588588
to the end of some internal list; an interface specification cannot test that
589-
your :meth:`list.append` implementation will actually do this correctly, but it's
589+
your :meth:`!list.append` implementation will actually do this correctly, but it's
590590
trivial to check this property in a test suite.
591591

592592
Writing test suites is very helpful, and you might want to design your code to

Doc/faq/library.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ Is there an equivalent to C's onexit() in Python?
111111
-------------------------------------------------
112112
113113
The :mod:`atexit` module provides a register function that is similar to C's
114-
:c:func:`onexit`.
114+
:c:func:`!onexit`.
115115
116116
117117
Why don't my signal handlers work?
@@ -397,7 +397,7 @@ These aren't::
397397
D[x] = D[x] + 1
398398
399399
Operations that replace other objects may invoke those other objects'
400-
:meth:`__del__` method when their reference count reaches zero, and that can
400+
:meth:`~object.__del__` method when their reference count reaches zero, and that can
401401
affect things. This is especially true for the mass updates to dictionaries and
402402
lists. When in doubt, use a mutex!
403403
@@ -730,14 +730,17 @@ The :mod:`select` module is commonly used to help with asynchronous I/O on
730730
sockets.
731731
732732
To prevent the TCP connect from blocking, you can set the socket to non-blocking
733-
mode. Then when you do the :meth:`socket.connect`, you will either connect immediately
733+
mode. Then when you do the :meth:`~socket.socket.connect`,
734+
you will either connect immediately
734735
(unlikely) or get an exception that contains the error number as ``.errno``.
735736
``errno.EINPROGRESS`` indicates that the connection is in progress, but hasn't
736737
finished yet. Different OSes will return different values, so you're going to
737738
have to check what's returned on your system.
738739
739-
You can use the :meth:`socket.connect_ex` method to avoid creating an exception. It will
740-
just return the errno value. To poll, you can call :meth:`socket.connect_ex` again later
740+
You can use the :meth:`~socket.socket.connect_ex` method
741+
to avoid creating an exception.
742+
It will just return the errno value.
743+
To poll, you can call :meth:`~socket.socket.connect_ex` again later
741744
-- ``0`` or ``errno.EISCONN`` indicate that you're connected -- or you can pass this
742745
socket to :meth:`select.select` to check if it's writable.
743746

Doc/faq/programming.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ There are two factors that produce this result:
454454
(the list), and both ``x`` and ``y`` refer to it.
455455
2) Lists are :term:`mutable`, which means that you can change their content.
456456

457-
After the call to :meth:`~list.append`, the content of the mutable object has
457+
After the call to :meth:`!append`, the content of the mutable object has
458458
changed from ``[]`` to ``[10]``. Since both the variables refer to the same
459459
object, using either name accesses the modified value ``[10]``.
460460

@@ -1397,7 +1397,7 @@ To see why this happens, you need to know that (a) if an object implements an
13971397
:meth:`~object.__iadd__` magic method, it gets called when the ``+=`` augmented
13981398
assignment
13991399
is executed, and its return value is what gets used in the assignment statement;
1400-
and (b) for lists, :meth:`!__iadd__` is equivalent to calling :meth:`~list.extend` on the list
1400+
and (b) for lists, :meth:`!__iadd__` is equivalent to calling :meth:`!extend` on the list
14011401
and returning the list. That's why we say that for lists, ``+=`` is a
14021402
"shorthand" for :meth:`!list.extend`::
14031403

@@ -1903,7 +1903,7 @@ identity tests. This prevents the code from being confused by objects such as
19031903
``float('NaN')`` that are not equal to themselves.
19041904

19051905
For example, here is the implementation of
1906-
:meth:`collections.abc.Sequence.__contains__`::
1906+
:meth:`!collections.abc.Sequence.__contains__`::
19071907

19081908
def __contains__(self, value):
19091909
for v in self:

Doc/library/logging.rst

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ Handler Objects
439439

440440
Handlers have the following attributes and methods. Note that :class:`Handler`
441441
is never instantiated directly; this class acts as a base for more useful
442-
subclasses. However, the :meth:`__init__` method in subclasses needs to call
442+
subclasses. However, the :meth:`!__init__` method in subclasses needs to call
443443
:meth:`Handler.__init__`.
444444

445445
.. class:: Handler
@@ -1019,30 +1019,42 @@ information into logging calls. For a usage example, see the section on
10191019
'extra'. The return value is a (*msg*, *kwargs*) tuple which has the
10201020
(possibly modified) versions of the arguments passed in.
10211021

1022-
In addition to the above, :class:`LoggerAdapter` supports the following
1023-
methods of :class:`Logger`: :meth:`~Logger.debug`, :meth:`~Logger.info`,
1024-
:meth:`~Logger.warning`, :meth:`~Logger.error`, :meth:`~Logger.exception`,
1025-
:meth:`~Logger.critical`, :meth:`~Logger.log`, :meth:`~Logger.isEnabledFor`,
1026-
:meth:`~Logger.getEffectiveLevel`, :meth:`~Logger.setLevel` and
1027-
:meth:`~Logger.hasHandlers`. These methods have the same signatures as their
1028-
counterparts in :class:`Logger`, so you can use the two types of instances
1029-
interchangeably.
1022+
.. attribute:: manager
10301023

1031-
.. versionchanged:: 3.2
1032-
The :meth:`~Logger.isEnabledFor`, :meth:`~Logger.getEffectiveLevel`,
1033-
:meth:`~Logger.setLevel` and :meth:`~Logger.hasHandlers` methods were added
1034-
to :class:`LoggerAdapter`. These methods delegate to the underlying logger.
1024+
Delegates to the underlying :attr:`!manager`` on *logger*.
1025+
1026+
.. attribute:: _log
1027+
1028+
Delegates to the underlying :meth:`!_log`` method on *logger*.
1029+
1030+
In addition to the above, :class:`LoggerAdapter` supports the following
1031+
methods of :class:`Logger`: :meth:`~Logger.debug`, :meth:`~Logger.info`,
1032+
:meth:`~Logger.warning`, :meth:`~Logger.error`, :meth:`~Logger.exception`,
1033+
:meth:`~Logger.critical`, :meth:`~Logger.log`, :meth:`~Logger.isEnabledFor`,
1034+
:meth:`~Logger.getEffectiveLevel`, :meth:`~Logger.setLevel` and
1035+
:meth:`~Logger.hasHandlers`. These methods have the same signatures as their
1036+
counterparts in :class:`Logger`, so you can use the two types of instances
1037+
interchangeably.
1038+
1039+
.. versionchanged:: 3.2
10351040

1036-
.. versionchanged:: 3.6
1037-
Attribute :attr:`manager` and method :meth:`_log` were added, which
1038-
delegate to the underlying logger and allow adapters to be nested.
1041+
The :meth:`~Logger.isEnabledFor`, :meth:`~Logger.getEffectiveLevel`,
1042+
:meth:`~Logger.setLevel` and :meth:`~Logger.hasHandlers` methods were added
1043+
to :class:`LoggerAdapter`. These methods delegate to the underlying logger.
10391044

1040-
.. versionchanged:: 3.13
1041-
Remove the undocumented ``warn()`` method which was an alias to the
1042-
``warning()`` method.
1045+
.. versionchanged:: 3.6
1046+
1047+
Attribute :attr:`!manager` and method :meth:`!_log` were added, which
1048+
delegate to the underlying logger and allow adapters to be nested.
1049+
1050+
.. versionchanged:: 3.13
1051+
1052+
Remove the undocumented :meth:`!warn`` method which was an alias to the
1053+
:meth:`!warning` method.
1054+
1055+
.. versionchanged:: 3.13
10431056

1044-
.. versionchanged:: 3.13
1045-
The *merge_extra* argument was added.
1057+
The *merge_extra* argument was added.
10461058

10471059

10481060
Thread Safety
@@ -1430,8 +1442,8 @@ functions.
14301442
.. function:: setLoggerClass(klass)
14311443

14321444
Tells the logging system to use the class *klass* when instantiating a logger.
1433-
The class should define :meth:`__init__` such that only a name argument is
1434-
required, and the :meth:`__init__` should call :meth:`Logger.__init__`. This
1445+
The class should define :meth:`!__init__` such that only a name argument is
1446+
required, and the :meth:`!__init__` should call :meth:`!Logger.__init__`. This
14351447
function is typically called before any loggers are instantiated by applications
14361448
which need to use custom logger behavior. After this call, as at any other
14371449
time, do not instantiate loggers directly using the subclass: continue to use

Doc/tools/.nitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@ Doc/c-api/typeobj.rst
2424
Doc/c-api/unicode.rst
2525
Doc/extending/extending.rst
2626
Doc/extending/newtypes.rst
27-
Doc/faq/design.rst
2827
Doc/faq/gui.rst
29-
Doc/faq/library.rst
30-
Doc/faq/programming.rst
3128
Doc/glossary.rst
3229
Doc/howto/descriptor.rst
3330
Doc/howto/enum.rst
@@ -92,7 +89,6 @@ Doc/library/inspect.rst
9289
Doc/library/locale.rst
9390
Doc/library/logging.config.rst
9491
Doc/library/logging.handlers.rst
95-
Doc/library/logging.rst
9692
Doc/library/lzma.rst
9793
Doc/library/mailbox.rst
9894
Doc/library/mmap.rst

Lib/test/test_pydoc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,7 @@ def test_bound_builtin_classmethod_o(self):
12321232

12331233
def test_module_level_callable_unrepresentable_default(self):
12341234
self.assertEqual(self._get_summary_line(getattr),
1235-
"getattr(object, name, default=<unrepresentable>, /)")
1235+
"getattr(...)")
12361236

12371237
def test_builtin_staticmethod_unrepresentable_default(self):
12381238
self.assertEqual(self._get_summary_line(str.maketrans),
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Revert converting ``vars``, ``dir``, ``next``, ``getattr``, and ``iter`` to
2+
argument clinic.

0 commit comments

Comments
 (0)