Re: Unaccent extension python script Issue in Windows - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Unaccent extension python script Issue in Windows
Date
Msg-id 20190319062517.GC2899@paquier.xyz
Whole thread Raw
In response to Re: Unaccent extension python script Issue in Windows  (Hugh Ranalli <hugh@whtc.ca>)
Responses Re: Unaccent extension python script Issue in Windows
List pgsql-hackers
On Mon, Mar 18, 2019 at 09:06:09AM -0400, Hugh Ranalli wrote:
> I'm not sure I'd classify the second change as "irrelevant." Using "with"
> is the standard and recommended practice for working with files in Python.

I honestly don't know about any standard way to do anythings in
Python, but it is true that using "with" saves from a forgotten
close() call.

> At the moment the script does nothing to close the open data file, whether
> through regular processing or in the case of an exception. I would argue
> that's a bug and should be fixed. Creating a separate patch for that seems
> to be adding work for no reason.

This script runs in a short-lived context, so it is really not a big
deal to not close the opened UnicodeData.txt.  I agree that it is bad
practice though, so I think it's fine to fix the problem if there is
another patch touching the same area of the code while on it.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Two pg_rewind patches (auto generate recovery conf and ensureclean shutdown)
Next
From: Kyotaro HORIGUCHI
Date:
Subject: Re: Problem with default partition pruning