3
‰å<_ƒ! ã @ sà d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlm Z m
Z
dd„ Zdae
dd„ ƒZ
d d
„ Zeƒ ZejZeje_ejge_ejejƒejkr¨eejƒZndZdd
„ Ze
dd„ ƒZdd„ Zg adae
dd„ ƒZdS )é )Úprint_functionN)ÚclosingÚcontextmanagerc
C sp t | dƒr| jdƒ nVyddl}W n tk
r> tdƒ‚Y n.X | jƒ }|j||jƒ}|j||j||jB ƒ dS )zŸEnsures that the socket is not inherited by child processes
Raises:
EnvironmentError
NotImplementedError: With Python <3.4 on Windows
Úset_inheritableFr Nz+Not implemented for older Python on Windows) Úhasattrr ÚfcntlÚImportErrorÚNotImplementedErrorÚfilenoZF_GETFDZF_SETFDZ
FD_CLOEXEC)Úsockr ÚfdÚflags© r ú$/usr/lib64/python3.6/_ossighelper.pyÚensure_socket_not_inheritable s
r Fc ' # s˜ t rdV dS ddlm‰ tjdkp4tjdd… d
k} ttdƒ}| sL| rVdV dS tj ƒ \‰}t
ˆƒ��" t
|ƒ�� x"ˆ|gD ]}|jd ƒ t|ƒ q„W yt
j|jƒ ƒ}W n tk
rÊ dV dS X d
a ‡ ‡fdd„}zxtjdk� rþˆ jjˆjƒ ƒ}nˆ jjˆjƒ ƒ}ˆ j|ˆ jˆ jjˆ jjB ˆ jjB ˆ jjB |ƒ}z
dV W dˆ j|ƒ X W dt
j|ƒ}||jƒ k�rzt
j|ƒ d a X W dQ R X W dQ R X dS )a A decorator for functions which create a glib event loop to keep
Python signal handlers working while the event loop is idling.
In case an OS signal is received will wake the default event loop up
shortly so that any registered Python signal handlers registered through
signal.signal() can run.
Works on Windows but needs Python 3.5+.
In case the wrapped function is not called from the main thread it will be
called as is and it will not wake up the default loop for signals.
Nr )ÚGLibÚnté é é Ú
socketpairFTc sN |ˆ j @ rFytˆjdƒƒS tk
r@ } zt|ƒ dS d }~X nX dS dS d S )Né FT)ZIO_INÚboolZrecvÚEnvironmentErrorÚprint)ÚsourceZ conditionÚe)r Úread_socketr r Ú
signal_notifyi s
z'wakeup_on_signal.