The reason that the warning isn't printed is that the stacklevel is set to
4 by default in order to tell the user where the Integer('012') is
occurring.  When you type '012' directly into the command line, the stack
isn't deep enough and no warning is printed.  You do see a warning if you
write a function that uses it:
sage: def hello():
....:     Integer('012')
....:
sage: hello()
/home/sage/sage-8.8/src/bin/sage-ipython:1: DeprecationWarning: use 0o as
octal prefix instead of 0
If you do not want this number to be interpreted as octal, remove the
leading zeros.
See http://trac.sagemath.org/17413 for details.
  #!/usr/bin/env sage-python23

I think the idea is that if a user's typing interactively then they don't
need a deprecation warning (since the behavior currently works).  It's more
important to show a user a warning if they have the deprecated behavior in
a function they've written.
David

On Sat, Oct 19, 2019 at 2:56 PM John H Palmieri <jhpalmier...@gmail.com>
wrote:

> Here is a doctest from sage/rings/integer.pyx:
>
>         sage: Integer('012')
>         doctest:...: DeprecationWarning: use 0o as octal prefix instead of
> 0
>         If you do not want this number to be interpreted as octal, remove
> the leading zeros.
>         See http://trac.sagemath.org/17413 for details.
>         10
>
> But if I run the command Integer('012')from the command line (in a newly
> started Sage session) or the Jupyter notebook, no deprecation warning is
> printed. Same if I just evaluate 012. Is this a bug? It seems to defeat
> the purpose of the deprecation warning, which is to actually warn people
> that a feature is going away, not just to provide extra characters in
> docstrings and the reference manual.
>
> --
> John
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-devel/6569111a-90ac-436f-8ecb-2976a9b32ab3%40googlegroups.com
> <https://groups.google.com/d/msgid/sage-devel/6569111a-90ac-436f-8ecb-2976a9b32ab3%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CAChs6_kmXP9cABD7CAstcPHQDC6u80yx0anYxUT1hs%3DsNeuC7w%40mail.gmail.com.

Reply via email to