X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/mLib-python/blobdiff_plain/5b1830f325c55c70d65fd020f08dd958493e528d..c316167fdcbce41e8cc731e8c19cb00f53c1b9cd:/utils.pyx diff --git a/utils.pyx b/utils.pyx index a8a4406..8d4ffad 100644 --- a/utils.pyx +++ b/utils.pyx @@ -40,9 +40,11 @@ cdef object _tobool(int i): cdef int _getfd(object fdobj): try: - return fdobj + fd = int(fdobj) except TypeError: - return fdobj.fileno() + PyErr_Clear() + fd = fdobj.fileno() + return fd cdef object _checkcallable(f, what): if f is not None and not callable(f):