New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Idle: remove idlelib.idlever.py and its use in About dialog #68387
Comments
Once upon a time, Idle was versioned separately from Python, though updated in lockstep with Python (bpo-1515164, Martin's comment). The version was kept in idlever.py, with one line Several years ago, the separate versioning was dropped (or decreed to be the same as the Python version -- no issue for this). idlever.py was kept and made to contain the initial part of sys.version (sys.version.split()[0]). It gets patched as part of the version bump process, Most recently 80ccce248ba2 (Benjamin) and 413e0e0004f4 (Larry). Is that part of an automated script? The only current use of idlever is for the About Idle box (aboutDialog.py), which prints two lines with redundant information: idlever.py is not needed and I intend to remove it. But before or as I do, its patching needs to be removed from the version bump process. I would also like to remove "IDLE version ..." from the dialog box, but even if not, idlever.py is not needed. |
That's fine. Just delete idlever.py, and I'll deal with it. |
Are there third-party IDLE plugins? If yes, this change can break them. |
New changeset c473ac171041 by Terry Jan Reedy in branch '2.7': New changeset c862166060ed by Terry Jan Reedy in branch '3.4': |
Benjamim, I made idlever update from sys.version until removed, so remove it from release process. Serhiy, yes there are extensions which might possibly use this private api, even if they really should not. I want to bring Nick (PEP-434 approver) into the discussion of the timing of removal. Is there any problem with respect to buildbots of raising a DeprecationWarning when a module is imported? Is so, can a module be excluded from the import all test? |
To answer my question, I checked test___all__.py. The check_all helper has this: |
New changeset 117af4bc0513 by Benjamin Peterson in branch '2.7': |
Re-opening because there is still the issue of adding a deprecation warning on import. Brett, can you either point me toward or post here the code you are planning to use for other stdlib modules? |
Typically it's warnings.warn(message, DeprecationWarning, stacklevel=2), but that stack level is wrong for Python 3.3 - 3.4 (fixed in 3.5.0). If this is purely for Python 3.6 I might be adding a nicer API for module deprecations, but if this is for other versions then the call above is the right one except for Python 3.3/3.4. |
New changeset 55b62e2c59f8 by Terry Jan Reedy in branch '2.7': New changeset c51514826126 by Terry Jan Reedy in branch '3.4': |
Thanks, Brett. Since I am not wrapping the warning, the default stacklevel seems to work on all versions. Still to do: 1. Something in the docs (all branches), but with an eye toward other deprecations coming later.
|
The purpose of stacklevel=2 here would be to make warning message indicate which file contains import of deprecated module. See below example, which shows that stacklevel=2 in formatter.py and imp.py results in message pointing to bbb.py as containing imports of deprecated modules: $ cat aaa.py
import bbb
$ cat bbb.py
import formatter
import imp
import idlelib.idlever
$ python3.5 -Wd -c 'import aaa'
/tmp/bbb.py:1: DeprecationWarning: the formatter module is deprecated and will be removed in Python 3.6
import formatter
/tmp/bbb.py:2: PendingDeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
/usr/lib64/python3.5/idlelib/idlever.py:10: DeprecationWarning:
The separate Idle version was eliminated years ago;
idlelib.idlever is no longer used by Idle
and will be removed in 3.6 or later. Use
from sys import version
IDLE_VERSION = version[:version.index(' ')] w.warn(__doc__, DeprecationWarning)
$ |
I get it now: the last line should be 'import idlelib.idlever' instead of the redundant line from idlever itself. Will change, and thanks for correcting this before I so the same in multiple other modules. |
New changeset 3c39413d277f by Terry Jan Reedy in branch '2.7': New changeset 048fce602bcd by Terry Jan Reedy in branch '3.4': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: