I bumped into a (C)Python behaviour at work that I found quite surprising. Spent too much time debugging it until I learnt it was not a bug (some people I have spoken to have other opinions, here), but a CPython implementation detail and the way UNIX works cause this :) If you want to try to guess / debug before reading: I was doing this, to pass it to some API, similar to subprocess’ so it would write a binary’s stdout to this file. fd leak aside, this should work but did not, with no error whatsoever: stdout_fd = open("/tmp/output.txt").fileno()
More like this (1)
Things You Need to Know about Garbage Collection in Python Understanding how GC works can help...Things You Need to Know about Garbage Collection in Python Understanding how GC works can help us write better Python programs.