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

Nick Coghlan ncoghlan at gmail.com
Thu Jul 16 23:29:58 CEST 2009


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)

Cheers,
Nick.

P.S. Just noticed that David Goodger made the same comment on the
tracker issue.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------


More information about the Python-checkins mailing list