Merlijn van Deen has uploaded a new change for review.
https://gerrit.wikimedia.org/r/79813
Change subject: Start with a fresh list in html2unicode every time
......................................................................
Start with a fresh list in html2unicode every time
def x(..., something=[]):
something.extend([1,2,3])
means something becomes [1,2,3] on the first call, but
[1,2,3,1,2,3] on the *second* call. This meant html2unicode
got a longer list of replacements every time it is called.
This commit changes it to the standard
def x(..., something=None):
if something is None:
something = []
which means it's always an empty list, instead of what's left from
the last call.
Change-Id: Ifb5221135498633e6e38967fcf4b5a02b14fb4d5
Compat-Change-Id: Ie490b575a8a0cc4b5d45bbb97c0606e0fd64d4f9
---
M pywikibot/page.py
1 file changed, 3 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core
refs/changes/13/79813/1
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 81daf92..db22a9a 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -3265,8 +3265,10 @@
# Utility functions for parsing page titles
-def html2unicode(text, ignore = []):
+def html2unicode(text, ignore = None):
"""Return text, replacing HTML entities by equivalent unicode
characters."""
+ if ignore is None:
+ ignore = []
# This regular expression will match any decimal and hexadecimal entity and
# also entities that might be named entities.
entityR = re.compile(
--
To view, visit https://gerrit.wikimedia.org/r/79813
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifb5221135498633e6e38967fcf4b5a02b14fb4d5
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Merlijn van Deen <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits