[tor-commits] [bridgedb/master] Replace func_doc with __doc__

phw at torproject.org phw at torproject.org
Wed Feb 19 18:26:37 UTC 2020


commit dfb152f6bac4bca465f309b6d9089f013fc456cc
Author: Damian Johnson <atagar at torproject.org>
Date:   Fri Jan 10 14:48:52 2020 -0800

    Replace func_doc with __doc__
    
    Python 3.x renamed func_x functions to __x__...
    
      https://docs.python.org/3.0/whatsnew/3.0.html#operators-and-special-methods
    
    This fixes...
    
      Traceback (most recent call last):
        File "/usr/local/lib/python3.5/dist-packages/twisted/trial/runner.py", line 823, in loadByName
          return self.suiteFactory([self.findByName(name, recurse=recurse)])
        ...
        File "/home/atagar/Desktop/tor/bridgedb/bridgedb/filters.py", line 127, in <module>
          byIPv4 = byIPv(4)
        File "/home/atagar/Desktop/tor/bridgedb/bridgedb/filters.py", line 122, in byIPv
          _byIPv.func_doc = _byIPv.func_doc.format(ipVersion)
      builtins.AttributeError: 'function' object has no attribute 'func_doc'
    
    This finally progresses our test outcome quite a bit...
    
      before: FAILED (skips=1, failures=7, errors=48, successes=256)
      after:  FAILED (skips=2, failures=7, errors=144, successes=321)
---
 bridgedb/filters.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bridgedb/filters.py b/bridgedb/filters.py
index a02661e..78cb73e 100644
--- a/bridgedb/filters.py
+++ b/bridgedb/filters.py
@@ -119,7 +119,7 @@ def byIPv(ipVersion=None):
             return False
         setattr(_byIPv, "description", "ip=%d" % ipVersion)
         _byIPv.__name__ = "byIPv%d()" % ipVersion
-        _byIPv.func_doc = _byIPv.func_doc.format(ipVersion)
+        _byIPv.__doc__ = _byIPv.__doc__.format(ipVersion)
         _byIPv.name = name
         _cache[name] = _byIPv
         return _byIPv





More information about the tor-commits mailing list