Skip to content

Commit

Permalink
Deploying to gh-pages from @ c4b0c7f 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwang44 committed Jul 16, 2024
1 parent 74ef2bf commit 3ec8dcb
Show file tree
Hide file tree
Showing 543 changed files with 34,281 additions and 11,290 deletions.
2 changes: 1 addition & 1 deletion .buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 7a9e03f1aed58fe0ca06aca70b1b09fa
config: 40fc522a7573e9bac1c12a3954261123
tags: 645f666f9bcd5a90fca523b33c5a78b7
23 changes: 15 additions & 8 deletions _sources/c-api/module.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Module Objects
to ``None``); the caller is responsible for providing a :attr:`__file__`
attribute.
Return ``NULL`` with an exception set on error.
.. versionadded:: 3.3
.. versionchanged:: 3.4
Expand Down Expand Up @@ -265,6 +267,8 @@ of the following two module creation functions:
API version *module_api_version*. If that version does not match the version
of the running interpreter, a :exc:`RuntimeWarning` is emitted.
Return ``NULL`` with an exception set on error.
.. note::
Most uses of this function should be using :c:func:`PyModule_Create`
Expand Down Expand Up @@ -436,6 +440,8 @@ objects dynamically. Note that both ``PyModule_FromDefAndSpec`` and
If that version does not match the version of the running interpreter,
a :exc:`RuntimeWarning` is emitted.
Return ``NULL`` with an exception set on error.
.. note::
Most uses of this function should be using :c:func:`PyModule_FromDefAndSpec`
Expand Down Expand Up @@ -486,7 +492,7 @@ state:
On success, return ``0``. On error, raise an exception and return ``-1``.
Return ``NULL`` if *value* is ``NULL``. It must be called with an exception
Return ``-1`` if *value* is ``NULL``. It must be called with an exception
raised in this case.
Example usage::
Expand Down Expand Up @@ -579,23 +585,24 @@ state:
.. c:function:: int PyModule_AddIntConstant(PyObject *module, const char *name, long value)
Add an integer constant to *module* as *name*. This convenience function can be
used from the module's initialization function. Return ``-1`` on error, ``0`` on
success.
used from the module's initialization function.
Return ``-1`` with an exception set on error, ``0`` on success.
.. c:function:: int PyModule_AddStringConstant(PyObject *module, const char *name, const char *value)
Add a string constant to *module* as *name*. This convenience function can be
used from the module's initialization function. The string *value* must be
``NULL``-terminated. Return ``-1`` on error, ``0`` on success.
``NULL``-terminated.
Return ``-1`` with an exception set on error, ``0`` on success.
.. c:macro:: PyModule_AddIntMacro(module, macro)
Add an int constant to *module*. The name and the value are taken from
*macro*. For example ``PyModule_AddIntMacro(module, AF_INET)`` adds the int
constant *AF_INET* with the value of *AF_INET* to *module*.
Return ``-1`` on error, ``0`` on success.
Return ``-1`` with an exception set on error, ``0`` on success.
.. c:macro:: PyModule_AddStringMacro(module, macro)
Expand All @@ -608,7 +615,7 @@ state:
The type object is finalized by calling internally :c:func:`PyType_Ready`.
The name of the type object is taken from the last component of
:c:member:`~PyTypeObject.tp_name` after dot.
Return ``-1`` on error, ``0`` on success.
Return ``-1`` with an exception set on error, ``0`` on success.
.. versionadded:: 3.9
Expand Down Expand Up @@ -647,14 +654,14 @@ since multiple such modules can be created from a single definition.
The caller must hold the GIL.
Return 0 on success or -1 on failure.
Return ``-1`` with an exception set on error, ``0`` on success.
.. versionadded:: 3.3
.. c:function:: int PyState_RemoveModule(PyModuleDef *def)
Removes the module object created from *def* from the interpreter state.
Return 0 on success or -1 on failure.
Return ``-1`` with an exception set on error, ``0`` on success.
The caller must hold the GIL.
Expand Down
28 changes: 24 additions & 4 deletions _sources/faq/programming.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1741,11 +1741,31 @@ but effective way to define class private variables. Any identifier of the form
is textually replaced with ``_classname__spam``, where ``classname`` is the
current class name with any leading underscores stripped.

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

