Skip to content

Commit

Permalink
Merge branch 'master' into issue-118
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Howitz committed May 8, 2019
2 parents 600ab45 + 1a4876b commit 1ac641f
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 13 deletions.
5 changes: 0 additions & 5 deletions src/RestrictedPython/transformer.py
Expand Up @@ -1135,12 +1135,7 @@ def visit_Print(self, node):
templates and scripts; 'write' happens to be the name of the
method that changes them.
"""

self.print_info.print_used = True
self.warn(node,
"Print statement is deprecated and "
"not available anymore in Python 3.")

node = self.node_contents_visit(node)
if node.dest is None:
node.dest = ast.Name('_print', ast.Load())
Expand Down
5 changes: 1 addition & 4 deletions tests/test_compile.py
Expand Up @@ -182,11 +182,8 @@ def test_compile_restricted():
# Non-CPython versions have a RuntimeWarning, too.
if len(record) > 2: # pragma: no cover
record.pop()
assert len(record) == 2
assert len(record) == 1
assert record[0].message.args[0] == \
'Line 3: Print statement is deprecated ' \
'and not available anymore in Python 3.'
assert record[1].message.args[0] == \
"Line 2: Prints, but never reads 'printed' variable."


Expand Down
4 changes: 0 additions & 4 deletions tests/test_print_stmt.py
Expand Up @@ -171,7 +171,6 @@ def test_print_stmt__with_printed_no_print_nested():
assert code is not None
assert errors == ()
assert warnings == [
"Line 2: Print statement is deprecated and not available anymore in Python 3.", # NOQA: E501
"Line 3: Doesn't print, but reads 'printed' variable."
]

Expand All @@ -188,7 +187,6 @@ def test_print_stmt__with_print_no_printed():
assert code is not None
assert errors == ()
assert warnings == [
"Line 3: Print statement is deprecated and not available anymore in Python 3.", # NOQA: E501
"Line 2: Prints, but never reads 'printed' variable."
]

Expand All @@ -208,8 +206,6 @@ def test_print_stmt__with_print_no_printed_nested():
assert code is not None
assert errors == ()
assert warnings == [
"Line 2: Print statement is deprecated and not available anymore in Python 3.", # NOQA: E501
"Line 4: Print statement is deprecated and not available anymore in Python 3.", # NOQA: E501
"Line 3: Prints, but never reads 'printed' variable.",
]

Expand Down

0 comments on commit 1ac641f

Please sign in to comment.