mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Closes #13258: Use callable() built-in in the standard library.
This commit is contained in:
parent
f99e4b5dbe
commit
5d1155c08e
25 changed files with 48 additions and 51 deletions
|
@ -134,7 +134,7 @@ def all_methods(obj):
|
|||
temp = []
|
||||
for name in dir(obj):
|
||||
func = getattr(obj, name)
|
||||
if hasattr(func, '__call__'):
|
||||
if callable(func):
|
||||
temp.append(name)
|
||||
return temp
|
||||
|
||||
|
@ -510,7 +510,7 @@ class BaseManager(object):
|
|||
'''
|
||||
assert self._state.value == State.INITIAL
|
||||
|
||||
if initializer is not None and not hasattr(initializer, '__call__'):
|
||||
if initializer is not None and not callable(initializer):
|
||||
raise TypeError('initializer must be a callable')
|
||||
|
||||
# pipe over which we will retrieve address of server
|
||||
|
|
|
@ -151,7 +151,7 @@ class Pool(object):
|
|||
if processes < 1:
|
||||
raise ValueError("Number of processes must be at least 1")
|
||||
|
||||
if initializer is not None and not hasattr(initializer, '__call__'):
|
||||
if initializer is not None and not callable(initializer):
|
||||
raise TypeError('initializer must be a callable')
|
||||
|
||||
self._processes = processes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue