Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 17 additions & 0 deletions Doc/c-api/exceptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,23 @@ For convenience, some of these functions will always return a
use.


.. c:function:: PyObject *PyErr_ProgramTextObject(PyObject *filename, int lineno)

Get the source line in *filename* at line *lineno*. *filename* should be a
Python :class:`str` object.

On success, this function returns a Python string object with the found line.
On failure, this function returns ``NULL`` without an exception set.


.. c:function:: PyObject *PyErr_ProgramText(const char *filename, int lineno)

Similar to :c:func:`PyErr_ProgramTextObject`, but *filename* is a
:c:expr:`const char *`, which is decoded with the
:term:`filesystem encoding and error handler`, instead of a
Python object reference.


Issuing warnings
================

Expand Down
12 changes: 11 additions & 1 deletion Doc/c-api/hash.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,16 @@ See also the :c:member:`PyTypeObject.tp_hash` member and :ref:`numeric-hash`.
it is easier to create colliding strings. A cutoff of 7 on 64-bit platforms
and 5 on 32-bit platforms should provide a decent safety margin.

This corresponds to the :data:`sys.hash_info.cutoff` constant.

.. versionadded:: 3.4


.. c:macro:: PyHASH_MODULUS

The `Mersenne prime <https://en.wikipedia.org/wiki/Mersenne_prime>`_ ``P = 2**n -1``,
used for numeric hash scheme.

This corresponds to the :data:`sys.hash_info.modulus` constant.

.. versionadded:: 3.13
Expand All @@ -71,7 +74,6 @@ See also the :c:member:`PyTypeObject.tp_hash` member and :ref:`numeric-hash`.
.. c:macro:: PyHASH_BITS

The exponent ``n`` of ``P`` in :c:macro:`PyHASH_MODULUS`.
This corresponds to the :data:`sys.hash_info.hash_bits` constant.

.. versionadded:: 3.13

Expand All @@ -86,6 +88,7 @@ See also the :c:member:`PyTypeObject.tp_hash` member and :ref:`numeric-hash`.
.. c:macro:: PyHASH_INF

The hash value returned for a positive infinity.

This corresponds to the :data:`sys.hash_info.inf` constant.

.. versionadded:: 3.13
Expand All @@ -94,6 +97,7 @@ See also the :c:member:`PyTypeObject.tp_hash` member and :ref:`numeric-hash`.
.. c:macro:: PyHASH_IMAG

The multiplier used for the imaginary part of a complex number.

This corresponds to the :data:`sys.hash_info.imag` constant.

.. versionadded:: 3.13
Expand All @@ -111,14 +115,20 @@ See also the :c:member:`PyTypeObject.tp_hash` member and :ref:`numeric-hash`.

Hash function name (UTF-8 encoded string).

This corresponds to the :data:`sys.hash_info.algorithm` constant.

.. c:member:: const int hash_bits

Internal size of the hash value in bits.

This corresponds to the :data:`sys.hash_info.hash_bits` constant.

.. c:member:: const int seed_bits

Size of seed input in bits.

This corresponds to the :data:`sys.hash_info.seed_bits` constant.

.. versionadded:: 3.4


Expand Down
6 changes: 5 additions & 1 deletion Doc/library/sys.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1176,10 +1176,14 @@ always available. Unless explicitly noted otherwise, all variables are read-only

The size of the seed key of the hash algorithm

.. attribute:: hash_info.cutoff

Cutoff for small string DJBX33A optimization in range ``[1, cutoff)``.

.. versionadded:: 3.2

.. versionchanged:: 3.4
Added *algorithm*, *hash_bits* and *seed_bits*
Added *algorithm*, *hash_bits*, *seed_bits*, and *cutoff*.


.. data:: hexversion
Expand Down
4 changes: 2 additions & 2 deletions Doc/library/time.rst
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,9 @@ Functions
On Windows, if *secs* is zero, the thread relinquishes the remainder of its
time slice to any other thread that is ready to run. If there are no other
threads ready to run, the function returns immediately, and the thread
continues execution. On Windows 8.1 and newer the implementation uses
continues execution. On Windows 10 and newer the implementation uses
a `high-resolution timer
<https://learn.microsoft.com/windows-hardware/drivers/kernel/high-resolution-timers>`_
<https://learn.microsoft.com/windows/win32/api/synchapi/nf-synchapi-createwaitabletimerexw>`_
which provides resolution of 100 nanoseconds. If *secs* is zero, ``Sleep(0)`` is used.

.. rubric:: Unix implementation
Expand Down
Loading