deprecated_method combined with staticmethod causes problems

Bug #32235 reported by James Henstridge
2
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Low
Martin Pool

Bug Description

When running the test suite, I saw the following deprecation warning:

DeprecationWarning: __builtin__.str.create_standalone was deprecated in version 0.8.
  wt = WorkingTree.create_standalone('.')

This is clearly not a method of str().

The definition of this method reads:
    @staticmethod
    @deprecated_method(zero_eight)
    def create_standalone(directory):
        ...

The @deprecated_method decorator wraps the function object in another that prints the deprecated method, inferring the class name from the initial "self" argument.

However, this method is a staticmethod, so no "self" argument is passed. Instead it prints the type of the "directory" argument, which is a string in this case.

Revision history for this message
Robert Collins (lifeless) wrote :

I think this is fixed by using the other ordering for the decoration. We should documentation that in decorators.py.

Changed in bzr:
status: Unconfirmed → Confirmed
Revision history for this message
Martin Pool (mbp) wrote :

The workaround seems to be:

    @staticmethod
    @deprecated_function(zero_ninetyone)
    def create_repository(base, shared=False, format=None):

note that it is @deprecated_function, not method.

Changed in bzr:
assignee: nobody → mbp
status: Confirmed → In Progress
Martin Pool (mbp)
Changed in bzr:
status: In Progress → 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.