GH-94736: Fix _multiprocessing.SemLock subclassing (GH-94738)

* fix allocator and deallocator

* 📜🤖 Added by blurb_it.

* code review

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
(cherry picked from commit f5b76330cf)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2022-07-11 05:39:09 -07:00 committed by GitHub
parent b87d03d355
commit 916686fdb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 4 deletions

View file

@ -5964,3 +5964,14 @@ def tearDownModule():
remote_globs['setUpModule'] = setUpModule
remote_globs['tearDownModule'] = tearDownModule
@unittest.skipIf(not hasattr(_multiprocessing, 'SemLock'), 'SemLock not available')
class SemLockTests(unittest.TestCase):
def test_semlock_subclass(self):
class SemLock(_multiprocessing.SemLock):
pass
name = f'test_semlock_subclass-{os.getpid()}'
s = SemLock(1, 0, 10, name, 0)
_multiprocessing.sem_unlink(name)