diff --git a/Doc/c-api/stable.rst b/Doc/c-api/stable.rst index 290166696dd8511..b08a7bf1b2fa4f8 100644 --- a/Doc/c-api/stable.rst +++ b/Doc/c-api/stable.rst @@ -294,7 +294,7 @@ The full API is described below for advanced use cases. Default flags, based on current values of macros such as :c:macro:`Py_LIMITED_API` and :c:macro:`Py_GIL_DISABLED`. - Alternately, the field can be set to to the following flags, combined + Alternately, the field can be set to the following flags, combined by bitwise OR. Unused bits must be set to zero. diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index 7eb048fcfc28f96..19296eb247ae293 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -1257,7 +1257,7 @@ find and load modules. To accommodate this requirement, when running on iOS, extension module binaries are *not* packaged as ``.so`` files on ``sys.path``, but as individual standalone frameworks. To discover those frameworks, this loader - is be registered against the ``.fwork`` file extension, with a ``.fwork`` + is registered against the ``.fwork`` file extension, with a ``.fwork`` file acting as a placeholder in the original location of the binary on ``sys.path``. The ``.fwork`` file contains the path of the actual binary in the ``Frameworks`` folder, relative to the app bundle. To allow for diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 2c5b721093d5c09..97e7e08364e0bda 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -5944,7 +5944,7 @@ It is written as ``None``. The Ellipsis Object ------------------- -This object is commonly used used to indicate that something is omitted. +This object is commonly used to indicate that something is omitted. It supports no special operations. There is exactly one ellipsis object, named :const:`Ellipsis` (a built-in name). ``type(Ellipsis)()`` produces the :const:`Ellipsis` singleton. diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst index 677365c2f5994b2..1a2fbda0c4ce813 100644 --- a/Doc/whatsnew/3.14.rst +++ b/Doc/whatsnew/3.14.rst @@ -1140,7 +1140,7 @@ concurrent.futures .. _whatsnew314-concurrent-futures-start-method: * On Unix platforms other than macOS, :ref:`'forkserver' - ` is now the the default :ref:`start + ` is now the default :ref:`start method ` for :class:`~concurrent.futures.ProcessPoolExecutor` (replacing :ref:`'fork' `). @@ -1591,7 +1591,7 @@ multiprocessing .. _whatsnew314-multiprocessing-start-method: * On Unix platforms other than macOS, :ref:`'forkserver' - ` is now the the default :ref:`start + ` is now the default :ref:`start method ` (replacing :ref:`'fork' `). This change does not affect Windows or macOS, where :ref:`'spawn' diff --git a/Doc/whatsnew/3.15.rst b/Doc/whatsnew/3.15.rst index 56028a92aa2e29a..d3ae7c21a0358bc 100644 --- a/Doc/whatsnew/3.15.rst +++ b/Doc/whatsnew/3.15.rst @@ -1010,7 +1010,7 @@ Deprecated C APIs use the :c:type:`PyBytesWriter` API instead. (Contributed by Victor Stinner in :gh:`129813`.) -* Deprecate :c:member:`~PyComplexObject.cval` field of the the +* Deprecate :c:member:`~PyComplexObject.cval` field of the :c:type:`PyComplexObject` type. Use :c:func:`PyComplex_AsCComplex` and :c:func:`PyComplex_FromCComplex` to convert a Python complex number to/from the C :c:type:`Py_complex` diff --git a/Lib/test/test_free_threading/test_uuid.py b/Lib/test/test_free_threading/test_uuid.py new file mode 100755 index 000000000000000..d794afc552a6529 --- /dev/null +++ b/Lib/test/test_free_threading/test_uuid.py @@ -0,0 +1,60 @@ +import os +import unittest + +from test.support import import_helper, threading_helper +from test.support.threading_helper import run_concurrently +from uuid import SafeUUID + +c_uuid = import_helper.import_module("_uuid") + +NTHREADS = 10 +UUID_PER_THREAD = 1000 + + +@threading_helper.requires_working_threading() +class UUIDTests(unittest.TestCase): + @unittest.skipUnless(os.name == "posix", "POSIX only") + def test_generate_time_safe(self): + uuids = [] + + def worker(): + local_uuids = [] + for _ in range(UUID_PER_THREAD): + uuid, is_safe = c_uuid.generate_time_safe() + self.assertIs(type(uuid), bytes) + self.assertEqual(len(uuid), 16) + # Collect the UUID only if it is safe. If not, we cannot ensure + # UUID uniqueness. According to uuid_generate_time_safe() man + # page, it is theoretically possible for two concurrently + # running processes to generate the same UUID(s) if the return + # value is not 0. + if is_safe == SafeUUID.safe: + local_uuids.append(uuid) + + # Merge all safe uuids + uuids.extend(local_uuids) + + run_concurrently(worker_func=worker, nthreads=NTHREADS) + self.assertEqual(len(uuids), len(set(uuids))) + + @unittest.skipUnless(os.name == "nt", "Windows only") + def test_UuidCreate(self): + uuids = [] + + def worker(): + local_uuids = [] + for _ in range(UUID_PER_THREAD): + uuid = c_uuid.UuidCreate() + self.assertIs(type(uuid), bytes) + self.assertEqual(len(uuid), 16) + local_uuids.append(uuid) + + # Merge all uuids + uuids.extend(local_uuids) + + run_concurrently(worker_func=worker, nthreads=NTHREADS) + self.assertEqual(len(uuids), len(set(uuids))) + + +if __name__ == "__main__": + unittest.main()