Edgewall Software
Modify

Opened 16 years ago

Closed 15 years ago

Last modified 15 years ago

#8160 closed defect (fixed)

DeprecationWarnings with Python 2.6

Reported by: Felix Schwarz <felix.schwarz@…> Owned by: osimons
Priority: low Milestone: 0.11.5
Component: general Version: 0.11-stable
Severity: trivial Keywords:
Cc: felix.schwarz@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Every time a TracError is instantiated, Python 2.6 raises a DeprecationWarning because direct access to the message attribute is considered deprecated:

.../trac_0.11dev/trac/core.py:36: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
    self.message = message

Attachments (2)

t8160-baseexception_message-r8311-0.11.diff (599 bytes ) - added by osimons 15 years ago.
Keep 'message' using property.
t8160-baseexception_message-r8332-0.11.diff (615 bytes ) - added by Christian Boos 15 years ago.
slightly more compact version using lambdas

Download all attachments as: .zip

Change History (15)

comment:1 by Christian Boos, 16 years ago

jonas already fixed that for 0.11.1 IIRC, then reverted the fix. What was the reason again?

comment:2 by kamil@…, 16 years ago

I can confirm this on openSUSE 11.1 with Trac 0.11.4

comment:3 by Felix Schwarz <felix.schwarz@…>, 15 years ago

Cc: felix.schwarz@… added

comment:4 by Felix Schwarz <felix.schwarz@…>, 15 years ago

Fix was in r7774, revert is r7775.

by osimons, 15 years ago

Keep 'message' using property.

comment:5 by osimons, 15 years ago

Just spotted some advice from Brett Cannon suggesting using a property in order to keep the deprecated 'message' when subclassing Exception. Tested a quick patch that seems to work for 2.4 and 2.6.

comment:6 by osimons, 15 years ago

Owner: set to osimons

I suppose I can look after this one. Testing welcome.

comment:7 by Christian Boos, 15 years ago

Using lambdas could make it a one liner.

comment:8 by Christian Boos, 15 years ago

(or two ;-) )

But otherwise, looks good.

in reply to:  7 ; comment:9 by osimons, 15 years ago

Replying to cboos:

Using lambdas could make it a one liner.

Really? I actually tried that before submitting the patch, but I got an error saying it would not allow assignment in lambda. I just thought 'hmm' and reverted back to the explicit version. Are you sure? Could well be my mistake, of course :-)

by Christian Boos, 15 years ago

slightly more compact version using lambdas

in reply to:  9 comment:10 by Christian Boos, 15 years ago

Replying to osimons:

… I actually tried that before submitting the patch, but I got an error saying it would not allow assignment in lambda.

Indeed, but think functional ;-)

comment:11 by osimons, 15 years ago

Milestone: 0.11.60.11.5

Ah, I see. Looks like we have a clear winner in this round of "Know-Your-Python"…

comment:12 by osimons, 15 years ago

Resolution: fixed
Status: newclosed

Thanks, committed in [8333:8334].

in reply to:  11 comment:13 by Remy Blank, 15 years ago

Replying to osimons:

Ah, I see. Looks like we have a clear winner in this round of "Know-Your-Python"…

FWIW, I still find the non-setattr setter clearer. Not that it really matters…

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain osimons.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from osimons to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.