"Fred L. Drake" <fdrake@users.sourceforge.net> writes: > ! fd = PyObject_AsFileDescriptor(obj); > ! if (fd == -1) { > ! if (PyInt_Check(obj)) { ^^^^^^^^^^^^^^^^ this is a bit pointless. I admit ->> termios.tcgetattr(-2) Traceback (most recent call last): File "<input>", line 1, in ? TypeError: tcgetattr, arg 1: can't extract file descriptor from "int" is a bit confusing, but I'm not sure ->> termios.tcgetattr(-2) Traceback (most recent call last): File "<input>", line 1, in ? error: (9, 'Bad file descriptor') is any better than: ->> termios.tcgetattr(-2) Traceback (most recent call last): File "<input>", line 1, in ? ValueError: file descriptor cannot be a negative integer (-2) which is what you get after applying this patch: Index: Modules/termios.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/termios.c,v retrieving revision 2.26 diff -c -r2.26 termios.c *** Modules/termios.c 2001/05/09 17:53:06 2.26 --- Modules/termios.c 2001/05/09 19:49:52 *************** *** 37,43 **** fd = PyObject_AsFileDescriptor(obj); if (fd == -1) { if (PyInt_Check(obj)) { ! fd = PyInt_AS_LONG(obj); } else { char* tname; --- 37,43 ---- fd = PyObject_AsFileDescriptor(obj); if (fd == -1) { if (PyInt_Check(obj)) { ! return 0; } else { char* tname; Cheers, M.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4