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

Skip to content

Commit 3ec8dcb

Browse files
committed
Deploying to gh-pages from @ c4b0c7f 🚀
1 parent 74ef2bf commit 3ec8dcb

File tree

543 files changed

+34281
-11290
lines changed

Some content is hidden

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

543 files changed

+34281
-11290
lines changed

‎.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: 7a9e03f1aed58fe0ca06aca70b1b09fa
3+
config: 40fc522a7573e9bac1c12a3954261123
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

‎_sources/c-api/module.rst.txt

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ Module Objects
4343
to ``None``); the caller is responsible for providing a :attr:`__file__`
4444
attribute.
4545
46+
Return ``NULL`` with an exception set on error.
47+
4648
.. versionadded:: 3.3
4749
4850
.. versionchanged:: 3.4
@@ -265,6 +267,8 @@ of the following two module creation functions:
265267
API version *module_api_version*. If that version does not match the version
266268
of the running interpreter, a :exc:`RuntimeWarning` is emitted.
267269
270+
Return ``NULL`` with an exception set on error.
271+
268272
.. note::
269273
270274
Most uses of this function should be using :c:func:`PyModule_Create`
@@ -436,6 +440,8 @@ objects dynamically. Note that both ``PyModule_FromDefAndSpec`` and
436440
If that version does not match the version of the running interpreter,
437441
a :exc:`RuntimeWarning` is emitted.
438442
443+
Return ``NULL`` with an exception set on error.
444+
439445
.. note::
440446
441447
Most uses of this function should be using :c:func:`PyModule_FromDefAndSpec`
@@ -486,7 +492,7 @@ state:
486492
487493
On success, return ``0``. On error, raise an exception and return ``-1``.
488494
489-
Return ``NULL`` if *value* is ``NULL``. It must be called with an exception
495+
Return ``-1`` if *value* is ``NULL``. It must be called with an exception
490496
raised in this case.
491497
492498
Example usage::
@@ -579,23 +585,24 @@ state:
579585
.. c:function:: int PyModule_AddIntConstant(PyObject *module, const char *name, long value)
580586
581587
Add an integer constant to *module* as *name*. This convenience function can be
582-
used from the module's initialization function. Return ``-1`` on error, ``0`` on
583-
success.
588+
used from the module's initialization function.
589+
Return ``-1`` with an exception set on error, ``0`` on success.
584590
585591
586592
.. c:function:: int PyModule_AddStringConstant(PyObject *module, const char *name, const char *value)
587593
588594
Add a string constant to *module* as *name*. This convenience function can be
589595
used from the module's initialization function. The string *value* must be
590-
``NULL``-terminated. Return ``-1`` on error, ``0`` on success.
596+
``NULL``-terminated.
597+
Return ``-1`` with an exception set on error, ``0`` on success.
591598
592599
593600
.. c:macro:: PyModule_AddIntMacro(module, macro)
594601
595602
Add an int constant to *module*. The name and the value are taken from
596603
*macro*. For example ``PyModule_AddIntMacro(module, AF_INET)`` adds the int
597604
constant *AF_INET* with the value of *AF_INET* to *module*.
598-
Return ``-1`` on error, ``0`` on success.
605+
Return ``-1`` with an exception set on error, ``0`` on success.
599606
600607
601608
.. c:macro:: PyModule_AddStringMacro(module, macro)
@@ -608,7 +615,7 @@ state:
608615
The type object is finalized by calling internally :c:func:`PyType_Ready`.
609616
The name of the type object is taken from the last component of
610617
:c:member:`~PyTypeObject.tp_name` after dot.
611-
Return ``-1`` on error, ``0`` on success.
618+
Return ``-1`` with an exception set on error, ``0`` on success.
612619
613620
.. versionadded:: 3.9
614621
@@ -647,14 +654,14 @@ since multiple such modules can be created from a single definition.
647654
648655
The caller must hold the GIL.
649656
650-
Return 0 on success or -1 on failure.
657+
Return ``-1`` with an exception set on error, ``0`` on success.
651658
652659
.. versionadded:: 3.3
653660
654661
.. c:function:: int PyState_RemoveModule(PyModuleDef *def)
655662
656663
Removes the module object created from *def* from the interpreter state.
657-
Return 0 on success or -1 on failure.
664+
Return ``-1`` with an exception set on error, ``0`` on success.
658665
659666
The caller must hold the GIL.
660667

‎_sources/faq/programming.rst.txt

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1741,11 +1741,31 @@ but effective way to define class private variables. Any identifier of the form
17411741
is textually replaced with ``_classname__spam``, where ``classname`` is the
17421742
current class name with any leading underscores stripped.
17431743

1744-
This doesn't guarantee privacy: an outside user can still deliberately access
1745-
the "_classname__spam" attribute, and private values are visible in the object's
1746-
``__dict__``. Many Python programmers never bother to use private variable
1747-
names at all.
1744+
The identifier can be used unchanged within the class, but to access it outside
1745+
the class, the mangled name must be used:
17481746

1747+
.. code-block:: python
1748+
1749+
class A:
1750+
def __one(self):
1751+
return 1
1752+
def two(self):
1753+
return 2 * self.__one()
1754+
1755+
class B(A):
1756+
def three(self):
1757+
return 3 * self._A__one()
1758+
1759+
four = 4 * A()._A__one()
1760+
1761+
In particular, this does not guarantee privacy since an outside user can still
1762+
deliberately access the private attribute; many Python programmers never bother
1763+
to use private variable names at all.
1764+
1765+
.. seealso::
1766+
1767+
The :ref:`private name mangling specifications <private-name-mangling>`
1768+
for details and special cases.
17491769

17501770
My class defines __del__ but it is not called when I delete the object.
17511771
-----------------------------------------------------------------------

‎_sources/library/configparser.rst.txt

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -147,23 +147,28 @@ case-insensitive and stored in lowercase [1]_.
147147
It is possible to read several configurations into a single
148148
:class:`ConfigParser`, where the most recently added configuration has the
149149
highest priority. Any conflicting keys are taken from the more recent
150-
configuration while the previously existing keys are retained.
150+
configuration while the previously existing keys are retained. The example
151+
below reads in an ``override.ini`` file, which will override any conflicting
152+
keys from the ``example.ini`` file.
153+
154+
.. code-block:: ini
155+
156+
[DEFAULT]
157+
ServerAliveInterval = -1
151158
152159
.. doctest::
153160

154-
>>> another_config = configparser.ConfigParser()
155-
>>> another_config.read('example.ini')
156-
['example.ini']
157-
>>> another_config['topsecret.server.example']['Port']
158-
'50022'
159-
>>> another_config.read_string("[topsecret.server.example]\nPort=48484")
160-
>>> another_config['topsecret.server.example']['Port']
161-
'48484'
162-
>>> another_config.read_dict({"topsecret.server.example": {"Port": 21212}})
163-
>>> another_config['topsecret.server.example']['Port']
164-
'21212'
165-
>>> another_config['topsecret.server.example']['ForwardX11']
166-
'no'
161+
>>> config_override = configparser.ConfigParser()
162+
>>> config_override['DEFAULT'] = {'ServerAliveInterval': '-1'}
163+
>>> with open('override.ini', 'w') as configfile:
164+
... config_override.write(configfile)
165+
...
166+
>>> config_override = configparser.ConfigParser()
167+
>>> config_override.read(['example.ini', 'override.ini'])
168+
['example.ini', 'override.ini']
169+
>>> print(config_override.get('DEFAULT', 'ServerAliveInterval'))
170+
-1
171+
167172

168173
This behaviour is equivalent to a :meth:`ConfigParser.read` call with several
169174
files passed to the *filenames* parameter.
@@ -958,6 +963,31 @@ ConfigParser Objects
958963
converter gets its own corresponding :meth:`!get*()` method on the parser
959964
object and section proxies.
960965

966+
It is possible to read several configurations into a single
967+
:class:`ConfigParser`, where the most recently added configuration has the
968+
highest priority. Any conflicting keys are taken from the more recent
969+
configuration while the previously existing keys are retained. The example
970+
below reads in an ``override.ini`` file, which will override any conflicting
971+
keys from the ``example.ini`` file.
972+
973+
.. code-block:: ini
974+
975+
[DEFAULT]
976+
ServerAliveInterval = -1
977+
978+
.. doctest::
979+
980+
>>> config_override = configparser.ConfigParser()
981+
>>> config_override['DEFAULT'] = {'ServerAliveInterval': '-1'}
982+
>>> with open('override.ini', 'w') as configfile:
983+
... config_override.write(configfile)
984+
...
985+
>>> config_override = configparser.ConfigParser()
986+
>>> config_override.read(['example.ini', 'override.ini'])
987+
['example.ini', 'override.ini']
988+
>>> print(config_override.get('DEFAULT', 'ServerAliveInterval'))
989+
-1
990+
961991
.. versionchanged:: 3.1
962992
The default *dict_type* is :class:`collections.OrderedDict`.
963993

‎_sources/library/ftplib.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ FTP objects
243243
Retrieve a file in binary transfer mode.
244244

245245
:param str cmd:
246-
An appropriate ``STOR`` command: :samp:`"STOR {filename}"`.
246+
An appropriate ``RETR`` command: :samp:`"RETR {filename}"`.
247247

248248
:param callback:
249249
A single parameter callable that is called

‎_sources/library/multiprocessing.rst.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ processes:
254254
p.join()
255255

256256
Queues are thread and process safe.
257+
Any object put into a :mod:`~multiprocessing` queue will be serialized.
257258

258259
**Pipes**
259260

@@ -281,6 +282,8 @@ processes:
281282
of corruption from processes using different ends of the pipe at the same
282283
time.
283284

285+
The :meth:`~Connection.send` method serializes the the object and
286+
:meth:`~Connection.recv` re-creates the object.
284287

285288
Synchronization between processes
286289
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -745,6 +748,11 @@ If you use :class:`JoinableQueue` then you **must** call
745748
semaphore used to count the number of unfinished tasks may eventually overflow,
746749
raising an exception.
747750

751+
One difference from other Python queue implementations, is that :mod:`multiprocessing`
752+
queues serializes all objects that are put into them using :mod:`pickle`.
753+
The object return by the get method is a re-created object that does not share memory
754+
with the original object.
755+
748756
Note that one can also create a shared queue by using a manager object -- see
749757
:ref:`multiprocessing-managers`.
750758

@@ -811,6 +819,8 @@ For an example of the usage of queues for interprocess communication see
811819
used for receiving messages and ``conn2`` can only be used for sending
812820
messages.
813821

822+
The :meth:`~multiprocessing.Connection.send` method serializes the the object using
823+
:mod:`pickle` and the :meth:`~multiprocessing.Connection.recv` re-creates the object.
814824

815825
.. class:: Queue([maxsize])
816826

@@ -837,6 +847,8 @@ For an example of the usage of queues for interprocess communication see
837847
Return ``True`` if the queue is empty, ``False`` otherwise. Because of
838848
multithreading/multiprocessing semantics, this is not reliable.
839849

850+
May raise an :exc:`OSError` on closed queues. (not guaranteed)
851+
840852
.. method:: full()
841853

842854
Return ``True`` if the queue is full, ``False`` otherwise. Because of
@@ -940,6 +952,8 @@ For an example of the usage of queues for interprocess communication see
940952

941953
Return ``True`` if the queue is empty, ``False`` otherwise.
942954

955+
Always raises an :exc:`OSError` if the SimpleQueue is closed.
956+
943957
.. method:: get()
944958

945959
Remove and return an item from the queue.

‎_sources/library/profile.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ you are using :class:`profile.Profile` or :class:`cProfile.Profile`,
692692
As the :class:`cProfile.Profile` class cannot be calibrated, custom timer
693693
functions should be used with care and should be as fast as possible. For
694694
the best results with a custom timer, it might be necessary to hard-code it
695-
in the C source of the internal :mod:`_lsprof` module.
695+
in the C source of the internal :mod:`!_lsprof` module.
696696

697697
Python 3.3 adds several new functions in :mod:`time` that can be used to make
698698
precise measurements of process or wall-clock time. For example, see

‎_sources/reference/expressions.rst.txt

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,47 @@ exception.
8383
pair: name; mangling
8484
pair: private; names
8585

86-
**Private name mangling:** When an identifier that textually occurs in a class
87-
definition begins with two or more underscore characters and does not end in two
88-
or more underscores, it is considered a :dfn:`private name` of that class.
89-
Private names are transformed to a longer form before code is generated for
90-
them. The transformation inserts the class name, with leading underscores
91-
removed and a single underscore inserted, in front of the name. For example,
92-
the identifier ``__spam`` occurring in a class named ``Ham`` will be transformed
93-
to ``_Ham__spam``. This transformation is independent of the syntactical
94-
context in which the identifier is used. If the transformed name is extremely
95-
long (longer than 255 characters), implementation defined truncation may happen.
96-
If the class name consists only of underscores, no transformation is done.
86+
Private name mangling
87+
^^^^^^^^^^^^^^^^^^^^^
9788

