[New-bugs-announce] [issue18853] Got ResourceWarning unclosed file when running Lib/shlex.py demo

Vajrasky Kok report at bugs.python.org
Tue Aug 27 16:04:27 CEST 2013


New submission from Vajrasky Kok:

The python is compiled with --with-pydebug flag.

[sky at localhost cpython]$ cat /tmp/quote.txt 
manly "man" likes 'cute "cat"'
[sky at localhost cpython]$ ./python Lib/shlex.py /tmp/quote.txt 
Token: 'manly'
Token: '"man"'
Token: 'likes'
Token: '\'cute "cat"\''
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/quote.txt' mode='r' encoding='UTF-8'>

Attached the patch to close the file when running the demo.

----------
components: Library (Lib)
files: fix_resource_warning_shlex_test.patch
keywords: patch
messages: 196291
nosy: vajrasky
priority: normal
severity: normal
status: open
title: Got ResourceWarning unclosed file when running Lib/shlex.py demo
type: resource usage
versions: Python 3.4
Added file: http://bugs.python.org/file31485/fix_resource_warning_shlex_test.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18853>
_______________________________________


More information about the New-bugs-announce mailing list