Xqt created this task. Xqt added a project: Pywikibot. Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.
TASK DESCRIPTION Family.__new__() constructor has Python 2 code which should removed after that version has been dropped def __new__(cls): """Allocator.""" # any Family class defined in this file are abstract if cls in globals().values(): raise TypeError( 'Abstract Family class {0} cannot be instantiated; ' 'subclass it instead'.format(cls.__name__)) # Override classproperty cls.instance = super().__new__(cls) # staticmethod is because python 2.7 binds the lambda to the class cls.__new__ = staticmethod(lambda cls: cls.instance) # shortcut # don't use hasattr() here. consider only the class itself if '__init__' in cls.__dict__: # Initializer deprecated. Families should be immutable and any # instance / class modification should go to allocator (__new__). # The function is read from __dict__ because deprecated expect a # function and python 2.7 binds the method to the class. cls.__init__ = deprecated(cls.__dict__['__init__']) # Invoke initializer immediately and make initializer no-op. # This is to avoid repeated initializer invocation on repeated # invocations of the metaclass's __call__. cls.instance.__init__() cls.__init__ = lambda self: None # no-op return cls.instance TASK DETAIL https://phabricator.wikimedia.org/T265817 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: Xqt Cc: Aklapper, zhuyifei1999, Xqt, pywikibot-bugs-list, JohnsonLee01, SHEKH, Dijkstra, Khutuck, Zkhalido, Viztor, Wenyi, Tbscho, MayS, Mdupont, JJMC89, Dvorapa, Altostratus, Avicennasis, mys_721tx, jayvdb, Masti, Alchimista, Rxy
_______________________________________________ pywikibot-bugs mailing list pywikibot-bugs@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs