chiark
/
gitweb
/
~mdw
/
mLib-python
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
utils.pyx (_getfd): Hack around Pyrex exception-handling bugs.
[mLib-python]
/
utils.pyx
diff --git
a/utils.pyx
b/utils.pyx
index a8a440667cee471823b682cc86fa6c8912c3d568..8d4ffad73268a376eaca2fa3835ac8367e29d942 100644
(file)
--- a/
utils.pyx
+++ b/
utils.pyx
@@
-40,9
+40,11
@@
cdef object _tobool(int i):
cdef int _getfd(object fdobj):
try:
cdef int _getfd(object fdobj):
try:
- return fdobj
+ fd = int(fdobj)
except TypeError:
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):
cdef object _checkcallable(f, what):
if f is not None and not callable(f):