Skip to content

Commit d68f79d

Browse files
committed
Merge pull request #107 from minrk/check-fork-optional
make fork-safety check optional
2 parents 4fd1cc0 + e6e4384 commit d68f79d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

jupyter_client/session.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,13 @@ class Session(Configurable):
268268
269269
"""
270270

271-
debug=Bool(False, config=True, help="""Debug output in the Session""")
271+
debug = Bool(False, config=True, help="""Debug output in the Session""")
272+
273+
check_pid = Bool(True, config=True,
274+
help="""Whether to check PID to protect against calls after fork.
275+
276+
This check can be disabled if fork-safety is handled elsewhere.
277+
""")
272278

273279
packer = DottedObjectName('json',config=True,
274280
help="""The name of the packer for serializing messages.
@@ -656,7 +662,7 @@ def send(self, stream, msg_or_type, content=None, parent=None, ident=None,
656662
else:
657663
msg = self.msg(msg_or_type, content=content, parent=parent,
658664
header=header, metadata=metadata)
659-
if not os.getpid() == self.pid:
665+
if self.check_pid and not os.getpid() == self.pid:
660666
get_logger().warning("WARNING: attempted to send message from fork\n%s",
661667
msg
662668
)

0 commit comments

Comments
 (0)