Opened 12 years ago

Closed 12 years ago

#3254 defect closed fixed (fixed)

twisted.python.deprecate does the wrong thing for methods

Reported by: Jean-Paul Calderone Owned by:
Priority: normal Milestone:
Component: core Keywords:
Cc: Branch: branches/fqn-3254-2
branch-diff, diff-cov, branch-cov, buildbot
Author: therve

Description

If deprecated() is applied to a function which is a method of a class, the resulting deprecation warning will mention the name module.function instead of module.class.function.

Change History (9)

comment:1 Changed 12 years ago by therve

Owner: changed from Glyph to therve

comment:2 Changed 12 years ago by therve

author: therve
Branch: branches/fqn-3254

(In [23771]) Branching to 'fqn-3254'

comment:3 Changed 12 years ago by therve

Branch: branches/fqn-3254branches/fqn-3254-2

(In [24294]) Branching to 'fqn-3254-2'

comment:4 Changed 12 years ago by therve

Keywords: review added
Owner: therve deleted

Let's move on this.

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

Keywords: review removed
Owner: set to therve
  • Expanding the docstring for fullyQualifiedName a bit would probably be good. It says "of an object" - what kind of objects does it mean, though? Classes, functions, methods, and modules, it seems. Also, please document the return type.
  • Instead of test_nestedClass with a todo, how about a low-priority enhancement ticket with that test in its description? Someone might resolve a ticket, but I can't remember the last time I saw someone fix a todo.
  • staticmethod and classmethod aren't supported. Don't know if I much care. Maybe we can wait until we want to deprecate a staticmethod or a classmethod.

Interesting that you chose to add a new function instead of modifying qual. Any particular reason for that?

comment:6 Changed 12 years ago by therve

Keywords: review added
Owner: therve deleted

I fixed the docstring and removed the todo. I'll create a ticket for the other problems once merged.

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

Keywords: review removed
Owner: set to therve
  • The return in _checkFullyQualfiedName doesn't seem to do anything useful
  • DummyClass is still defined but no longer used

Otherwise looks good, please merge when you're happy with it.

comment:8 Changed 12 years ago by therve

Resolution: fixed
Status: newclosed

(In [24931]) Merge fqn-3254-2

Author: therve Reviewer: exarkun Fixes #3254

Add function fullyQualifiedName which is able to get the name of a module, class, method or function, and use it in the deprecation mechanism instead of qual: this makes deprecation on method return the correct name.

comment:9 Changed 9 years ago by <automation>

Owner: therve deleted
Note: See TracTickets for help on using tickets.