/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos

  • Committer: Teddy Hogeborn
  • Date: 2020-02-06 15:56:51 UTC
  • Revision ID: teddy@recompile.se-20200206155651-kx7r39zj8hpv8udl
Use collections.abc.Callable instead of collections.Callable

In Python 3.7, collections.Callable (among others) was moved to
collections.abc.Callable, and its old location deprecated.

* mandos: Create "collections.abc.Callable" if it does not exist, and
  only use the new name.

Show diffs side-by-side

added added

removed removed

Lines of Context:
94
94
    __metaclass__ = type
95
95
    str = unicode
96
96
 
 
97
# Add collections.abc.Callable if it does not exist
 
98
try:
 
99
    collections.abc.Callable
 
100
except AttributeError:
 
101
    class abc:
 
102
        Callable = collections.Callable
 
103
    collections.abc = abc
 
104
    del abc
 
105
 
97
106
# Show warnings by default
98
107
if not sys.warnoptions:
99
108
    import warnings
2748
2757
        if command == 'getattr':
2749
2758
            attrname = request[1]
2750
2759
            if isinstance(client_object.__getattribute__(attrname),
2751
 
                          collections.Callable):
 
2760
                          collections.abc.Callable):
2752
2761
                parent_pipe.send(('function', ))
2753
2762
            else:
2754
2763
                parent_pipe.send((