[issue38971] codecs.open leaks file descriptor when invalid encoding is passed

2020-03-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It is too later for 2.7. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: -Python 2.7 ___ Python tracker

[issue38971] codecs.open leaks file descriptor when invalid encoding is passed

2020-03-02 Thread miss-islington
miss-islington added the comment: New changeset f28b0c74e54a133cb0287b4297af67d0d7c14d6e by Miss Islington (bot) in branch '3.8': bpo-38971: Open file in codecs.open() closes if exception raised. (GH-17666) https://github.com/python/cpython/commit/f28b0c74e54a133cb0287b4297af67d0d7c14d6e --

[issue38971] codecs.open leaks file descriptor when invalid encoding is passed

2020-03-02 Thread miss-islington
miss-islington added the comment: New changeset f4d709f4a3c69bd940bd6968a70241277132bed7 by Miss Islington (bot) in branch '3.7': bpo-38971: Open file in codecs.open() closes if exception raised. (GH-17666) https://github.com/python/cpython/commit/f4d709f4a3c69bd940bd6968a70241277132bed7 --

[issue38971] codecs.open leaks file descriptor when invalid encoding is passed

2020-03-01 Thread miss-islington
Change by miss-islington : -- pull_requests: +18091 pull_request: https://github.com/python/cpython/pull/18734 ___ Python tracker ___ __

[issue38971] codecs.open leaks file descriptor when invalid encoding is passed

2020-03-01 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 5.0 -> 6.0 pull_requests: +18090 pull_request: https://github.com/python/cpython/pull/18733 ___ Python tracker _

[issue38971] codecs.open leaks file descriptor when invalid encoding is passed

2020-03-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 2565edec2c974b2acca03b4cc5025e83f903ddd7 by Chris A in branch 'master': bpo-38971: Open file in codecs.open() closes if exception raised. (GH-17666) https://github.com/python/cpython/commit/2565edec2c974b2acca03b4cc5025e83f903ddd7 --

[issue38971] codecs.open leaks file descriptor when invalid encoding is passed

2020-01-26 Thread Chris Aporta
Chris Aporta added the comment: Just quickly pinging the thread as a friendly reminder that PR 17666 is open and potentially close to mergeable, as it's been through two review cycles already (thanks Serhiy). If someone has the bandwidth to take another look, it would be greatly appreciated.

[issue38971] codecs.open leaks file descriptor when invalid encoding is passed

2019-12-19 Thread Roundup Robot
Change by Roundup Robot : -- keywords: +patch pull_requests: +17132 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/17666 ___ Python tracker ___

[issue38971] codecs.open leaks file descriptor when invalid encoding is passed

2019-12-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Many reasons. 1. It is simpler. 2. We will need a try/except in any case to prevent a leak if an exception be raised by other code following open(). 3. It matches the behavior of io.open(). -- ___ Python tracker

[issue38971] codecs.open leaks file descriptor when invalid encoding is passed

2019-12-04 Thread Josh Rosenberg
Josh Rosenberg added the comment: Any reason not to just defer opening the file until after the codec has been validated, so the resource acquisition comes last? -- nosy: +josh.r ___ Python tracker

[issue38971] codecs.open leaks file descriptor when invalid encoding is passed

2019-12-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Add try: ... except: file.close() raise -- components: +IO, Library (Lib) keywords: +easy stage: -> needs patch type: -> resource usage versions: +Python 2.7, Python 3.7, Python 3.8, Python 3.9

[issue38971] codecs.open leaks file descriptor when invalid encoding is passed

2019-12-04 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Ah okay, thanks for the detail. Forgot there should be an open file handle to be returned by codecs.open -- ___ Python tracker ___

[issue38971] codecs.open leaks file descriptor when invalid encoding is passed

2019-12-04 Thread Brock Mendel
Brock Mendel added the comment: > Does using with block similar to https://bugs.python.org/issue22831 solve > this problem? The motivating use case uses `with codecs.open(buf, "w", encoding=encoding) as f:` https://github.com/pandas-dev/pandas/blob/master/pandas/io/formats/format.py#L498 -

[issue38971] codecs.open leaks file descriptor when invalid encoding is passed

2019-12-04 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Does using with block similar to https://bugs.python.org/issue22831 solve this problem? -- nosy: +serhiy.storchaka ___ Python tracker

[issue38971] codecs.open leaks file descriptor when invalid encoding is passed

2019-12-04 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue38971] codecs.open leaks file descriptor when invalid encoding is passed

2019-12-04 Thread Brock Mendel
New submission from Brock Mendel : xref https://github.com/pandas-dev/pandas/pull/30034 codecs.open does `file = open(...)` before validating the encoding kwarg, leaving the open file behind if that validation raises. -- messages: 357811 nosy: Brock Mendel priority: normal severity: n