[MERGE] symbol_versioning.deprecation_string

Robert Collins robertc at robertcollins.net
Tue Sep 5 22:10:13 BST 2006


On Tue, 2006-09-05 at 22:58 +1000, Martin Pool wrote:
> On Tue, 2006-09-05 at 20:37 +1000, Robert Collins wrote:
> > This adds a helper to symbol_versioning to give you the deprecation
> > string that will be emitted for a given symbol, deprecation_format pair.
> > 
> > This is primarily of use with callDeprecated.
> 
> -0
> 
> The way the format strings are handled here makes me distinctly
> uncomfortable.  We are using strings when we really should be using
> objects.

The current symbol version API works this way. 
Doing what you propose is a larger change, as it requires overhauling
the symbol versioning API.

> There is obvious duplication in the "%s was duplicated in version ..."
> between the symbol_versioning parameters.
> 
> Warnings are raised and reported as objects.  We can raise an instance
> which contains a deprecated_since field, being a version like (0, 9).

They are not raised at all (I am assuming you refer to an exception like
mechanism). Nor are they reported as objects, rather they are reported
as a call to 'symbol_versioning.warn(aString, DeprecatedWarning)'. 

> Factoring out something which returns a nicely formatted name for a
> callable is fine with me.

Thats precisely what this helper does. 

Colour me confused - I dont get the -0 because of the existing API, and
a statement that *doing what I've done* would be fine with you.

My patch removes the formatting logic in the deprecated_function
decorator to use this new helper. It does not remove the formatting
logic in the deprecated_method decorator because it cant do so quite so
easily. (deprecation_string gets given bound methods, deprecated_method
does not). Diminishing returns on putting this together led me to stop
when I had achieved the specific use case I had - which is a test helper
to remove duplication.

-Rob

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060906/b57989a1/attachment.pgp 


More information about the bazaar mailing list