Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!bcyclone03.am1.xlned.com!bcyclone03.am1.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.039 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'subject:file': 0.07; 'descriptor': 0.09; 'underlying': 0.09; 'python': 0.11; 'descriptors': 0.16; 'folks,': 0.16; 'skip': 0.18; 'are.': 0.22; 'libraries': 0.22; 'header:In-Reply-To:1': 0.24; 'idea': 0.26; 'message-id:@mail.gmail.com': 0.28; 'this.': 0.28; 'subject:/': 0.29; "i'm": 0.29; 'sense': 0.29; 'code': 0.31; 'surprised': 0.33; 'open': 0.33; 'file': 0.34; 'received:google.com': 0.34; 'that,': 0.34; 'to:addr:python-list': 0.35; 'attempt': 0.35; 'c++': 0.35; 'level.': 0.36; "didn't": 0.37; 'turn': 0.37; 'subject:: ': 0.37; 'beyond': 0.37; 'done.': 0.37; 'to:addr:python.org': 0.39; 'sure': 0.40; 'why': 0.40; 'some': 0.40; 'addition': 0.60; 'more': 0.62; 'subject: & ': 0.73; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=LfOcFF/ORb4nk1a8hg1xAz7DKvkeJJdphD4RB1N4/7w=; b=0XUZCW9d06pJhv76ir7srPhSb2Uzv1sfznQnut4nIly9JA0C3GeTTlL6nE4OoLTF4p qPe/ZEw9VvW5ie2PR/0KwfEGmcIxQl0MLn2XEkDjDZWdzcj6e53yD278bugDnYiEoJFQ c9RjAaVDR2zcLKHsLszTDwrJnFAbUbBUII2hYawpaW8lgJBPHDYZlRSlI37kZlYAkPa7 sREsDb+Pogj7nfvSIntSgArZHCQ3Kjgw6vbdsy63iwsk0gInNkYE2O5dkhWxLghrutl3 oYJnFPjS6KhObi7kZnuUCHz/7K/qDTzxaHWPKgrUwN4pjL4u2wqOKYbO9glW/KI9dvd8 flPQ== MIME-Version: 1.0 X-Received: by 10.202.137.78 with SMTP id l75mr5246956oid.110.1433294466755; Tue, 02 Jun 2015 18:21:06 -0700 (PDT) In-Reply-To: References: <87pp5eksnc.fsf@universite-de-strasbourg.fr.invalid> <87eglt7u5i.fsf@elektro.pacujo.net> <87lhg1lt00.fsf@universite-de-strasbourg.fr.invalid> Date: Tue, 2 Jun 2015 20:21:06 -0500 Subject: Re: fork/exec & close file descriptors From: Skip Montanaro To: Python Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 12 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1433294470 news.xs4all.nl 2848 [2001:888:2000:d::a6]:52574 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 3882 X-Received-Body-CRC: 1561075940 Xref: csiph.com comp.lang.python:91916 Folks, I'm not interested in rehashing this. I don't know what all the open file descriptors are. Some/many/most will have been opened by underlying C++ libraries and will not have been opened by code at the Python level. I do think the addition of an os.fsync() attempt on each file descriptor before calling os.close() makes some sense to me. Beyond that, I'm not sure there's more that can be done. I sent my last message simply because I was surprised os.closerange() existed. I have no idea why it didn't turn up in my original searching. Skip