[pypy-commit] pypy default: reduce diff with py3k
bdkearns
noreply at buildbot.pypy.org
Wed Apr 30 18:59:23 CEST 2014
Author: Brian Kearns <bdkearns at gmail.com>
Branch:
Changeset: r71094:62effbe1245d
Date: 2014-04-30 12:53 -0400
http://bitbucket.org/pypy/pypy/changeset/62effbe1245d/
Log: reduce diff with py3k
diff --git a/pypy/module/__builtin__/compiling.py b/pypy/module/__builtin__/compiling.py
--- a/pypy/module/__builtin__/compiling.py
+++ b/pypy/module/__builtin__/compiling.py
@@ -27,6 +27,7 @@
consts.PyCF_DONT_IMPLY_DEDENT | consts.PyCF_SOURCE_IS_UTF8):
raise OperationError(space.w_ValueError,
space.wrap("compile() unrecognized flags"))
+
if not dont_inherit:
caller = ec.gettopframe_nohidden()
if caller:
@@ -37,8 +38,7 @@
space.wrap("compile() arg 3 must be 'exec' "
"or 'eval' or 'single'"))
- w_ast_type = space.gettypeobject(ast.AST.typedef)
- if space.isinstance_w(w_source, w_ast_type):
+ if space.isinstance_w(w_source, space.gettypeobject(ast.AST.typedef)):
ast_node = space.interp_w(ast.mod, w_source)
ast_node.sync_app_attrs(space)
code = ec.compiler.compile_ast(ast_node, filename, mode, flags)
@@ -47,20 +47,20 @@
if space.isinstance_w(w_source, space.w_unicode):
w_utf_8_source = space.call_method(w_source, "encode",
space.wrap("utf-8"))
- str_ = space.str_w(w_utf_8_source)
+ source = space.str_w(w_utf_8_source)
# This flag tells the parser to reject any coding cookies it sees.
flags |= consts.PyCF_SOURCE_IS_UTF8
else:
- str_ = space.readbuf_w(w_source).as_str()
+ source = space.readbuf_w(w_source).as_str()
- if '\x00' in str_:
+ if '\x00' in source:
raise OperationError(space.w_TypeError, space.wrap(
"compile() expected string without null bytes"))
if flags & consts.PyCF_ONLY_AST:
- code = ec.compiler.compile_to_ast(str_, filename, mode, flags)
+ code = ec.compiler.compile_to_ast(source, filename, mode, flags)
else:
- code = ec.compiler.compile(str_, filename, mode, flags)
+ code = ec.compiler.compile(source, filename, mode, flags)
return space.wrap(code)
More information about the pypy-commit
mailing list