jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/533015 )

Change subject: Deprecate sysopnames
......................................................................

Deprecate sysopnames

A future patch will removed all of its use cases.

Sandbox variables are deep copied instead of shallow copied because
for some reason family registration prefill 'sysopnames' with empty
dicts for each family, breaking recursize dict comparison, since the
objects inside and outside of the sandbox refer to the same object.

Bug: T71283
Change-Id: I90277e21aba7923b16316c869ae3815308fd205e
---
M pywikibot/config2.py
1 file changed, 5 insertions(+), 15 deletions(-)

Approvals:
  Huji: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index 8ef04fc..d3fa7ef 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -40,6 +40,7 @@
 from __future__ import absolute_import, division, unicode_literals

 import collections
+import copy
 import os
 import platform
 import re
@@ -111,7 +112,7 @@
 _private_values = {'authenticate', 'db_password'}
 _deprecated_variables = {'use_SSL_onlogin', 'use_SSL_always',
                          'available_ssl_project', 'fake_user_agent',
-                         'special_page_limit'}
+                         'special_page_limit', 'sysopnames'}

 # ############# ACCOUNT SETTINGS ##############

@@ -1033,19 +1034,9 @@
     if _key[0] != '_' and _key not in _imports}

 # Create an environment for user-config.py which is
-# a shallow copy of the core config settings, so that
+# a deep copy of the core config settings, so that
 # we can detect modified config items easily.
-_exec_globals = {}
-for _key, _val in _public_globals.items():
-    if isinstance(_val, dict):
-        if isinstance(_val, collections.defaultdict):
-            _exec_globals[_key] = collections.defaultdict(dict)
-        else:
-            _exec_globals[_key] = {}
-        if len(_val) > 0:
-            _exec_globals[_key].update(_val)
-    else:
-        _exec_globals[_key] = _val
+_exec_globals = copy.deepcopy(_public_globals)

 # Get the user files
 if __no_user_config:
@@ -1126,8 +1117,7 @@

 # Copy the user config settings into globals
 _modified = {_key for _key in _public_globals.keys()
-             if _exec_globals[_key] != globals()[_key]
-             or _key in {'usernames', 'sysopnames', 'disambiguation_comment'}}
+             if _exec_globals[_key] != globals()[_key]}

 if 'user_agent_format' in _modified:
     _right_user_agent_format = re.sub(r'{httplib2(:|})', r'{http_backend\1',

--
To view, visit https://gerrit.wikimedia.org/r/533015
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I90277e21aba7923b16316c869ae3815308fd205e
Gerrit-Change-Number: 533015
Gerrit-PatchSet: 7
Gerrit-Owner: Huji <[email protected]>
Gerrit-Reviewer: Huji <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: Zhuyifei1999 <[email protected]>
Gerrit-Reviewer: jenkins-bot (75)
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to