Ticket #4928: 4928-stop-using-allyourbase-1.patch

File 4928-stop-using-allyourbase-1.patch, 1.7 KB (added by binjured, 3 years ago)

Proper use of getmro()

  • twisted/python/failure.py

     
    1717import inspect 
    1818import opcode 
    1919from cStringIO import StringIO 
     20from inspect import getmro 
    2021 
    2122from twisted.python import reflect 
    2223 
     
    280281                ]) 
    281282            tb = tb.tb_next 
    282283        if inspect.isclass(self.type) and issubclass(self.type, Exception): 
    283             parentCs = reflect.allYourBase(self.type) 
     284            parentCs = getmro(self.type) 
    284285            self.parents = map(reflect.qual, parentCs) 
    285286            self.parents.append(reflect.qual(self.type)) 
    286287        else: 
  • twisted/trial/test/test_reporter.py

     
    99 
    1010 
    1111import errno, sys, os, re, StringIO 
     12from inspect import getmro 
    1213 
    1314from twisted.internet.utils import suppressWarnings 
    1415from twisted.python import log 
    1516from twisted.python.failure import Failure 
    16 from twisted.python.reflect import allYourBase 
    1717from twisted.trial import itrial, unittest, runner, reporter, util 
    1818from twisted.trial.reporter import UncleanWarningsReporterWrapper 
    1919from twisted.trial.test import erroneous 
     
    12191219        method = getattr(klass, methodName, None) 
    12201220        if method is None: 
    12211221            return 
    1222         for base in [klass] + allYourBase(klass): 
     1222        for base in getmro(klass): 
    12231223            try: 
    12241224                delattr(base, methodName) 
    12251225            except (AttributeError, TypeError):