Commit b672c36d authored by Fantix King's avatar Fantix King Committed by Denis Bilenko

fix urllib/urllib2/urlparse renamings in PY3 #38

Close #384.
parent 9701ce0f
...@@ -15,10 +15,15 @@ from gevent import monkey; monkey.patch_all() ...@@ -15,10 +15,15 @@ from gevent import monkey; monkey.patch_all()
import sys import sys
import re import re
import traceback import traceback
import urllib2
from urlparse import urlparse
from cgi import escape from cgi import escape
from urllib import unquote try:
import urllib2
from urlparse import urlparse
from urllib import unquote
except ImportError:
from urllib import request as urllib2
from urllib.parse import urlparse
from urllib.parse import unquote
LISTEN = ":8088" LISTEN = ":8088"
......
...@@ -6,7 +6,10 @@ import sys ...@@ -6,7 +6,10 @@ import sys
import time import time
import traceback import traceback
from datetime import datetime from datetime import datetime
from urllib import unquote try:
from urllib import unquote
except ImportError:
from urllib.parse import unquote
from gevent import socket from gevent import socket
import gevent import gevent
......
...@@ -100,6 +100,8 @@ def wrap_refcount(method): ...@@ -100,6 +100,8 @@ def wrap_refcount(method):
self.tearDown() self.tearDown()
if 'urlparse' in sys.modules: if 'urlparse' in sys.modules:
sys.modules['urlparse'].clear_cache() sys.modules['urlparse'].clear_cache()
if 'urllib.parse' in sys.modules:
sys.modules['urllib.parse'].clear_cache()
d = gettotalrefcount() - d d = gettotalrefcount() - d
deltas.append(d) deltas.append(d)
# the following configurations are classified as "no leak" # the following configurations are classified as "no leak"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment