Multiple printings of single deprecation warning
- Dominant language
- Python
- Stars
- 16.8k
- Forks
- 4.5k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 6
Description
If I enable Python's deprecation warnings, I see multiple printings of a single warning. (This is all with IPython built via Sage, upgraded to version 7.13.0 in https://trac.sagemath.org/ticket/28197 and then to 7.16.1 by hand, but the same issue appears regardless of the version.)
Version information:
```
% sage --python -c "import IPython; print(IPython.sys_info())"
{'commit_hash': '2486838d9',
'commit_source': 'installation',
'default_encoding': 'UTF-8',
'ipython_path': '/Users/palmieri/Desktop/Sage_stuff/git/sage/local/lib/python3.7/site-packages/IPython',
'ipython_version': '7.16.1',
'os_name': 'posix',
'platform': 'Darwin-19.5.0-x86_64-i386-64bit',
'sys_executable': '/Users/palmieri/Desktop/Sage_stuff/git/sage/local/bin/python3',
'sys_platform': 'darwin',
'sys_version': '3.7.7 (default, Mar 10 2020, 15:43:33) \n'
'[Clang 11.0.0 (clang-1100.0.33.17)]'}
```
The issue:
```
% PYTHONWARNINGS=always sage --ipython
Python 3.7.7 (default, Mar 10 2020, 15:43:33)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.16.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: '\i'
:1: DeprecationWarning: invalid escape sequence \i
:1: DeprecationWarning: invalid escape sequence \i
:1: DeprecationWarning: invalid escape sequence \i
<>:1: DeprecationWarning: invalid escape sequence \i
<>:1: DeprecationWarning: invalid escape sequence \i
:1: DeprecationWarning: invalid escape sequence \i
'\i'
Out[1]: '\\i'
```
In contrast, Python does not act the same way:
```
% PYTHONWARNINGS=always sage --python
Python 3.7.7 (default, Mar 10 2020, 15:43:33)
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> '\i'
:1: DeprecationWarning: invalid escape sequence \i
'\\i'
```
Contributor guide
Assessment
This issue has not been assessed yet.