mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +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
|
@ -225,10 +225,11 @@ class FileInput:
|
|||
raise ValueError("FileInput opening mode must be one of "
|
||||
"'r', 'rU', 'U' and 'rb'")
|
||||
self._mode = mode
|
||||
if inplace and openhook:
|
||||
raise ValueError("FileInput cannot use an opening hook in inplace mode")
|
||||
elif openhook and not hasattr(openhook, '__call__'):
|
||||
raise ValueError("FileInput openhook must be callable")
|
||||
if openhook:
|
||||
if inplace:
|
||||
raise ValueError("FileInput cannot use an opening hook in inplace mode")
|
||||
if not callable(openhook):
|
||||
raise ValueError("FileInput openhook must be callable")
|
||||
self._openhook = openhook
|
||||
|
||||
def __del__(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue