[issue27805] In Python 3, open('/dev/stdout', 'a') raises OSError with errno=ESPIPE

2016-08-21 Thread Antti Haapala
Antti Haapala added the comment: Yeah, it definitely is a bug in CPython. open(mode='a') should always append to the end of the given file. If you're writing an append-only text log to some file-like object, that's the mode you use, not some version/platform/filesystem specific voodoo to find

[issue27805] In Python 3, open('/dev/stdout', 'a') raises OSError with errno=ESPIPE

2016-08-20 Thread Martin Panter
Martin Panter added the comment: Handling ESPIPE for append mode seems reasonable to me, even as a bug fix for existing versions. But there is a similar problem with "r+" and "w+" modes and unseekable files (unless buffering=0). See Issue 20074. So we can’t say in general that Python 3 faithf

[issue27805] In Python 3, open('/dev/stdout', 'a') raises OSError with errno=ESPIPE

2016-08-20 Thread R. David Murray
Changes by R. David Murray : -- versions: +Python 3.6 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue27805] In Python 3, open('/dev/stdout', 'a') raises OSError with errno=ESPIPE

2016-08-20 Thread R. David Murray
R. David Murray added the comment: And the fact that python deviates from posix in this regard seems like a bug to me, since the posix behavior is, as noted, very useful. Can't we handle ESPIPE like the C library does, instead of forcing users to learn that arcane incantation? -- nos

[issue27805] In Python 3, open('/dev/stdout', 'a') raises OSError with errno=ESPIPE

2016-08-20 Thread Shane Hathaway
Shane Hathaway added the comment: Thanks for the analysis. I have already started a pull request to fix this in Supervisor, but I also thought this change to Python might be gratuitous and accidental. It seems like open('/dev/stdout', 'a') ought to work the same as Python 2. If not, the Python

[issue27805] In Python 3, open('/dev/stdout', 'a') raises OSError with errno=ESPIPE

2016-08-20 Thread STINNER Victor
STINNER Victor added the comment: Antti Haapala added the comment: > Presumably the case was that a *named* log file is opened with 'a' mode, and > one could pass '/dev/stdout' just like any other name of a file, and it did > work, but not in Python 3.5. Oh ok, in this case, you need something

[issue27805] In Python 3, open('/dev/stdout', 'a') raises OSError with errno=ESPIPE

2016-08-20 Thread Antti Haapala
Antti Haapala added the comment: Presumably the case was that a *named* log file is opened with 'a' mode, and one could pass '/dev/stdout' just like any other name of a file, and it did work, but not in Python 3.5. -- nosy: +ztane ___ Python tracker

[issue27805] In Python 3, open('/dev/stdout', 'a') raises OSError with errno=ESPIPE

2016-08-19 Thread STINNER Victor
STINNER Victor added the comment: > Users of Supervisor have been depending on that for a long time. Hum, the workaround is very simple no? Just open /dev/stdout with mode "w", no? -- ___ Python tracker _

[issue27805] In Python 3, open('/dev/stdout', 'a') raises OSError with errno=ESPIPE

2016-08-19 Thread STINNER Victor
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 th

[issue27805] In Python 3, open('/dev/stdout', 'a') raises OSError with errno=ESPIPE

2016-08-19 Thread Martin Panter
Martin Panter added the comment: The origin of this seems to be r68835 and Issue 5008. Victor mentioned imitating the Gnu C library. Maybe there is a better way that also supports non-seekable files better, perhaps handle ESPIPE without failing. This also affects Python 2, if you consider io.o

[issue27805] In Python 3, open('/dev/stdout', 'a') raises OSError with errno=ESPIPE

2016-08-19 Thread Shane Hathaway
New submission from Shane Hathaway: With Python 2, the following call worked: open('/dev/stdout', 'a') Users of Supervisor have been depending on that for a long time. With Python 3.5, this is what happens: >>> open('/dev/stdout', 'a') Traceback (most recent call last): File "", line 1, in