Skip to content

Commit

Permalink
Replace inspect.currentframe with sys._getframe
Browse files Browse the repository at this point in the history
  • Loading branch information
kylemacfarlane committed Oct 11, 2014
1 parent 82e4454 commit 5a64f3e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
8 changes: 4 additions & 4 deletions src/z3c/rml/paraparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"""Paragraph-internal XML parser extensions.
"""
import copy
import inspect
import six
import sys

import reportlab.lib.fonts
import reportlab.platypus.paraparser
Expand All @@ -31,7 +31,7 @@ def __init__(self, **attributes):
@property
def text(self):
# Guess 1: We're in a paragraph in a story.
frame = inspect.currentframe(4)
frame = sys._getframe(4)
canvas = frame.f_locals.get('canvas', None)

if canvas is None:
Expand Down Expand Up @@ -59,7 +59,7 @@ def __init__(self, **attributes):
@property
def text(self):
# Guess 1: We're in a paragraph in a story.
frame = inspect.currentframe(4)
frame = sys._getframe(4)
canvas = frame.f_locals.get('canvas', None)

if canvas is None:
Expand Down Expand Up @@ -104,7 +104,7 @@ def __init__(self, **attributes):
@property
def text(self):
# Guess 1: We're in a paragraph in a story.
frame = inspect.currentframe(4)
frame = sys._getframe(4)
canvas = frame.f_locals.get('canvas', None)

if canvas is None:
Expand Down
14 changes: 0 additions & 14 deletions test-failures.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,6 @@ Fails in Python 2 and 3

Fails in Python 3

inspect.currentframe() doesn't accept a arguments in Python 3.

In fact, I went all the way back to the Python 2.1 docs and can't find reference to it ever accepting arguments.

Even removing the paramter makes these tests fail so we need to find an alternative.

- rml-guide-example-05.rml
- tag-para.rml
- tag-index.rml
- special-text.rml
- tag-log.rml
- tag-name.rml


These tests fail but I'm not sure why. It's either bugs in PyPDF2 under Python 3 or a problem with PyPDF2 writing to BytesIO.

- tag-mergePage.rml
Expand Down

0 comments on commit 5a64f3e

Please sign in to comment.