.. code-block:: python
class A:
def __one(self):
return 1
def two(self):
return 2 * self.__one()
class B(A):
def three(self):
return 3 * self._A__one()
four = 4 * A()._A__one()
In particular, this does not guarantee privacy since an outside user can still
deliberately access the private attribute; many Python programmers never bother
to use private variable names at all.

.. seealso::

The :ref:`private name mangling specifications <private-name-mangling>`
for details and special cases.

My class defines __del__ but it is not called when I delete the object.
-----------------------------------------------------------------------
Expand Down
58 changes: 44 additions & 14 deletions _sources/library/configparser.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -147,23 +147,28 @@ case-insensitive and stored in lowercase [1]_.
It is possible to read several configurations into a single
:class:`ConfigParser`, where the most recently added configuration has the
highest priority. Any conflicting keys are taken from the more recent
configuration while the previously existing keys are retained.
configuration while the previously existing keys are retained. The example
below reads in an ``override.ini`` file, which will override any conflicting
keys from the ``example.ini`` file.

.. code-block:: ini
[DEFAULT]
ServerAliveInterval = -1
.. doctest::

>>> another_config = configparser.ConfigParser()
>>> another_config.read('example.ini')
['example.ini']
>>> another_config['topsecret.server.example']['Port']
'50022'
>>> another_config.read_string("[topsecret.server.example]\nPort=48484")
>>> another_config['topsecret.server.example']['Port']
'48484'
>>> another_config.read_dict({"topsecret.server.example": {"Port": 21212}})
>>> another_config['topsecret.server.example']['Port']
'21212'
>>> another_config['topsecret.server.example']['ForwardX11']
'no'
>>> config_override = configparser.ConfigParser()
>>> config_override['DEFAULT'] = {'ServerAliveInterval': '-1'}
>>> with open('override.ini', 'w') as configfile:
... config_override.write(configfile)
...
>>> config_override = configparser.ConfigParser()
>>> config_override.read(['example.ini', 'override.ini'])
['example.ini', 'override.ini']
>>> print(config_override.get('DEFAULT', 'ServerAliveInterval'))
-1


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

It is possible to read several configurations into a single
:class:`ConfigParser`, where the most recently added configuration has the
highest priority. Any conflicting keys are taken from the more recent
configuration while the previously existing keys are retained. The example
below reads in an ``override.ini`` file, which will override any conflicting
keys from the ``example.ini`` file.

.. code-block:: ini
[DEFAULT]
ServerAliveInterval = -1
.. doctest::

>>> config_override = configparser.ConfigParser()
>>> config_override['DEFAULT'] = {'ServerAliveInterval': '-1'}
>>> with open('override.ini', 'w') as configfile:
... config_override.write(configfile)
...
>>> config_override = configparser.ConfigParser()
>>> config_override.read(['example.ini', 'override.ini'])
['example.ini', 'override.ini']
>>> print(config_override.get('DEFAULT', 'ServerAliveInterval'))
-1

.. versionchanged:: 3.1
The default *dict_type* is :class:`collections.OrderedDict`.

Expand Down
2 changes: 1 addition & 1 deletion _sources/library/ftplib.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ FTP objects
Retrieve a file in binary transfer mode.

:param str cmd:
An appropriate ``STOR`` command: :samp:`"STOR {filename}"`.
An appropriate ``RETR`` command: :samp:`"RETR {filename}"`.

:param callback:
A single parameter callable that is called
Expand Down
14 changes: 14 additions & 0 deletions _sources/library/multiprocessing.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ processes:
p.join()

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

**Pipes**

Expand Down Expand Up @@ -281,6 +282,8 @@ processes:
of corruption from processes using different ends of the pipe at the same
time.

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

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

One difference from other Python queue implementations, is that :mod:`multiprocessing`
queues serializes all objects that are put into them using :mod:`pickle`.
The object return by the get method is a re-created object that does not share memory
with the original object.

