Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1d4e2d1

Browse files
committed
Fix for a socks module - proper unwrapmodule (Issue #58)
1 parent 23f2c5f commit 1d4e2d1

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

thirdparty/socks/socks.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353

5454
_defaultproxy = None
5555
_orgsocket = socket.socket
56+
_orgcreateconnection = socket.create_connection
5657

5758
class ProxyError(Exception): pass
5859
class GeneralProxyError(ProxyError): pass
@@ -113,8 +114,8 @@ def wrapmodule(module):
113114
raise GeneralProxyError((4, "no proxy specified"))
114115

115116
def unwrapmodule(module):
116-
module.socket.socket = socket.socket
117-
module.socket.create_connection = socket.create_connection
117+
module.socket.socket = _orgsocket
118+
module.socket.create_connection = _orgcreateconnection
118119

119120
class socksocket(socket.socket):
120121
"""socksocket([family[, type[, proto]]]) -> socket object

0 commit comments

Comments
 (0)