#8160 closed defect (fixed)
DeprecationWarnings with Python 2.6
| Reported by: | 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)
Change History (15)
comment:1 by , 17 years ago
comment:3 by , 16 years ago
| Cc: | added |
|---|
by , 16 years ago
| Attachment: | t8160-baseexception_message-r8311-0.11.diff added |
|---|
Keep 'message' using property.
comment:5 by , 16 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.
follow-up: 10 comment:9 by , 16 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 , 16 years ago
| Attachment: | t8160-baseexception_message-r8332-0.11.diff added |
|---|
slightly more compact version using lambdas
comment:10 by , 16 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 ;-)
follow-up: 13 comment:11 by , 16 years ago
| Milestone: | 0.11.6 → 0.11.5 |
|---|
Ah, I see. Looks like we have a clear winner in this round of "Know-Your-Python"…
comment:12 by , 16 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Thanks, committed in [8333:8334].
comment:13 by , 16 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…



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