STINNER Victor added the comment: Syscalls made by open("/dev/stdout", "a") in Python 2:
open("/dev/stdout", O_WRONLY|O_CREAT|O_APPEND, 0666) = 3 lseek(3, 0, SEEK_END) = -1 ESPIPE (Illegal seek) fstat(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 I used this comand: $ strace -o trace python2 -c 'import os; os.uname();os.uname();os.uname(); f=open("/dev/stdout", "a"); os.uname(); f.close()' It looks like the C library simply ignores ESPIPE on lseek(fd, 0, SEEK_END) when opening a file in append mode: https://sourceware.org/git/?p=glibc.git;a=blob;f=libio/fileops.c;h=13157354272ff9ab1832d4a619a81f05898fcd69;hb=HEAD#l242 if ((read_write & _IO_IS_APPENDING) && (read_write & _IO_NO_READS)) if (_IO_SEEKOFF (fp, (_IO_off64_t)0, _IO_seek_end, _IOS_INPUT|_IOS_OUTPUT) == _IO_pos_BAD && errno != ESPIPE) { close_not_cancel (fdesc); return NULL; } from _IO_file_open() file operation. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27805> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com