Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#4456 defect closed wontfix (wontfix)

twisted.web.error.Error triggers DeprecationWarning in Python2.6

Reported by: Oliver Gould Owned by:
Priority: normal Milestone:
Component: web Keywords:
Cc: Branch:
Author:

Description

Python 2.6.2 (r262:71600, Jan 25 2010, 18:46:47)
[GCC 4.4.2 20091222 (Red Hat 4.4.2-20)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from twisted.web import error, version
>>> version
Version('twisted.web', 10, 0, 0)
>>> error.Error(422, "I like tacos")
/home/ver/.local/lib/python2.6/site-packages/twisted/web/error.py:53: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
  self.message = message
Error(422, 'I like tacos', None)

Attachments (1)

4456_suppress_web_deprecation_error.patch (428 bytes) - added by Jason J. W. Williams 11 years ago.
Suppresses deprecation warning.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 12 years ago by Jean-Paul Calderone

Resolution: wontfix
Status: newclosed

This is a Python bug, not a Twisted bug: http://bugs.python.org/issue6844

Newer versions of 2.6 don't have this behavior.

comment:2 Changed 11 years ago by <automation>

Owner: jknight deleted

comment:3 Changed 11 years ago by Jason J. W. Williams

Resolution: wontfix
Status: closedreopened

Using .message is actually deprecated per: http://www.python.org/dev/peps/pep-0352/#retracted-ideas

Since Twisted relies on Error.message for the basic protocol error message and isn't using it for the same purpose as was intended in BaseException, we should keep it. Setting message = "" as an attribute on t.w.e.Error suppresses the warning. Attached is a patch to do that.

comment:4 Changed 11 years ago by Jason J. W. Williams

Keywords: review added
Status: reopenednew

Changed 11 years ago by Jason J. W. Williams

Suppresses deprecation warning.

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

Keywords: review removed
Owner: set to Jason J. W. Williams

I can't reproduce this warning on Python 2.6.4.

comment:6 Changed 11 years ago by Jason J. W. Williams

Owner: Jason J. W. Williams deleted

Was occurring in 2.6.1. 2.6.5 seems to be immune as well. Worth checking 2.7.x, since it looks like that's where it was targeted for removal.

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

Resolution: wontfix
Status: newclosed

I don't see any warnings on 2.7 either. It looks like maybe they forgot to remove it or something, I don't know. Either way, Twisted Web isn't really affected by this change, since it is setting its own message attribute, not relying on the one inherited from Exception (in other words, the warning was spurious to begin with).

comment:8 Changed 11 years ago by Jason J. W. Williams

Yeah...it was really more for removing the warning message from output during Trial jobs. But I guess I'll just put a newer version of Python on OSX.

Note: See TracTickets for help on using tickets.