Skip to content

In test._test_multiprocessing file, HAVE_GETVALUE constant is always False #155445

Description

@YvesDup

Bug report

Bug description:

In the test._test_multprocessing, the HAVE_GETVALUE constant is always False because the HAVE_BROKEN_SEM_GETVALUE value does not exist in _multiprocessingmodule.

HAVE_GETVALUE = not getattr(_multiprocessing,
'HAVE_BROKEN_SEM_GETVALUE', False)

On macOS, this value exists only in the flagsdict of _multiprocessing.

>>> import _mulitpocessing
>>> vars(_multiprocessing)
{'__name__': '_multiprocessing', '__doc__': None, '__package__': '', 
'__loader__':  ............ ,
.......
'SemLock': <class '_multiprocessing.SemLock'>,
'flags': {'HAVE_SEM_OPEN': 1, 'HAVE_BROKEN_SEM_GETVALUE': 1}}

Fix is easy and will permit to reactivate the second part of test_bounded_semaphore test.

#if HAVE_GETVALUE:
# self.assertRaises(ValueError, sem.release)
# self.assertReturnsIfImplemented(2, get_value, sem)

A new PR will be submitted soon.

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS, Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions