8000 bpo-39850: Add support for abstract sockets in multiprocessing by pablogsal · Pull Request #18866 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-39850: Add support for abstract sockets in multiprocessing #18866

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 9, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Address feedback
  • Loading branch information
pablogsal committed Mar 9, 2020
commit a8017bee2b482bacd78c68c01f601bd4e6906038
4 changes: 3 additions & 1 deletion Lib/multiprocessing/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,16 @@ def log_to_stderr(level=None):
# Abstract socket support

def _platform_supports_abstract_sockets():
if "linux" in sys.platform:
if sys.platform == "linux":
return True
if hasattr(sys, 'getandroidapilevel'):
return True
return False


def is_abstract_socket_namespace(address):
if not address:
return False
if isinstance(address, bytes):
return address[0] == 0
elif isinstance(address, str):
Expand Down
6 changes: 3 additions & 3 deletions Lib/test/_test_multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3279,12 +3279,12 @@ def test_context(self):
def test_abstract_socket(self):
with self.connection.Listener("\0something") as listener:
with self.connection.Client(l.address) as client:
with l.accept() as d:
c.send(1729)
with listener.accept() as d:
client.send(1729)
self.assertEqual(d.recv(), 1729)

if self.TYPE == 'processes':
self.assertRaises(OSError, l.accept)
self.assertRaises(OSError, listener.accept)


class _TestListenerClient(BaseTestCase):
Expand Down
0