This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author MartinHusemann
Recipients MartinHusemann
Date 2018-04-29.10:16:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
When building python extensions in the background w/o stdin (and stderr and stdout redirected to a log file), the invocation of fails.

Normal build in a shell:

Example from pyexpat:
> /usr/pkg/bin/python3.6  build
running build
running build_ext
building 'pyexpat' extension
creating build
creating build/temp.netbsd-8.99.14-amd64-3.6
creating build/temp.netbsd-8.99.14-amd64-3.6/Modules
gcc -DNDEBUG -O2 -pipe -D_FORTIFY_SOURCE=2 -I/usr/include -I/usr/pkg/include -O2 -pipe -D_FORTIFY_SOURCE=2 -I/usr/include -I/usr/pkg/include/python3.6 -I/usr/include -I/usr/pkg/include/python3.6 -fPIC -DHAVE_EXPAT_H -I/work/pkgobj/textproc/py-expat/work/.buildlink/include -I/usr/pkg/include/python3.6 -c Modules/pyexpat.c -o build/temp.netbsd-8.99.14-amd64-3.6/Modules/pyexpat.o
creating build/lib.netbsd-8.99.14-amd64-3.6
gcc -pthread -shared -L. -L/usr/lib -Wl,-R/usr/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/X11R7/lib -Wl,-R/usr/X11R7/lib -L/usr/lib -Wl,-R/usr/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/X11R7/lib -Wl,-R/usr/X11R7/lib -L/usr/lib -Wl,-R/usr/lib -Wl,-R/usr/pkg/lib -O2 -pipe -D_FORTIFY_SOURCE=2 -I/usr/include -I/usr/pkg/include/python3.6 -I/usr/include -I/usr/pkg/include/python3.6 build/temp.netbsd-8.99.14-amd64-3.6/Modules/pyexpat.o -L/work/pkgobj/textproc/py-expat/work/.buildlink/lib -L/usr/pkg/lib -Wl,-R/work/pkgobj/textproc/py-expat/work/.buildlink/lib -lexpat -lpython3.6 -o build/lib.netbsd-8.99.14-amd64-3.6/

But if invoked as 

> ( sleep 15; /usr/pkg/bin/python3.6  build ) >/tmp/log 2>&1 &
> ^D

and then watching /tmp/log from another session:

Fatal Python error: Py_Initialize: can't initialize sys standard streams
OSError: [Errno 9] Bad file descriptor

Current thread 0x000075b4e4cee800 (most recent call first):
[1]   Abort trap (core dumped) /usr/pkg/bin/pyt...
Date User Action Args
2018-04-29 10:16:35MartinHusemannsetrecipients: + MartinHusemann
2018-04-29 10:16:35MartinHusemannsetmessageid: <>
2018-04-29 10:16:35MartinHusemannlinkissue33384 messages
2018-04-29 10:16:35MartinHusemanncreate