Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions Doc/c-api/bytes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,42 @@ called with a non-bytes parameter.
The function is :term:`soft deprecated`,
use the :c:type:`PyBytesWriter` API instead.


.. c:function:: PyObject *PyBytes_Repr(PyObject *bytes, int smartquotes)

Get the string representation of *bytes*. This function is currently used to
implement :meth:`!bytes.__repr__` in Python.

This function does not do type checking; it is undefined behavior to pass
*bytes* as a non-bytes object or ``NULL``.

If *smartquotes* is true, the representation will use a double-quoted string
instead of single-quoted string when single-quotes are present in *bytes*.
For example, the byte string ``'Python'`` would be represented as
``b"'Python'"`` when *smartquotes* is true, or ``b'\'Python\''`` when it is
false.

On success, this function returns a :term:`strong reference` to a
:class:`str` object containing the representation. On failure, this
returns ``NULL`` with an exception set.


.. c:function:: PyObject *PyBytes_DecodeEscape(const char *s, Py_ssize_t len, const char *errors, Py_ssize_t unicode, const char *recode_encoding)

Unescape a backslash-escaped string *s*. *s* must not be ``NULL``.
*len* must be the size of *s*.

*errors* must be one of ``"strict"``, ``"replace"``, or ``"ignore"``. If
*errors* is ``NULL``, then ``"strict"`` is used by default.

On success, this function returns a :term:`strong reference` to a Python
:class:`bytes` object containing the unescaped string. On failure, this
function returns ``NULL`` with an exception set.

.. versionchanged:: 3.9
*unicode* and *recode_encoding* are now unused.


.. _pybyteswriter:

PyBytesWriter
Expand Down
23 changes: 23 additions & 0 deletions Doc/c-api/file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,29 @@ the :mod:`io` APIs instead.
.. versionadded:: 3.8
.. c:function:: PyObject *PyFile_OpenCodeObject(PyObject *path)
Open *path* with the mode ``'rb'``. *path* must be a Python :class:`str`
object. The behavior of this function may be overridden by
:c:func:`PyFile_SetOpenCodeHook` to allow for some preprocessing of the
text.
This is analogous to :func:`io.open_code` in Python.
On success, this function returns a :term:`strong reference` to a Python
file object. On failure, this function returns ``NULL`` with an exception
set.
.. versionadded:: 3.8
.. c:function:: PyObject *PyFile_OpenCode(const char *path)
Similar to :c:func:`PyFile_OpenCodeObject`, but *path* is a
UTF-8 encoded :c:expr:`const char*`.
.. versionadded:: 3.8
.. c:function:: int PyFile_WriteObject(PyObject *obj, PyObject *p, int flags)
Expand Down
18 changes: 18 additions & 0 deletions Doc/c-api/float.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,24 @@ Floating-Point Objects
Return the minimum normalized positive float *DBL_MIN* as C :c:expr:`double`.


.. c:macro:: Py_INFINITY

This macro expands a to constant expression of type :c:expr:`double`, that
represents the positive infinity.

On most platforms, this is equivalent to the :c:macro:`!INFINITY` macro from
the C11 standard ``<math.h>`` header.


.. c:macro:: Py_NAN

This macro expands a to constant expression of type :c:expr:`double`, that
represents a quiet not-a-number (qNaN) value.

On most platforms, this is equivalent to the :c:macro:`!NAN` macro from
the C11 standard ``<math.h>`` header.


.. c:macro:: Py_MATH_El

High precision (long double) definition of :data:`~math.e` constant.
Expand Down
14 changes: 14 additions & 0 deletions Doc/c-api/type.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,20 @@ Type Objects
.. versionadded:: 3.12


.. c:function:: int PyType_Unwatch(int watcher_id, PyObject *type)

Mark *type* as not watched. This undoes a previous call to
:c:func:`PyType_Watch`. *type* must not be ``NULL``.

An extension should never call this function with a *watcher_id* that was
not returned to it by a previous call to :c:func:`PyType_AddWatcher`.

On success, this function returns ``0``. On failure, this function returns
``-1`` with an exception set.

.. versionadded:: 3.12


.. c:type:: int (*PyType_WatchCallback)(PyObject *type)

Type of a type-watcher callback function.
Expand Down
34 changes: 26 additions & 8 deletions Doc/library/smtplib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ Protocol) and :rfc:`1869` (SMTP Service Extensions).
.. class:: SMTP(host='', port=0, local_hostname=None[, timeout], source_address=None)

An :class:`SMTP` instance encapsulates an SMTP connection. It has methods
that support a full repertoire of SMTP and ESMTP operations. If the optional
*host* and *port* parameters are given, the SMTP :meth:`connect` method is
called with those parameters during initialization. If specified,
*local_hostname* is used as the FQDN of the local host in the HELO/EHLO
that support a full repertoire of SMTP and ESMTP operations.

If the host parameter is set to a truthy value, :meth:`SMTP.connect` is called with
host and port automatically when the object is created; otherwise, :meth:`!connect` must
be called manually.

