[Python-checkins] r74028 - python/trunk/Lib/subprocess.py

Georg Brandl g.brandl at gmx.net
Thu Jul 16 23:49:27 CEST 2009


Nick Coghlan schrieb:
> georg.brandl wrote:
>> Log:
>> #6482: simplify "except: raise" to "finally:".
>> 
>> Modified:
>>    python/trunk/Lib/subprocess.py
>> 
>> Modified: python/trunk/Lib/subprocess.py
>> ==============================================================================
>> --- python/trunk/Lib/subprocess.py	(original)
>> +++ python/trunk/Lib/subprocess.py	Thu Jul 16 21:24:48 2009
>> @@ -1066,10 +1066,10 @@
>>                      gc.disable()
>>                      try:
>>                          self.pid = os.fork()
>> -                    except:
>> +                    finally:
>>                          if gc_was_enabled:
>>                              gc.enable()
>> -                        raise
>> +
>>                      self._child_created = True
>>                      if self.pid == 0:
>>                          # Child
> 
> Are you sure about that? This changes the semantics so that gc is
> re-enabled immediately even in the non-exceptional case.
> 
> (I haven't checked whether that actually matters here, just commenting
> on the fact that there is a semantic difference between except/raise and
> a finally clause)

Thanks, I reverted it. Proves that I shouldn't do "easy" tracker items to
relax from studying.

Georg



More information about the Python-checkins mailing list