Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in RichTraceback constructor #122

Closed
sqlalchemy-bot opened this issue Jan 17, 2010 · 6 comments
Closed

bug in RichTraceback constructor #122

sqlalchemy-bot opened this issue Jan 17, 2010 · 6 comments
Labels
bug Something isn't working low priority runtime
Milestone

Comments

@sqlalchemy-bot
Copy link

Migrated issue, originally created by Anonymous

Hi.

The RichTraceback class constructor accepts an optional traceback parameter.

However when passing a not null object, an exception is raised:

<...>
File "<...>/mako/exceptions.py", line 156, in _init
    return (type, value, new_trcback)
variable 'type' referenced before assignment

The bug is in the _init method:

def _init(self, trcback):
    """format a traceback from sys.exc_info() into 7-item tuples,
       containing the regular four traceback tuple items, plus the
       original template filename, the line number adjusted relative to
       the template source, and code line from that line number of the
       template."""
    import mako.template
    mods = {}
    if not trcback:
        (type, value, trcback) = sys.exc_info()

type and value variables are only assigned if trcback is None.

The main problem with RichTraceback, however, is that it is not possible to specify a custom exc_info to use when rendering the traceback.

Thanks Manlio Perillo

@sqlalchemy-bot
Copy link
Author

Changes by Michael Bayer (@zzzeek):

  • set milestone to "0.3"

@sqlalchemy-bot
Copy link
Author

Anonymous wrote:

I ran into this bug recently -- you can work-around it by raising your custom exc_info and invoking the RichTraceback in the except block.

e.g.:

        try:            
            raise type, value, tb         
        except:
            return mako.exceptions.html_error_template().render()#traceback=(type,value,tb))

@sqlalchemy-bot
Copy link
Author

Michael Bayer (@zzzeek) wrote:

this is probably fixed in afb6caa but I need to test it and ensure that we really need the error + traceback parameters.

@sqlalchemy-bot
Copy link
Author

Changes by Michael Bayer (@zzzeek):

  • removed labels: caching
  • added labels: runtime

@sqlalchemy-bot
Copy link
Author

Michael Bayer (@zzzeek) wrote:

tests in 524bdae

@sqlalchemy-bot
Copy link
Author

Changes by Michael Bayer (@zzzeek):

  • changed status to closed

@sqlalchemy-bot sqlalchemy-bot added bug Something isn't working low priority runtime labels Nov 26, 2018
@sqlalchemy-bot sqlalchemy-bot added this to the 0.3 milestone Nov 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working low priority runtime
Projects
None yet
Development

No branches or pull requests

1 participant