Re: [Python-Dev] cpython: Don't use fancy new Python features like 'with' - some bots don't have them

Am 26.09.2013 15:42, schrieb eli.bendersky:
http://hg.python.org/cpython/rev/931d95e9067f changeset: 85801:931d95e9067f user: Eli Bendersky eliben@gmail.com date: Thu Sep 26 06:41:36 2013 -0700 summary: Don't use fancy new Python features like 'with' - some bots don't have them and can't bootstrap the parser.
files: Parser/asdl.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/Parser/asdl.py b/Parser/asdl.py --- a/Parser/asdl.py +++ b/Parser/asdl.py @@ -398,8 +398,11 @@ scanner = ASDLScanner() parser = ASDLParser()
- with open(file) as f:
- try:
f = open(file) buf = f.read()
- finally:
tokens = scanner.tokenize(buf) try: return parser.parse(tokens)f.close()
The open call needs to go outside the try-finally.
cheers, Georg

On Thu, Sep 26, 2013 at 9:07 AM, Georg Brandl g.brandl@gmx.net wrote:
Am 26.09.2013 15:42, schrieb eli.bendersky:
http://hg.python.org/cpython/rev/931d95e9067f changeset: 85801:931d95e9067f user: Eli Bendersky eliben@gmail.com date: Thu Sep 26 06:41:36 2013 -0700 summary: Don't use fancy new Python features like 'with' - some bots don't have
them
and can't bootstrap the parser.
files: Parser/asdl.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/Parser/asdl.py b/Parser/asdl.py --- a/Parser/asdl.py +++ b/Parser/asdl.py @@ -398,8 +398,11 @@ scanner = ASDLScanner() parser = ASDLParser()
- with open(file) as f:
- try:
f = open(file) buf = f.read()
- finally:
tokens = scanner.tokenize(buf) try: return parser.parse(tokens)f.close()
The open call needs to go outside the try-finally.\
Done, thanks.
participants (2)
-
Eli Bendersky
-
Georg Brandl