Message 150462 - Python tracker (original) (raw)

Nice patch :-)

I think the two function approach works well.

Since you have already checked that termsize is not NULL, Py_DECREF can be used instead of Py_CLEAR.

Would it not be better to use sys.stdout instead of 1 in the documentation and to use STDOUT_FILENO instead of 1 in the code?

A brief google suggested that Solaris requires sys/termios.h for TIOCGWINSZ. Perhaps also only define TERMSIZE_USE_IOCTL if TIOCGWINSZ is defined. Like so: #if defined(HAVE_SYS_IOCTL_H) #include <sys/ioctl.h> #if defined(TIOCGWINSZ) #define TERMSIZE_USE_IOCTL #else #define TERMSIZE_USE_NOTIMPLEMENTED #endif #elif defined(HAVE_CONIO_H) #include <windows.h> #include <conio.h> #define TERMSIZE_USE_CONIO #else #define TERMSIZE_USE_NOTIMPLEMENTED #endif

(didn't check the windows parts)