#11585: Make deprecated_function_alias print the whole module path when it 
differs
from the original
--------------------------------------------+-------------------------------
    Reporter:  defeo                        |         Owner:             
        Type:  enhancement                  |        Status:  needs_work 
    Priority:  minor                        |     Milestone:  sage-5.0   
   Component:  misc                         |    Resolution:             
    Keywords:  deprecation                  |   Work_issues:  startuptime
    Upstream:  N/A                          |      Reviewer:  Rob Beezer 
      Author:  Luca De Feo, Florent Hivert  |        Merged:             
Dependencies:                               |  
--------------------------------------------+-------------------------------
Changes (by newvalueoldvalue):

  * reviewer:  Rob Beezer, Florent Hivert => Rob Beezer
  * author:  Luca De Feo => Luca De Feo, Florent Hivert


Comment:

 Got it !!! We don't need the module but only its name. One can get it
 using the filename of the code which is currently executed. Here is the
 diff
 {{{
 #!diff
 diff --git a/sage/misc/misc.py b/sage/misc/misc.py
 --- a/sage/misc/misc.py
 +++ b/sage/misc/misc.py
 @@ -2387,11 +2387,10 @@ def deprecated_function_alias(func, vers
       - Florent Hivert (2009-11-23), with the help of Mike Hansen.
       - Luca De Feo (2011-07-11), printing the full module path when
 different from old path
      """
 -    module = inspect.getmodule(inspect.currentframe(1))
 -    if module is None:
 +    module_name = inspect.getmodulename(
 +        inspect.currentframe(1).f_code.co_filename)
 +    if module_name is None:
          module_name = '__main__'
 -    else:
 -        module_name = module.__name__
      return DeprecatedFunctionAlias(func, version, module_name)
 }}}

 The new startup time is ok !
 {{{
 sage.all: 0.962 (None)
 }}}

 Please review.

 Florent

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11585#comment:17>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to