89+
When an identifier that textually occurs in a class definition begins with two
90+
or more underscore characters and does not end in two or more underscores, it
91+
is considered a :dfn:`private name` of that class.
92+
93+
.. seealso::
94+
95+
The :ref:`class specifications <class>`.
96+
97+
More precisely, private names are transformed to a longer form before code is
98+
generated for them. If the transformed name is longer than 255 characters,
99+
implementation-defined truncation may happen.
100+
101+
The transformation is independent of the syntactical context in which the
102+
identifier is used but only the following private identifiers are mangled:
103+
104+
- Any name used as the name of a variable that is assigned or read or any
105+
name of an attribute being accessed.
106+
107+
The ``__name__`` attribute of nested functions, classes, and type aliases
108+
is however not mangled.
109+
110+
- The name of imported modules, e.g., ``__spam`` in ``import __spam``.
111+
If the module is part of a package (i.e., its name contains a dot),
112+
the name is *not* mangled, e.g., the ``__foo`` in ``import __foo.bar``
113+
is not mangled.
114+
115+
- The name of an imported member, e.g., ``__f`` in ``from spam import __f``.
116+
117+
The transformation rule is defined as follows:
118+
119+
- The class name, with leading underscores removed and a single leading
120+
underscore inserted, is inserted in front of the identifier, e.g., the
121+
identifier ``__spam`` occurring in a class named ``Foo``, ``_Foo`` or
122+
``__Foo`` is transformed to ``_Foo__spam``.
123+
124+
- If the class name consists only of underscores, the transformation is the
125+
identity, e.g., the identifier ``__spam`` occurring in a class named ``_``
126+
or ``__`` is left as is.
98127

99128
.. _atom-literals:
100129

‎_sources/tutorial/classes.rst.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,11 @@ current class name with leading underscore(s) stripped. This mangling is done
688688
without regard to the syntactic position of the identifier, as long as it
689689
occurs within the definition of a class.
690690

691+
.. seealso::
692+
693+
The :ref:`private name mangling specifications <private-name-mangling>`
694+
for details and special cases.
695+
691696
Name mangling is helpful for letting subclasses override methods without
692697
breaking intraclass method calls. For example::
693698

‎_sources/whatsnew/3.4.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1495,7 +1495,7 @@ The dictionary returned by :meth:`.SSLSocket.getpeercert` contains additional
14951495
stat
14961496
----
14971497

1498-
The :mod:`stat` module is now backed by a C implementation in :mod:`_stat`. A C
1498+
The :mod:`stat` module is now backed by a C implementation in :mod:`!_stat`. A C
14991499
implementation is required as most of the values aren't standardized and
15001500
are platform-dependent. (Contributed by Christian Heimes in :issue:`11016`.)
15011501

‎_sources/whatsnew/3.5.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1935,8 +1935,8 @@ specifying the namespace in which the code will be running.
19351935
tkinter
19361936
-------
19371937

1938-
The :mod:`tkinter._fix` module used for setting up the Tcl/Tk environment
1939-
on Windows has been replaced by a private function in the :mod:`_tkinter`
1938+
The :mod:`!tkinter._fix` module used for setting up the Tcl/Tk environment
1939+
on Windows has been replaced by a private function in the :mod:`!_tkinter`
19401940
module which makes no permanent changes to environment variables.
19411941
(Contributed by Zachary Ware in :issue:`20035`.)
19421942

‎_sources/whatsnew/3.7.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2048,7 +2048,7 @@ The :mod:`macpath` is now deprecated and will be removed in Python 3.8.
20482048
threading
20492049
---------
20502050

2051-
:mod:`dummy_threading` and :mod:`_dummy_thread` have been deprecated. It is
2051+
:mod:`!dummy_threading` and :mod:`!_dummy_thread` have been deprecated. It is
20522052
no longer possible to build Python with threading disabled.
20532053
Use :mod:`threading` instead.
20542054
(Contributed by Antoine Pitrou in :issue:`31370`.)
@@ -2184,7 +2184,7 @@ The following features and APIs have been removed from Python 3.7:
21842184
``socket.socketpair`` on Python 3.5 and newer.
21852185

21862186
* :mod:`asyncio` no longer exports the :mod:`selectors` and
2187-
:mod:`_overlapped` modules as ``asyncio.selectors`` and
2187+
:mod:`!_overlapped` modules as ``asyncio.selectors`` and
21882188
``asyncio._overlapped``. Replace ``from asyncio import selectors`` with
21892189
``import selectors``.
21902190

0 commit comments

Comments
 (0)