Opened 11 years ago

Last modified 11 years ago

#11585 closed enhancement

Make deprecated_function_alias print the whole module path when it differs from the original — at Version 7

Reported by: Luca De Feo Owned by: Jason Grout
Priority: minor Milestone: sage-5.0
Component: misc Keywords: deprecation
Cc: Florent Hivert Merged in:
Authors: Luca De Feo Reviewers: Rob Beezer
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by Luca De Feo)

Currently

sage: from sage.misc.misc import deprecated_function_alias
sage: a = deprecated_function_alias(sqrt, "Version ?")
sage: a(5)
...
DeprecationWarning: (Since Version ?) a is deprecated. Please use sqrt instead.
sqrt(5)

which is misleading because the user would expect to find sqrt in the same module as a.

With this patch

sage: from sage.misc.misc import deprecated_function_alias
sage: a = deprecated_function_alias(sqrt, "Version ?")
sage: a(5)
...
DeprecationWarning: (Since Version ?) a is deprecated. Please use sage.functions.other.sqrt instead.
sqrt(5)

There's no change in deprecating methods.

Apply:

  1. trac_11585_deprecated_function_alias+rc1.patch

Change History (10)

Changed 11 years ago by Luca De Feo

comment:1 Changed 11 years ago by Luca De Feo

Status: newneeds_review

comment:2 Changed 11 years ago by Rob Beezer

Cc: Florent Hivert added
Description: modified (diff)
Reviewers: Rob Beezer
Status: needs_reviewneeds_work

Looks good. Passes long tests on 4.7.1.alpha3. I've cc'ed Florent Hivert in case he wants to add anything. I've also added an "Apply" section to the description for the release manager.

Two minor formatting items need attention.

Line 2287: Trac #11585::

You need a blank line after the double-colon to make the verbatim text format properly.

You can test documentation via sage -docbuild reference html after a fresh build (sage -b) and then viewing the resulting HTML file.

Line 2299:

if module is None: module_name = '__main__'
else: module_name = module.__name__

should be formatted as

if module is None:
    module_name = '__main__'
else:
    module_name = module.__name__

See http://www.sagemath.org/doc/developer/conventions.html

which references: http://www.python.org/dev/peps/pep-0008/

(look shortly after "Compound statements")

Changed 11 years ago by Luca De Feo

comment:3 Changed 11 years ago by Luca De Feo

Description: modified (diff)
Status: needs_workneeds_review

Modified as requested by rbeezer. Apply second patch only (sorry for the mispelling in the first patch).

comment:4 Changed 11 years ago by Rob Beezer

Status: needs_reviewpositive_review

Luca,

Looks good - thanks for the improvement.

I am going to switch this to positive review, but Florent Hivert should feel free to get in on this just in case he sees something.

Rob

comment:5 Changed 11 years ago by Florent Hivert

Description: modified (diff)

I've no particular comments concerning this patch. We should start to actually remove deprecated things from sage, but this is another problem. Ready to go.

Florent

comment:6 Changed 11 years ago by Jeroen Demeyer

Status: positive_reviewneeds_work

This needs to be rebased to sage-4.7.1.rc1

Changed 11 years ago by Luca De Feo

Rebased against rc1

comment:7 Changed 11 years ago by Luca De Feo

Description: modified (diff)
Status: needs_workneeds_review
Note: See TracTickets for help on using tickets.