Note that one can also create a shared queue by using a manager object -- see
:ref:`multiprocessing-managers`.

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

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

.. class:: Queue([maxsize])

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

May raise an :exc:`OSError` on closed queues. (not guaranteed)

.. method:: full()

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

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

Always raises an :exc:`OSError` if the SimpleQueue is closed.

.. method:: get()

Remove and return an item from the queue.
Expand Down
2 changes: 1 addition & 1 deletion _sources/library/profile.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ you are using :class:`profile.Profile` or :class:`cProfile.Profile`,
As the :class:`cProfile.Profile` class cannot be calibrated, custom timer
functions should be used with care and should be as fast as possible. For
the best results with a custom timer, it might be necessary to hard-code it
in the C source of the internal :mod:`_lsprof` module.
in the C source of the internal :mod:`!_lsprof` module.

Python 3.3 adds several new functions in :mod:`time` that can be used to make
precise measurements of process or wall-clock time. For example, see
Expand Down
51 changes: 40 additions & 11 deletions _sources/reference/expressions.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,47 @@ exception.
pair: name; mangling
pair: private; names

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

When an identifier that textually occurs in a class definition begins with two
or more underscore characters and does not end in two or more underscores, it
is considered a :dfn:`private name` of that class.

.. seealso::

The :ref:`class specifications <class>`.

More precisely, private names are transformed to a longer form before code is
generated for them. If the transformed name is longer than 255 characters,
implementation-defined truncation may happen.

The transformation is independent of the syntactical context in which the
identifier is used but only the following private identifiers are mangled:

- Any name used as the name of a variable that is assigned or read or any
name of an attribute being accessed.

The ``__name__`` attribute of nested functions, classes, and type aliases
is however not mangled.

- The name of imported modules, e.g., ``__spam`` in ``import __spam``.
If the module is part of a package (i.e., its name contains a dot),
the name is *not* mangled, e.g., the ``__foo`` in ``import __foo.bar``
is not mangled.

- The name of an imported member, e.g., ``__f`` in ``from spam import __f``.

The transformation rule is defined as follows:

- The class name, with leading underscores removed and a single leading
underscore inserted, is inserted in front of the identifier, e.g., the
identifier ``__spam`` occurring in a class named ``Foo``, ``_Foo`` or
``__Foo`` is transformed to ``_Foo__spam``.

- If the class name consists only of underscores, the transformation is the
identity, e.g., the identifier ``__spam`` occurring in a class named ``_``
or ``__`` is left as is.

.. _atom-literals:

Expand Down
5 changes: 5 additions & 0 deletions _sources/tutorial/classes.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,11 @@ current class name with leading underscore(s) stripped. This mangling is done
without regard to the syntactic position of the identifier, as long as it
occurs within the definition of a class.

.. seealso::

The :ref:`private name mangling specifications <private-name-mangling>`
for details and special cases.

Name mangling is helpful for letting subclasses override methods without
breaking intraclass method calls. For example::

Expand Down
2 changes: 1 addition & 1 deletion _sources/whatsnew/3.4.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1495,7 +1495,7 @@ The dictionary returned by :meth:`.SSLSocket.getpeercert` contains additional
stat
----

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

Expand Down
4 changes: 2 additions & 2 deletions _sources/whatsnew/3.5.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1935,8 +1935,8 @@ specifying the namespace in which the code will be running.
tkinter
-------

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

Expand Down
4 changes: 2 additions & 2 deletions _sources/whatsnew/3.7.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2048,7 +2048,7 @@ The :mod:`macpath` is now deprecated and will be removed in Python 3.8.
threading
---------

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

* :mod:`asyncio` no longer exports the :mod:`selectors` and
:mod:`_overlapped` modules as ``asyncio.selectors`` and
:mod:`!_overlapped` modules as ``asyncio.selectors`` and
``asyncio._overlapped``. Replace ``from asyncio import selectors`` with
``import selectors``.

Expand Down
Loading

0 comments on commit 3ec8dcb

Please sign in to comment.