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