If specified, *local_hostname* is used as the FQDN of the local host in the HELO/EHLO
command. Otherwise, the local hostname is found using
:func:`socket.getfqdn`. If the :meth:`connect` call returns anything other
than a success code, an :exc:`SMTPConnectError` is raised. The optional
Expand Down Expand Up @@ -62,6 +65,10 @@ Protocol) and :rfc:`1869` (SMTP Service Extensions).
``smtplib.SMTP.send`` with arguments ``self`` and ``data``,
where ``data`` is the bytes about to be sent to the remote host.

.. attribute:: SMTP.default_port

The default port used for SMTP connections (25).

.. versionchanged:: 3.3
Support for the :keyword:`with` statement was added.

Expand All @@ -80,15 +87,23 @@ Protocol) and :rfc:`1869` (SMTP Service Extensions).

An :class:`SMTP_SSL` instance behaves exactly the same as instances of
:class:`SMTP`. :class:`SMTP_SSL` should be used for situations where SSL is
required from the beginning of the connection and using :meth:`~SMTP.starttls`
is not appropriate. If *host* is not specified, the local host is used. If
*port* is zero, the standard SMTP-over-SSL port (465) is used. The optional
arguments *local_hostname*, *timeout* and *source_address* have the same
required from the beginning of the connection and using :meth:`SMTP.starttls` is
not appropriate.

If the host parameter is set to a truthy value, :meth:`SMTP.connect` is called with host
and port automatically when the object is created; otherwise, :meth:`!SMTP.connect` must
be called manually.

The optional arguments *local_hostname*, *timeout* and *source_address* have the same
meaning as they do in the :class:`SMTP` class. *context*, also optional,
can contain a :class:`~ssl.SSLContext` and allows configuring various
aspects of the secure connection. Please read :ref:`ssl-security` for
best practices.

.. attribute:: SMTP_SSL.default_port

The default port used for SMTP-over-SSL connections (465).

.. versionchanged:: 3.3
*context* was added.

Expand Down Expand Up @@ -259,6 +274,9 @@ An :class:`SMTP` instance has the following methods:
2-tuple of the response code and message sent by the server in its
connection response.

If port is not changed from its default value of 0, the value of the :attr:`default_port`
attribute is used.

.. audit-event:: smtplib.connect self,host,port smtplib.SMTP.connect


Expand Down
124 changes: 62 additions & 62 deletions Doc/library/turtle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2801,68 +2801,68 @@ The demo scripts are:

.. tabularcolumns:: |l|L|L|

