Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 653855 Details for
Bug 736473
sys-apps/portage: anydbm cache module does not support multiprocessing
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Test case showing that modifications in child process are not visible to parent
dbm_fork_test.py (text/x-python), 941 bytes, created by
Zac Medico
on 2020-08-09 05:18:43 UTC
(
hide
)
Description:
Test case showing that modifications in child process are not visible to parent
Filename:
MIME Type:
Creator:
Zac Medico
Created:
2020-08-09 05:18:43 UTC
Size:
941 bytes
patch
obsolete
>#!/usr/bin/python ># Demo for https://bugs.gentoo.org/736473. > >import dbm.gnu >import multiprocessing >import os >import tempfile > >expected = { > b'child_key': b'child_value', > b'parent_key': b'parent_value', >} > >with tempfile.NamedTemporaryFile() as temp_db: > > db_path = temp_db.name > > db = dbm.gnu.open(db_path, 'wu') > db[b'parent_key'] = expected[b'parent_key'] > > def modify_db(): > db[b'child_key'] = expected[b'child_key'] > > proc = multiprocessing.Process(target=modify_db) > proc.start() > proc.join() > > # All keys are visible if we re-open db here. > # db = dbm.gnu.open(db_path, 'wu') > db_keys = set(db.keys()) > > for k in expected: > if k not in db_keys: > raise AssertionError('db has missing key {}'.format(k)) > > for k in db_keys: > if k not in expected: > raise AssertionError('db has unexpected key {}'.format(k)) > if db[k] != expected[k]: > raise AssertionError('unexpected value for key {}, {} != {}'.format(k, db[k], expected[k]))
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 736473
: 653855