cfbolz changed the topic of #pypy to: PyPy, the flexible snake (IRC logs: https://quodlibet.duckdns.org/irc/pypy/latest.log.html#irc-end ) | use cffi for calling C | if a pep adds a mere 25-30 [C-API] functions or so, it's a drop in the ocean (cough) - Armin
jcea has joined #pypy
wleslie has joined #pypy
jcea has quit [Ping timeout: 268 seconds]
glyph has quit [Quit: End of line.]
glyph has joined #pypy
lritter has joined #pypy
lritter has quit [Client Quit]
DRMacIver has joined #pypy
cfbolz has joined #pypy
EWDurbin has joined #pypy
michelp has joined #pypy
graingert has joined #pypy
kristjansson has joined #pypy
jaraco has joined #pypy
<arigato> OK, help?
<arigato> in cpython3.7:
<arigato> >>> f = os.fdopen(2, 'w', 0)
<arigato> >>> 5+6
<arigato> 11
<arigato> >>> id(f)
<arigato> >>> id(id)
<arigato> 140634262135024
<arigato> >>> id(f)
<arigato> >>>
<arigato> why is the output missing whenever I try to use `f` in an expression?
<antocuni> interesting
* antocuni tries
<arigato> (I'm starting to have a clue just now)
<arigato> (took a while)
<antocuni> fwiw, 3.8 behaves the same
<antocuni> it's even more obscure than that
<antocuni> >>> x = repr(f)
<antocuni> >>> 42
<antocuni> 42
<antocuni> >>> x
<antocuni> and type(x) is silent as well
<arigato> I know why, but I'm letting you be confused for a moment :-)
<antocuni> I give up :)
<arigato> try x = 5; x = repr(f); x
<antocuni> uhm...
<antocuni> so, any expression involving "f" is aborted and silently ignored?
<arigato> then try 'f' in globals()...
<arigato> there is no variable 'f'
<fijal> it probably goes to recursion somehow?
<arigato> no, os.fdopen(2) destroys somehow the stderr file descriptor, and *then* it raises an exception
<antocuni> ah
<antocuni> indeed
<fijal> works on 3.7 too
<arigato> so there is no 'f', and id(f) gives a NameError
<antocuni> 0/0 is also silent
<antocuni> "funny"
<fijal> >>> f = os.fdopen(2, 'wb', 0)
<fijal> <_io.FileIO name=2 mode='wb' closefd=True>
<fijal> >>> f
<fijal> >>>
<fijal> hint
<arigato> ah, binary-versus-unicode fun
<antocuni> it's worth reporting a bug which will generate an endless discussion and will be ultimately ignored
<arigato> how do I open a file connected to fd 2 with a method write() accepting strings?
<antocuni> you open an fd accepting bytes and wrap it using some io.* nonsense?
<fijal> may I complain python has departed from "simple language" far away?
<arigato> f = os.fdopen(2, 'w', 0, encoding="latin1")
<antocuni> which I think it's what happens under the hood anyway when you open a file using 'w'
<arigato> ...fails in the same way as the original strangeness
<arigato> ah, so it looks like something is crashing when doing the wrapping, or something
<arigato> OK
<arigato> if I try with fd=1 instead of 2, my fd 2 remains valid and I see the error
<arigato> ValueError: can't have unbuffered text I/O
<fijal> lol that's a bad error
<fijal> but also why not?
<antocuni> yes I can imagine why you can't have unbuffered text input, but I can't understand why you can't have unbuffered output
* antocuni --> lunch
<bbot2> Started: http://buildbot.pypy.org/builders/pypy-c-jit-linux-x86-64/builds/7400 [arigo: set_wakeup_fd(warn_on_full_buffer), py3.7]
otisolsen70 has joined #pypy
swills has quit [Quit: swills]
<bbot2> Failure: http://buildbot.pypy.org/builders/pypy-c-jit-linux-x86-64/builds/7400 [arigo: set_wakeup_fd(warn_on_full_buffer), py3.7]
otisolsen70 has quit [Quit: Leaving]
otisolsen70 has joined #pypy
jcea has joined #pypy
ronan has joined #pypy
ronan has quit [Ping timeout: 272 seconds]
ronan has joined #pypy
ronan has quit [Ping timeout: 272 seconds]
ronan has joined #pypy
ronan has quit [Ping timeout: 268 seconds]
commandoline has quit [Ping timeout: 265 seconds]
commandoline has joined #pypy
jacob22_ has quit [Read error: Connection reset by peer]
jacob22_ has joined #pypy
otisolsen70 has quit [Quit: Leaving]
ronan has joined #pypy