Conditional import of attributes.
This commit is contained in:
@@ -14,14 +14,20 @@ import warnings
|
|||||||
__patched__ = ['fromfd', 'socketpair', 'gethostbyname', 'create_connection',
|
__patched__ = ['fromfd', 'socketpair', 'gethostbyname', 'create_connection',
|
||||||
'ssl', 'socket']
|
'ssl', 'socket']
|
||||||
|
|
||||||
__original_fromfd__ = __socket.fromfd
|
try:
|
||||||
def fromfd(*args):
|
__original_fromfd__ = __socket.fromfd
|
||||||
return socket(__original_fromfd__(*args))
|
def fromfd(*args):
|
||||||
|
return socket(__original_fromfd__(*args))
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
__original_socketpair__ = __socket.socketpair
|
try:
|
||||||
def socketpair(*args):
|
__original_socketpair__ = __socket.socketpair
|
||||||
one, two = __original_socketpair__(*args)
|
def socketpair(*args):
|
||||||
return socket(one), socket(two)
|
one, two = __original_socketpair__(*args)
|
||||||
|
return socket(one), socket(two)
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
__original_gethostbyname__ = __socket.gethostbyname
|
__original_gethostbyname__ = __socket.gethostbyname
|
||||||
def gethostbyname(name):
|
def gethostbyname(name):
|
||||||
|
|||||||
Reference in New Issue
Block a user