+----------------+------------------------------+-----------------------+
| Name | Description | Features |
+================+==============================+=======================+
| bytedesign | complex classical | :func:`tracer`, delay,|
| | turtle graphics pattern | :func:`update` |
+----------------+------------------------------+-----------------------+
| chaos | graphs Verhulst dynamics, | world coordinates |
| | shows that computer's | |
| | computations can generate | |
| | results sometimes against the| |
| | common sense expectations | |
+----------------+------------------------------+-----------------------+
| clock | analog clock showing time | turtles as clock's |
| | of your computer | hands, ontimer |
+----------------+------------------------------+-----------------------+
| colormixer | experiment with r, g, b | :func:`ondrag` |
+----------------+------------------------------+-----------------------+
| forest | 3 breadth-first trees | randomization |
+----------------+------------------------------+-----------------------+
| fractalcurves | Hilbert & Koch curves | recursion |
+----------------+------------------------------+-----------------------+
| lindenmayer | ethnomathematics | L-System |
| | (indian kolams) | |
+----------------+------------------------------+-----------------------+
| minimal_hanoi | Towers of Hanoi | Rectangular Turtles |
| | | as Hanoi discs |
| | | (shape, shapesize) |
+----------------+------------------------------+-----------------------+
| nim | play the classical nim game | turtles as nimsticks, |
| | with three heaps of sticks | event driven (mouse, |
| | against the computer. | keyboard) |
+----------------+------------------------------+-----------------------+
| paint | super minimalistic | :func:`onclick` |
| | drawing program | |
+----------------+------------------------------+-----------------------+
| peace | elementary | turtle: appearance |
| | | and animation |
+----------------+------------------------------+-----------------------+
| penrose | aperiodic tiling with | :func:`stamp` |
| | kites and darts | |
+----------------+------------------------------+-----------------------+
| planet_and_moon| simulation of | compound shapes, |
| | gravitational system | :class:`Vec2D` |
+----------------+------------------------------+-----------------------+
| rosette | a pattern from the wikipedia | :func:`clone`, |
| | article on turtle graphics | :func:`undo` |
+----------------+------------------------------+-----------------------+
| round_dance | dancing turtles rotating | compound shapes, clone|
| | pairwise in opposite | shapesize, tilt, |
| | direction | get_shapepoly, update |
+----------------+------------------------------+-----------------------+
| sorting_animate| visual demonstration of | simple alignment, |
| | different sorting methods | randomization |
+----------------+------------------------------+-----------------------+
| tree | a (graphical) breadth | :func:`clone` |
| | first tree (using generators)| |
+----------------+------------------------------+-----------------------+
| two_canvases | simple design | turtles on two |
| | | canvases |
+----------------+------------------------------+-----------------------+
| yinyang | another elementary example | :func:`circle` |
+----------------+------------------------------+-----------------------+
+------------------------+------------------------------+--------------------------------------+
| Name | Description | Features |
+========================+==============================+======================================+
| ``bytedesign`` | complex classical | :func:`tracer`, :func:`delay`, |
| | turtle graphics pattern | :func:`update` |
+------------------------+------------------------------+--------------------------------------+
| ``chaos`` | graphs Verhulst dynamics, | world coordinates |
| | shows that computer's | |
| | computations can generate | |
| | results sometimes against the| |
| | common sense expectations | |
+------------------------+------------------------------+--------------------------------------+
| ``clock`` | analog clock showing time | turtles as clock's |
| | of your computer | hands, :func:`ontimer` |
+------------------------+------------------------------+--------------------------------------+
| ``colormixer`` | experiment with r, g, b | :func:`ondrag` |
+------------------------+------------------------------+--------------------------------------+
| ``forest`` | 3 breadth-first trees | randomization |
+------------------------+------------------------------+--------------------------------------+
| ``fractalcurves`` | Hilbert & Koch curves | recursion |
+------------------------+------------------------------+--------------------------------------+
| ``lindenmayer`` | ethnomathematics | L-System |
| | (indian kolams) | |
+------------------------+------------------------------+--------------------------------------+
| ``minimal_hanoi`` | Towers of Hanoi | Rectangular Turtles |
| | | as Hanoi discs |
| | | (:func:`shape`, :func:`shapesize`) |
+------------------------+------------------------------+--------------------------------------+
| ``nim`` | play the classical nim game | turtles as nimsticks, |
| | with three heaps of sticks | event driven (mouse, |
| | against the computer. | keyboard) |
+------------------------+------------------------------+--------------------------------------+
| ``paint`` | super minimalistic | :func:`onclick` |
| | drawing program | |
+------------------------+------------------------------+--------------------------------------+
| ``peace`` | elementary | turtle: appearance |
| | | and animation |
+------------------------+------------------------------+--------------------------------------+
| ``penrose`` | aperiodic tiling with | :func:`stamp` |
| | kites and darts | |
+------------------------+------------------------------+--------------------------------------+
| ``planet_and_moon`` | simulation of | compound shapes, |
| | gravitational system | :class:`Vec2D` |
+------------------------+------------------------------+--------------------------------------+
| ``rosette`` | a pattern from the wikipedia | :func:`clone`, |
| | article on turtle graphics | :func:`undo` |
+------------------------+------------------------------+--------------------------------------+
| ``round_dance`` | dancing turtles rotating | compound shapes, :func:`clone` |
| | pairwise in opposite | :func:`shapesize`, :func:`tilt`, |
| | direction | :func:`get_shapepoly`, :func:`update`|
+------------------------+------------------------------+--------------------------------------+
| ``sorting_animate`` | visual demonstration of | simple alignment, |
| | different sorting methods | randomization |
+------------------------+------------------------------+--------------------------------------+
| ``tree`` | a (graphical) breadth | :func:`clone` |
| | first tree (using generators)| |
+------------------------+------------------------------+--------------------------------------+
| ``two_canvases`` | simple design | turtles on two |
| | | canvases |
+------------------------+------------------------------+--------------------------------------+
| ``yinyang`` | another elementary example | :func:`circle` |
+------------------------+------------------------------+--------------------------------------+

Have fun!

Expand Down
19 changes: 19 additions & 0 deletions Doc/using/windows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,25 @@ customization.
- Specify the default format used by the ``py list`` command.
By default, ``table``.

* - ``install_dir``
- (none)
- Specify the root directory that runtimes will be installed into.
If you change this setting, previously installed runtimes will not be
usable unless you move them to the new location.

* - ``global_dir``
- (none)
- Specify the directory where global commands (such as ``python3.14.exe``)
are stored.
This directory should be added to your :envvar:`PATH` to make the
commands available from your terminal.

* - ``download_dir``
- (none)
- Specify the directory where downloaded files are stored.
This directory is a temporary cache, and can be cleaned up from time to
time.

Dotted names should be nested inside JSON objects, for example, ``list.format``
would be specified as ``{"list": {"format": "table"}}``.

Expand Down
1 change: 1 addition & 0 deletions Doc/whatsnew/3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ math
mimetypes
---------

* Add ``application/node`` MIME type for ``.cjs`` extension. (Contributed by John Franey in :gh:`140937`.)
* Add ``application/toml``. (Contributed by Gil Forcada in :gh:`139959`.)
* Rename ``application/x-texinfo`` to ``application/texinfo``.
(Contributed by Charlie Lin in :gh:`140165`)
Expand Down
Loading
Loading