zope.exceptions fails to format a traceback from twisted.python.failure

Bug #438818 reported by Sidnei da Silva
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Landscape Server
Fix Released
Medium
Sidnei da Silva
zope.exceptions
Invalid
Undecided
Unassigned

Bug Description

Upon updating to a newer version of twisted (8.2.0) and zope.testing 3.8.1, zope/app/twisted/ftp/tests/trial.txt fails because the exception isn't reported anymore.

Turns out that its due to an AttributeError deep in the bowels of zope.exception, trying to access the 'f_locals' attribute from a fake '_Frame' object provided by twisted.python.failure.

A bug was filed upstream in twisted (http://twistedmatrix.com/trac/ticket/4045) about the lack of f_locals, but in the meantime, zope.exceptions could be made more robust and not fail in the absence of such attribute.

Revision history for this message
Sidnei da Silva (sidnei) wrote :
Changed in landscape:
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → Sidnei da Silva (sidnei)
milestone: none → 1.4.0
tags: added: review
Revision history for this message
Sidnei da Silva (sidnei) wrote :

See also Bug #425113, where Launchpad worked around this by monkey patching twisted's Frame object.

affects: zope3 → zope.exceptions
Revision history for this message
Wolfgang Schnerring (wosc) wrote :

I think zope.exceptions does not need to change. It expects to get a Frame object from the passed-in Traceback object, and that is guaranteed to have f_locals by the python language spec. If somebody chooses to substitute their own implementation, it is their responsibility to provide *all* relevant attributes of the thing they are substituting.

Changed in zope.exceptions:
status: New → Invalid
Revision history for this message
Thomas Herve (therve) wrote :

This has to be fixed in Twisted of course, but in the mean time old versions of Twisted are going to be around for a while: it would be a bad decision not to fix it here in zope.testing, especially since the diff is really small.

Revision history for this message
Duncan McGreggor (oubiwann) wrote :

I get one error when I run the test suite:

Error in test test_portRangeInheritedFromFactory (zope.app.twisted.ftp.tests.test_zope_ftp.BasicFTPServerTestCase)
Traceback (most recent call last):
  File "/home/oubiwann/lab/Twisted/trunk/twisted/internet/defer.py", line 104, in maybeDeferred
    result = f(*args, **kw)
  File "/home/oubiwann/lab/Twisted/trunk/twisted/internet/utils.py", line 191, in runWithWarningsSuppressed
    result = f(*a, **kw)
  File "/home/oubiwann/lab/Twisted/trunk/twisted/test/test_ftp.py", line 376, in test_portRangeInheritedFromFactory
    protocol = self.factory.buildProtocol(None)
  File "/home/oubiwann/lab/Canonical/Landscape/team/sidnei/newer-zope-testing-zope/src/zope/app/twisted/ftp/tests/test_zope_ftp.py", line 111, in _rememberProtocolInstance
    d1.callback(None)
  File "/home/oubiwann/lab/Twisted/trunk/twisted/internet/defer.py", line 241, in callback
    self._startRunCallbacks(result)
  File "/home/oubiwann/lab/Twisted/trunk/twisted/internet/defer.py", line 296, in _startRunCallbacks
    raise AlreadyCalledError
AlreadyCalledError

  Ran 6339 tests with 0 failures and 1 errors in 55.805 seconds.
Running zope.traversing.tests.layer.TraversingLayer tests:
  Tear down zope.testing.testrunner.layer.UnitTests in 0.000 seconds.
  Set up zope.traversing.tests.layer.TraversingLayer in 0.587 seconds.
  Ran 7 tests with 0 failures and 0 errors in 0.201 seconds.
Tearing down left over layers:
  Tear down zope.traversing.tests.layer.TraversingLayer in 0.003 seconds.
Total: 6928 tests, 0 failures, 1 errors in 1 minutes 59.360 seconds.

I don't know how big a deal that is, but if it's not, I'm +1 for a merge to the Landscape zope branch.

Revision history for this message
Thomas Herve (therve) wrote :

+1 from me as well. Duncan: you're using Twisted trunk, this bug is not present with 8.2.

tags: removed: review
Sidnei da Silva (sidnei)
Changed in landscape:
status: In Progress → Fix Committed
Jamu Kakar (jkakar)
tags: added: needs-testing
Sidnei da Silva (sidnei)
tags: removed: needs-testing
Jamu Kakar (jkakar)
Changed in landscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.