Re: Unaccent extension python script Issue in Windows

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Hugh Ranalli <hugh(at)whtc(dot)ca>
Cc: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, raam narayana <raam(dot)soft(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
Subject: Re: Unaccent extension python script Issue in Windows
Date: 2019-03-19 06:25:17
Message-ID: 20190319062517.GC2899@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2019-03-19 06:27:56 Re: Problem with default partition pruning
Previous Message Michael Paquier 2019-03-19 06:18:51 Re: Two pg_rewind patches (auto generate recovery conf and ensure clean shutdown)