Skip to content
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

deprecated in 3.2/3.3, should be removed in 3.5 or ??? #57457

Closed
florentx mannequin opened this issue Oct 23, 2011 · 49 comments
Closed

deprecated in 3.2/3.3, should be removed in 3.5 or ??? #57457

florentx mannequin opened this issue Oct 23, 2011 · 49 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@florentx
Copy link
Mannequin

florentx mannequin commented Oct 23, 2011

BPO 13248
Nosy @rhettinger, @terryjreedy, @orsenthil, @pitrou, @vstinner, @larryhastings, @giampaolo, @tiran, @ezio-melotti, @merwok, @florentx, @berkerpeksag, @vadmium, @1st1
Files
  • issue13248_obsolescence_v3.diff
  • issue13248.diff
  • 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:

    assignee = None
    closed_at = <Date 2020-05-19.18:40:32.173>
    created_at = <Date 2011-10-23.17:49:46.072>
    labels = ['type-bug', 'library']
    title = 'deprecated in 3.2/3.3, should be removed in 3.5 or ???'
    updated_at = <Date 2020-05-19.18:40:32.172>
    user = 'https://github.com/florentx'

    bugs.python.org fields:

    activity = <Date 2020-05-19.18:40:32.172>
    actor = 'benjamin.peterson'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-05-19.18:40:32.173>
    closer = 'benjamin.peterson'
    components = ['Library (Lib)']
    creation = <Date 2011-10-23.17:49:46.072>
    creator = 'flox'
    dependencies = []
    files = ['26301', '32662']
    hgrepos = []
    issue_num = 13248
    keywords = ['patch']
    message_count = 49.0
    messages = ['146236', '146237', '146259', '146284', '146288', '146289', '146344', '146500', '146581', '149145', '149192', '149265', '149297', '149301', '149320', '149322', '155797', '155815', '155836', '155838', '155839', '155841', '164850', '164852', '164865', '164880', '164901', '164924', '164979', '184706', '184925', '185120', '185123', '203111', '217452', '217457', '221491', '233278', '233293', '233296', '233297', '233434', '233444', '247207', '247209', '247689', '247720', '247727', '275206']
    nosy_count = 18.0
    nosy_names = ['rhettinger', 'terry.reedy', 'orsenthil', 'pitrou', 'vstinner', 'larry', 'giampaolo.rodola', 'christian.heimes', 'ezio.melotti', 'eric.araujo', 'Arfrever', 'flox', 'Yaroslav.Halchenko', 'tshepang', 'python-dev', 'berker.peksag', 'martin.panter', 'yselivanov']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue13248'
    versions = ['Python 3.5']

    @florentx
    Copy link
    Mannequin Author

    florentx mannequin commented Oct 23, 2011

    The PEP-387 suggests that deprecated objects or arguments are removed in version (n+1).
    I've listed these DeprecationWarnings in 3.2, which are still in 3.3.
    I assume that most of these deprecated objects or arguments could be removed before next release.

    *_pyio*
    argument "max_buffer_size" of BufferedWriter and BufferedRWPair
    *argparse*
    argument "version" and related methods of ArgumentParser
    *asyncore*
    shortcut "dispatcher.*" for "dispatcher.socket.*" attributes
    *base64*
    functions "encodestring" and "decodestring"
    *cgi*
    functions "parse_qs" and "parse_qsl"
    *configparser*
    "ParsingError.filename", "RawConfigParser.readfp", "SafeConfigParser"
    *decimal*
    "Context._clamp"
    *difflib*
    "SequenceMatcher.isbjunk", "SequenceMatcher.isbpopular"
    *gzip*
    "GzipFile.filename"
    *http.client*
    argument "strict" of HTTPResponse and HTTPConnection
    *lib2to3*
    methods "set_prefix" and "get_prefix" of "pytree.Base"
    *mailbox*
    argument of type "StringIO" or "text mode files"
    *ntpath*
    function "splitunc"
    *tarfile*
    argument "exclude" of "TarFile.add"
    *trace*
    old API
    *unittest*
    "assert{DictContainsSubset,RaisesRegexp,RegexpMatches}", "fail*"
    *xml.etree*
    "Element.getchildren", "XMLParser.doctype"

    @florentx florentx mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Oct 23, 2011
    @florentx
    Copy link
    Mannequin Author

    florentx mannequin commented Oct 23, 2011

    In addition, we have some object and attributes which are triggering "PendingDeprecationWarning" in 3.2.
    We may keep these warnings in 3.3, or choose to turn some of them into "DeprecationWarning", to prepare their removal in 3.5.

    *cgi*
    "cgi.escape"
    *distutils"
    argument compress="compress" of make_tarball
    function "check_metadata" in "command.register"
    option "force-manifest" of "command.sdist"
    *importlib*
    "abc.PyLoader" and "abc.PyPycLoader"
    *nntplib*
    "_NNTPBase.xgtitle" and "_NNTPBase.xpath"
    *smtpd*
    the class-private "__" attributes
    *xml.etree

    method "getiterator" of "Element" and "ElementTree"

    @ezio-melotti
    Copy link
    Member

    *unittest*
    "assert{DictContainsSubset,RaisesRegexp,RegexpMatches}", "fail*"

    The "fail*" should stay.

    The general idea is that with Python3 we can wait a bit more before getting rid of things, because if someone jumps from 2.7 to 3.3, he might not find things that got deprecated in 3.2 and disappeared on 3.3.

    That said, some of the more obscure functions/method/attributes can probably go.

    Also I think that PendingDeprecations are now quite useless, since DeprecationWarnings are silenced by default. I think we can convert them to DeprecationWarnings, even if we leave them there for a couple of versions.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 24, 2011

    New changeset 221638ba5d2a by Mark Dickinson in branch 'default':
    Issue bpo-13248, issue bpo-8540: Remove deprecated Context._clamp attribute from Decimal module.
    http://hg.python.org/cpython/rev/221638ba5d2a

    @florentx
    Copy link
    Mannequin Author

    florentx mannequin commented Oct 24, 2011

    I missed these warnings in C modules.

    *array*
    "fromstring" and "tostring" methods
    *io* (like _pyio)
    argument "max_buffer_size" of BufferedWriter and BufferedRWPair
    *sys*
    "sys.getcheckinterval" and "sys.setcheckinterval"

    and some complaints from Objects/typeobject.c:

    "object.__init__() takes no parameters"
    "object.__new__() takes no parameters"
    "object.__format__ with a non-empty format string is deprecated"
    "Type %.100s defines tp_reserved (formerly tp_compare) but not "
    "tp_richcompare. Comparisons may not behave as intended."

    @pitrou
    Copy link
    Member

    pitrou commented Oct 24, 2011

    *array*
    "fromstring" and "tostring" methods

    I think these ones (and other well-known 2.x methods) should be kept to ease porting to 3.x.

    @ezio-melotti
    Copy link
    Member

    Maybe a 2to3 fixer to convert the names should be added?

    @merwok
    Copy link
    Member

    merwok commented Oct 27, 2011

    distutils will not change. I’ll ask if removing the deprecation warnings is okay, otherwise they’ll stay.

    For ConfigParser.readfp, it would ease porting between 2.x and 3.x if the method could stay longer, or forever.

    @terryjreedy
    Copy link
    Member

    The difflib deprecations are mine and I think they should happen in 3.3.
    This will serve as a reminder.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Dec 10, 2011

    New changeset f82ebf9b3a52 by Florent Xicluna in branch 'default':
    Issue bpo-13248: turn 3.2's PendingDeprecationWarning into 3.3's DeprecationWarning (cgi, importlib, nntplib, smtpd).
    http://hg.python.org/cpython/rev/f82ebf9b3a52

    @florentx
    Copy link
    Mannequin Author

    florentx mannequin commented Dec 10, 2011

    I know it won't be committed as-is, but this is the patch with most of the deprecated things removed.

    I skipped all the modules where a veto has been pronounced explicitly.

    @vstinner
    Copy link
    Member

    .. versionchanged:: 3.2
    -      The *strict* parameter is deprecated.  HTTP 0.9-style "Simple Responses"
    +      The *strict* parameter is removed.  HTTP 0.9-style "Simple Responses"
           are not supported anymore.

    Such change looks wrong: the parameter exists in Python 3.2.

    @pitrou
    Copy link
    Member

    pitrou commented Dec 12, 2011

    I think most of these shouldn't be removed, as it would make porting from 2.x significantly more tedious.

    Things that I think can be removed:

    • max_buffer_size (io is new and that argument was never used by anybody)
    • get_prefix / set_prefix (the internal lib2to3 API is not documented AFAICT)
    • the argparse things (argparse is new)

    @florentx
    Copy link
    Mannequin Author

    florentx mannequin commented Dec 12, 2011

    I removed object.__format__ from the patch because it is not planned for removal in 3.3, but in 3.4 (see issue bpo-9856).

    I've fixed the documentation *versionchanged* and split the patch in two.
    The first is less controversial.
    The second might be delayed a little to ease the migration from 2.x to 3.x.

    @merwok
    Copy link
    Member

    merwok commented Dec 12, 2011

    Given the discussions we’ve had this month and a few months earlier about people porting directly to 3.2 or 3.3, I think the second patch needs to wait for 3.4 or 3.5. (I have no opinion on the first patch, not being a customer of lib2to3 or pyio.)

    @ezio-melotti
    Copy link
    Member

    I think it would be better to decide in what version each thing will be removed and then mark them with the deprecated-removed directive in the doc.

    @rhettinger
    Copy link
    Contributor

    In unittest, DictContainsSubset() should be removed from 3.3. It was defective by design (wrong argument order). I concur with Ezio that the other unittest methods should remain intact. I'm not sure whether assertSameElements() should stay or go (when Google's code search was still up, it showed zero uptake for that test method, so it may be better to remove it now).

    The Decimal module's Context._clamp should also be removed from 3.3. It was a private API from the outset and won't be mirrored in the C version. It looks like Mark has already done this one.

    I also agree Antoine that most of the other changes shouldn't be made in 3.3 except for the three he listed: max_buffer_size, get_prefix/set_prefix, and the argparse deprecations.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 14, 2012

    New changeset b30171bbc571 by Benjamin Peterson in branch 'default':
    remove get_prefix and set_prefix (bpo-13248)
    http://hg.python.org/cpython/rev/b30171bbc571

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 15, 2012

    New changeset 0ddb78341290 by Raymond Hettinger in branch 'default':
    Issue bpo-13248: Removed docs for two deprecated unittest features. To be conservative, the code is left in for one more release.
    http://hg.python.org/cpython/rev/0ddb78341290

    @ezio-melotti
    Copy link
    Member

    Raymond, I think it's better to leave the documentation and use "deprecated-removed" to signal clearly that those functions are deprecated and when they will be removed (even if this means 3.4).

    IME removing documentation creates more confusion because people that find those functions in some codebase will have an hard time figuring out what they are, where do they come from, if they are deprecated or not and when they will be removed.

    @rhettinger
    Copy link
    Contributor

    Ezio, I'm was thinking of marking the code and its docstring as removed/unused, but if you want the code removed altogether, that would be fine.

    @ezio-melotti
    Copy link
    Member

    I don't mind if they are removed in 3.3 or 3.4, as long as they are documented in all the versions where they are present.

    @florentx
    Copy link
    Mannequin Author

    florentx mannequin commented Jul 7, 2012

    Do we agree to remove the "max_buffer_size" from the "io" module in 3.3?

    This argument is unused, and deprecated. Just dead code.
    See attachment.

    @pitrou
    Copy link
    Member

    pitrou commented Jul 7, 2012

    Do we agree to remove the "max_buffer_size" from the "io" module in 3.3?

    Yes!

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jul 7, 2012

    New changeset 5393382c1b1d by Florent Xicluna in branch 'default':
    Issue bpo-13248: argparse: Remove obsolete argument "version" of ArgumentParser.
    http://hg.python.org/cpython/rev/5393382c1b1d

    New changeset 700f989afbad by Florent Xicluna in branch 'default':
    Issue bpo-13248: io: Remove obsolete argument "max_buffer_size" of BufferedWriter and BufferedRWPair.
    http://hg.python.org/cpython/rev/700f989afbad

    @merwok
    Copy link
    Member

    merwok commented Jul 7, 2012

    Flox, could you put versionchanged (or versiondeprecated-removed, which could also go into 3.2) to note the removals in the doc?

    @florentx
    Copy link
    Mannequin Author

    florentx mannequin commented Jul 7, 2012

    Eric, I will check but I thought they were not documented.

    @terryjreedy
    Copy link
    Member

    We do not document removals after they are done as they are not an issue for back-compatibility (unlike changes and additions).

    Deprecation Warnings are optionally available for checking forward-compatibility. Deprecations are sometimes noted in the regular text flow with things like "encodestring is a deprecated alias", but they are not set off with separate versionchanged: notices, as nothing has changed yet. Some deprecated features are not even documented.

    The 'version' arg of class ArgumentParser is already not documented in 3.2, which is why the patch does not change argparse.rst.

    "A third argument, max_buffer_size, is supported, but unused and deprecated." and "A fourth argument, max_buffer_size, is supported, but unused and deprecated." is enough for that parameter (and the patch removes those lines -- the param was already left out of the signature).

    @florentx
    Copy link
    Mannequin Author

    florentx mannequin commented Jul 8, 2012

    The other changes are in the patch "issue13248_obsolescence_v3.diff".
    AFAIU, they will not be removed in 3.3, in order to facilitate transition from Python 2.

    *asyncore*
    shortcut "dispatcher.*" for "dispatcher.socket.*" attributes

    *base64*
    functions "encodestring" and "decodestring"

    *cgi*
    functions "parse_qs" and "parse_qsl"

    *gzip*
    "GzipFile.filename"

    *http.client*
    argument "strict" of HTTPResponse and HTTPConnection

    *mailbox*
    argument of type "StringIO" or "text mode files"

    *ntpath*
    function "splitunc"

    *tarfile*
    argument "exclude" of "TarFile.add"

    *trace*
    old API

    @ezio-melotti ezio-melotti changed the title deprecated in 3.2, should be removed in 3.3 deprecated in 3.2/3.3, should be removed in 3.4 Sep 26, 2012
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 19, 2013

    New changeset 612d8bbcfa3a by Terry Jan Reedy in branch 'default':
    Issue bpo-13248: removed deprecated and undocumented difflib.isbjunk, isbpopular.
    http://hg.python.org/cpython/rev/612d8bbcfa3a

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 21, 2013

    New changeset 62a988b3bf2e by Terry Jan Reedy in branch 'default':
    Issue bpo-13248: NEWS and What's New items
    http://hg.python.org/cpython/rev/62a988b3bf2e

    @merwok
    Copy link
    Member

    merwok commented Mar 24, 2013

    We do not document removals after they are done as they are not an
    issue for back-compatibility (unlike changes and additions).

    I learned that people may use the (for example) 2.7 docs even though they are using 2.6, so I think we do want to use things like the deprecated-removed directive to tell these users that they should start looking for a replacement. Removing documentation would lead them to look in other places and discover the removals later.

    @ezio-melotti
    Copy link
    Member

    IMHO deprecated-removed should be used on versions where the feature exists, and a versionchanged should be added once the feature has been removed.

    @ezio-melotti
    Copy link
    Member

    The attached patch removes assertDictContainsSubset().

    @pitrou
    Copy link
    Member

    pitrou commented Apr 28, 2014

    Apparently we missed some of the stuff here.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Apr 29, 2014

    New changeset 2cceb8cb552b by Giampaolo Rodola' in branch 'default':
    fix isuse bpo-13248: remove previously deprecated asyncore.dispatcher __getattr__ cheap inheritance hack.
    http://hg.python.org/cpython/rev/2cceb8cb552b

    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Jun 24, 2014

    Anything else left to do on this?

    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Jan 1, 2015

    Can this be closed as plenty of changesets have been pushed?

    @terryjreedy
    Copy link
    Member

    At most half of the items listed in the original post have been dealt with. Each remaining 'deprecated items should be removed in 3.5, undeprecated, or a decision recorded to leave it deprecated indefinitely.

    @terryjreedy terryjreedy changed the title deprecated in 3.2/3.3, should be removed in 3.4 deprecated in 3.2/3.3, should be removed in 3.5 or ??? Jan 1, 2015
    @vadmium
    Copy link
    Member

    vadmium commented Jan 1, 2015

    See bpo-19167 for a patch to remove the xml.etree.XMLParser.doctype() method. I’m happy for it to be removed, since the logic for generating the DeprecationWarning is buggy.

    @vadmium
    Copy link
    Member

    vadmium commented Jan 1, 2015

    Make that bpo-19176 for XMLParser.doctype()

    @vadmium
    Copy link
    Member

    vadmium commented Jan 4, 2015

    Another one to deal with one way or the other: html.parser.HTMLParser.unescape()

    It is apparently due to be removed in 3.5. It was meant to be an undocumented internal function, and there is now an public alternative. However I would be inclined to leave it around a little longer, because it seems to have been widely recommended for decoding HTML entities in the past (e.g. <https://wiki.python.org/moin/EscapingHtml\>), and keeping it would simplify maintaining Python 2 compatible code.

    @berkerpeksag
    Copy link
    Member

    Here is a follow-up list:

    • formatter module (will be removed in Python 3.6)
    • asynchat.fifo() (will be removed in Python 3.6)
    • buffering argument of bz2.BZ2File() (deprecated in 2011)
    • tarfile.filemode() (deprecated in 2012)
    • SO config var (sysconfig.get_config_var()) (deprecated in 2013)
    • platform.popen() (deprecated in 2011)
    • ntpath.splitunc() (deprecated in 2009)
    • inspect.getmoduleinfo() (deprecated in 2012)

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jul 23, 2015

    New changeset a565aad5d6e1 by Yury Selivanov in branch 'default':
    Issue bpo-13248: Remove inspect.getargspec from 3.6 (deprecated from 3.0)
    https://hg.python.org/cpython/rev/a565aad5d6e1

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jul 23, 2015

    New changeset 558199e060fd by Yury Selivanov in branch 'default':
    Issue bpo-13248: Remove inspect.getmoduleinfo() from 3.6 (deprecated in 3.3)
    https://hg.python.org/cpython/rev/558199e060fd

    @YaroslavHalchenko
    Copy link
    Mannequin

    YaroslavHalchenko mannequin commented Jul 30, 2015

    the function getargspec was removed but references to it within docstrings remained:

    $> git grep getargspec
    Doc/library/inspect.rst: The first four items in the tuple correspond to :func:`getargspec`.
    Doc/library/inspect.rst: :func:`getargspec` or :func:`getfullargspec`.
    Doc/whatsnew/3.4.rst::func:`~inspect.getfullargspec` and :func:`~inspect.getargspec`
    Doc/whatsnew/3.5.rst:* :func:`inspect.getargspec` is deprecated and scheduled to be removed in
    Doc/whatsnew/3.6.rst:* ``inspect.getargspec()`` was removed (was deprecated since CPython 3.0).
    Lib/inspect.py: getargspec(), getargvalues(), getcallargs() - get info about function arguments
    Lib/inspect.py: The first four items in the tuple correspond to getargspec().
    Lib/inspect.py: """Format an argument spec from the values returned by getargspec
    Lib/test/test_inspect.py:# getclasstree, getargspec, getargvalues, formatargspec, formatargvalues,
    Misc/NEWS:- Issue bpo-13248: Remove deprecated inspect.getargspec and inspect.getmoduleinfo

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jul 31, 2015

    New changeset ad4c1bfe257f by Berker Peksag in branch 'default':
    Issue bpo-13248: Delete remaining references of inspect.getargspec().
    https://hg.python.org/cpython/rev/ad4c1bfe257f

    @1st1
    Copy link
    Member

    1st1 commented Jul 31, 2015

    Thank you, Berker!

    @tiran
    Copy link
    Member

    tiran commented Sep 8, 2016

    Did you keep this ticket open for a reason?

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests