Opened 7 years ago

Closed 7 years ago

#4045 enhancement closed fixed (fixed)

Twisted's Failure fake '_Frame' object lacks f_locals

Reported by: Sidnei da Silva Owned by:
Priority: normal Milestone:
Component: core Keywords:
Cc: Branch:
Author:

Description

Upon updating Twisted and zope.testing on a known Zope 3-based project, a new failure showed up on a test that was exercising the behavior of trial-based unittests as run by zope.testing's testrunner.

Turns out that a failure wasn't properly being reported due to zope.testing's custom format_traceback function trying to access the 'f_locals' attribute of a frame object (twisted.python.failure._Frame) from the handed over traceback object (an instance of twisted.python.failure._Traceback).

Of course the code from zope.testing is brittle enough to fall over on its back due to this missing attribute, but there's no apparent reason for Twisted's fake Frame object not provide the said 'f_locals' attribute other than perhaps memory issues (http://bugs.python.org/issue6116).

Attachments (1)

f_locals.patch (2.0 KB) - added by alanfranzoni 7 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 7 years ago by alanfranzoni

Keywords: review added
Owner: Glyph deleted
Type: defectenhancement

I realize that probably _Frame objects, and other fake objects created by twisted failure infrastructure for exception delivery, will NEVER support the full python sync exception API; most objects got ton of attributes.

By the way zc.buildout and its test runner is gaining momentum in the community, with a point; it's getting increasingly easy to have quickly reproducibile builds and separate work environments in python, something that Java got from years. Hence I think that this small patch (which I would call a feature) deserves its place in twisted trunk.

Changed 7 years ago by alanfranzoni

Attachment: f_locals.patch added

comment:2 Changed 7 years ago by Jean-Paul Calderone

... but zope.testing works without f_locals now right?

comment:3 Changed 7 years ago by Jean-Paul Calderone

Author: exarkun
Branch: branches/fakeframe-f_locals-4045

(In [29478]) Branching to 'fakeframe-f_locals-4045'

comment:4 Changed 7 years ago by Jean-Paul Calderone

(In [29479]) Apply f_locals.patch

refs #4045

comment:5 Changed 7 years ago by Jean-Paul Calderone

Author: exarkun
Branch: branches/fakeframe-f_locals-4045
Keywords: review removed
Owner: set to Jean-Paul Calderone
Status: newassigned

Alright, well, I have no idea if this will actually help zope.testing or not, but it still sorta makes sense, particularly since f_globals is already there.

This basically looks fine. There are a couple coding standard issues that I'll fix up, then I'll merge the branch.

comment:6 Changed 7 years ago by Jean-Paul Calderone

Resolution: fixed
Status: assignedclosed

(In [29494]) Merge fakeframe-f_locals-4045

Author: alanfranzoni Reviewer: exarkun Fixes: #4045

Add an f_locals attribute to the fake frame instances used by twisted.python.failure when real frames aren't available.

This doesn't convey any information about locals, but it might help tools expecting real frames not break.

comment:7 Changed 6 years ago by <automation>

Owner: Jean-Paul Calderone deleted
Note: See TracTickets for help on using tickets.