浏览代码

ctypes: fix Callable for Python 3.10 (#1672)

Callable is now part of collections.abc: replacing `collections.Callable` with `collections.abc.Callable`

Co-authored-by: @petrasovaa
Markus Neteler 3 年之前
父节点
当前提交
33b5fc7818
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      python/grass/ctypes/ctypesgencore/parser/lex.py

+ 2 - 2
python/grass/ctypes/ctypesgencore/parser/lex.py

@@ -348,7 +348,7 @@ class Lexer:
                     break
 
                 # if func not callable, it means it's an ignored token
-                if not isinstance(func, collections.Callable):
+                if not isinstance(func, collections.abc.Callable):
                     break
 
                 # If token is processed by a function, call it
@@ -720,7 +720,7 @@ def lex(module=None, object=None, debug=0, optimize=0,
         states, tokname = _statetoken(f, stateinfo)
         toknames[f] = tokname
 
-        if isinstance(t, collections.Callable):
+        if isinstance(t, collections.abc.Callable):
             for s in states:
                 funcsym[s].append((f, t))
         elif (isinstance(t, bytes) or isinstance(t, str)):