Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default kwargs are evaluated at definition time #29

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions pythonwhois/net.py
Expand Up @@ -2,7 +2,9 @@
from codecs import encode, decode
from . import shared

def get_whois_raw(domain, server="", previous=[], rfc3490=True, never_cut=False, with_server_list=False, server_list=[]):
def get_whois_raw(domain, server="", previous=None, rfc3490=True, never_cut=False, with_server_list=False, server_list=None):
previous = previous or []
server_list = server_list or []
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

>>> None or []
[]

# Sometimes IANA simply won't give us the right root WHOIS server
exceptions = {
".ac.uk": "whois.ja.net",
Expand All @@ -20,7 +22,6 @@ def get_whois_raw(domain, server="", previous=[], rfc3490=True, never_cut=False,

if len(previous) == 0 and server == "":
# Root query
server_list = [] # Otherwise it retains the list on subsequent queries, for some reason.
is_exception = False
for exception, exc_serv in exceptions.items():
if domain.endswith(exception):
Expand Down
5 changes: 3 additions & 2 deletions pythonwhois/parse.py
Expand Up @@ -426,7 +426,8 @@ def is_string(data):
return isinstance(data, str)


def parse_raw_whois(raw_data, normalized=[], never_query_handles=True, handle_server=""):
def parse_raw_whois(raw_data, normalized=None, never_query_handles=True, handle_server=""):
normalized = normalized or []
data = {}

raw_data = [segment.replace("\r", "") for segment in raw_data] # Carriage returns are the devil
Expand Down Expand Up @@ -995,4 +996,4 @@ def parse_nic_contact(data):
for match in matches:
handle_contacts.append(match.groupdict())

return handle_contacts
return handle_contacts