(obj)
| 621 | |
| 622 | |
| 623 | def has_fileno(obj): |
| 624 | if not hasattr(obj, "fileno"): |
| 625 | return False |
| 626 | |
| 627 | # check BytesIO case and maybe others |
| 628 | try: |
| 629 | obj.fileno() |
| 630 | except (AttributeError, OSError, io.UnsupportedOperation): |
| 631 | return False |
| 632 | |
| 633 | return True |
| 634 | |
| 635 | |
| 636 | def warn(msg): |