Ticket #5387 enhancement new

Opened 18 months ago

Last modified 5 weeks ago

Get rid of references and code specific to Python 2.4

Reported by: jesstess Owned by:
Priority: normal Milestone:
Component: core Keywords: review
Cc: jesstess, bartekci, thijs Branch: branches/remove-py24-refs-5387-3
Author: bartekci, MostAwesomeDude, thijs Launchpad Bug:

Description (last modified by thijs) (diff)

Once we drop support for 2.4 in ticket 4962 and close #5385 (py2.2) and #5386 (py2.3). Some of these comments can just get removed. Some might require removal of code as well.

twisted/conch/test/test_filetransfer.py:        # In Python 2.4, the bad import has already been cleaned up for us.
twisted/internet/defer.py:    WARNING: this function will not work in Python 2.4 and earlier!
twisted/internet/defer.py:    generators.  If you need to be compatible with Python 2.4 or before, use
twisted/internet/unix.py:            # Abstract namespace sockets aren't well supported on Python 2.4.
twisted/python/dist.py:    older versions (currently the only supported older version is 2.4), checks
twisted/python/filepath.py:    Provide random data in versions of Python prior to 2.4.  This is an
twisted/python/filepath.py:            # Under Python 2.4 on Windows, WindowsError only has an errno
twisted/python/filepath.py:            # in Python 2.4 will result in a Windows error code of
twisted/python/reflect.py:                if (execName is None or # python 2.4+, post-cleanup
twisted/python/test/test_dist.py:    Tests for L{_checkCPython} when used on a Python 2.4-like platform, when
twisted/python/test/test_zipstream.py:        # In python 2.4 and earlier, consistency between the directory and the
twisted/python/util.py:    This is mostly necessary in Python 2.4 which implements L{id} to sometimes
twisted/test/test_defgen.py:## syntax error in Python 2.4 and before.
twisted/trial/runner.py:            # objects do not have nice looking string formats on Python 2.4.
twisted/trial/test/mockdoctest.py:# to test trial's doctest support with python2.4
twisted/trial/unittest.py:        # in __call__, whereas 2.4 defines the code in run.
twisted/trial/util.py:        else: # use hotshot, profile is broken in 2.4
twisted/trial/util.py:                    # Python 2.4 has fixed this.  Yay!
twisted/web/client.py:    # Python 2.4 doesn't have these symbolic constants
twisted/web/test/test_xmlrpc.py:    Tests for the C{useDateTime} flag on Python 2.4.
twisted/web/xmlrpc.py:# On Python 2.4 and earlier, DateTime.decode returns unicode.

Attachments

ticket-5387.diff Download (8.8 KB) - added by bartekci 14 months ago.
Initial work for review. Partially done deprecation
5387.patch Download (13.0 KB) - added by bartekci 14 months ago.
Added complete changes for ticket and news files. A few items referenced in the original ticket were left unchanged as they seemed rellevant to the codebase past Python 2.4
5387.2.patch Download (12.5 KB) - added by bartekci 14 months ago.
Updated patch with newsfile typo fixes and additional doc changes as requested.

Change History

1

Changed 18 months ago by exarkun

  • keywords easy added

2

Changed 18 months ago by exarkun

Also "Programming Language :: Python :: 2.4" in setup.py

3

Changed 14 months ago by bartekci

  • owner set to bartekci
  • status changed from new to assigned

Changed 14 months ago by bartekci

Initial work for review. Partially done deprecation

4

Changed 14 months ago by bartekci

Initial work, still in progress, but would be happy if someone reviewed it to make sure it's appropriately done. Here's a summary of changes done so far:

twisted/web/test/test_xmlrpc.py -- Removed Python 2.4 specific test and flags.

twisted/web/xmlrpc.py -- Removed < Python 2.5 check in setattr -- Removed hack for DateTime.decode

twisted/web/client.py -- Adjusted getattr(os, 'SEEK_SET', 0) to os.SEEK_SET, kept private vclass variable though. Necessary?

twisted/trial/util.py -- Removed 2.4 hack under profiled -- DIDNOTFIX: Python 2.4 has fixed this, line 286. del sys.modules try/catch l

twisted/trial/unittest.py -- Removed overrides to call and run. Python 2.5/6 handle this as implemented.

twisted/trial/test/mockdoctest.py -- Removed reference to python 2.4 in doc, but test seems valid.

twisted/trial/runner.py -- Removed deprecated DocTestCase.

twisted/test/test_defgen.py -- Removed string exec hack for InlineCallbacksTests

5

Changed 14 months ago by jesstess

  • owner bartekci deleted
  • keywords easy, review added; easy removed
  • status changed from assigned to new
  • cc bartekci added
  • branch_author set to bartekci

Thanks for this initial work, bartekci! If you want your work reviewed, please add the 'review' keyword and assign the ticket to <blank>. This will make it show up on http://twistedmatrix.com/trac/report/11 and in the review reminders on IRC. Otherwise it's likely to get lost in the shuffle. :) I'll go ahead and set it now.

Changed 14 months ago by bartekci

Added complete changes for ticket and news files. A few items referenced in the original ticket were left unchanged as they seemed rellevant to the codebase past Python 2.4

6

Changed 14 months ago by glyph

  • description modified (diff)

(Just updating markup, please ignore.)

7

Changed 14 months ago by MostAwesomeDude

  • branch set to branches/remove-py24-refs-5387
  • branch_author changed from bartekci to bartekci, MostAwesomeDude

(In [33806]) Branching to 'remove-py24-refs-5387'

8

Changed 14 months ago by MostAwesomeDude

(In [33807]) Applying patch from #5387.

Refs #5387

9

Changed 14 months ago by MostAwesomeDude

(In [33808]) t.p.util: Fix trailing whitespace.

Refs #5387

10

Changed 14 months ago by MostAwesomeDude

  • keywords easy added; easy, removed

Looks like I've added myself to the authors list. Whatever.

This largely looks decent. The topfiles are not okay. I don't know what "Tornadio" is, but I'm pretty sure you meant something else. There are also spelling mistakes ("byres") which should be corrected.

I'm going to kick off a build for this branch; you can follow along at home at  http://buildbot.twistedmatrix.com/boxes-supported?branch=/branches/remove-py24-refs-5387

I know I'm forfeiting points, but I'm going to leave on the review keyword to attract other eyes. I don't see any code problems, but this is a very wide-reaching patch.

11

Changed 14 months ago by jerith

  • keywords easy review removed

I only have some minor stylistic comments.

  • In python/dist.py removing the Python 2.4 comment in the docstring leaves a partial line. I'd prefer the paragraph be reflowed to look tidier.
  • In internet/defer.py all references to Python 2.4 have been removed, but the reference to "Python 2.5 generators" is still there. Since we no longer support any version of Python /without/ generators, I'd drop the version from that sentence.
  • In trial/test/mockdoctest.py there is a reference to a __test__ attribute that doesn't seem to exist. This isn't strictly part of this ticket, but I think it can be cleaned up as well.

The code changes look okay. There's only one test failure on my system (some XPath thing in twisted.words), and that looks unrelated to the changes in this branch. (The same test fails in trunk.)

Ran 7295 tests in 121.716s
FAILED (skips=1468, expectedFailures=11, failures=1, successes=5815)

12

Changed 14 months ago by jerith

  • owner set to MostAwesomeDude

13

Changed 14 months ago by ralphm

There is also some version-specific code (for before Python 2.3.2) in twisted.words.protocols.jabber.xmpp_stringprep.

Also, I think your failing test is in test_sip, not xish.

Changed 14 months ago by bartekci

Updated patch with newsfile typo fixes and additional doc changes as requested.

14

Changed 14 months ago by bartekci

  • keywords review added

15

Changed 14 months ago by rockstar

  • owner changed from MostAwesomeDude to rockstar

16

Changed 14 months ago by MostAwesomeDude

(In [33851]) Update from 5387.2.patch.

Refs #5387

17

Changed 14 months ago by MostAwesomeDude

Updated the branch to the latest stuff from the patch. Please review.

bartekci, thank you for your hard work on this issue.

18

Changed 14 months ago by rockstar

  • owner rockstar deleted
  • keywords review removed

Hi bartekci, thanks for this patch.

Since you've removed DocTestCase here, you should probably also assign #5554 to yourself and close it when this ticket makes it to trunk.

After talking with dreid, I think it's probably better to ask that we hold off on completion of this ticket until after we close #5385 and #5386. A large reason is that there are many things like in t.internet.unix._UNIXPort that do things like "if sys.version_info > (2, 5)", and so we should probably remove that support in this ticket, *but* we should make sure that everything older than 2.4 is also taken care of.

19

Changed 11 months ago by thijs

  • cc thijs added
  • description modified (diff)

20

Changed 3 months ago by thijs

  • status changed from new to assigned
  • owner set to thijs

21

Changed 7 weeks ago by thijs

  • branch changed from branches/remove-py24-refs-5387 to branches/remove-py24-refs-5387-2

22

Changed 7 weeks ago by thijs

(In [37918]) remove more python2.4 references, add news files. refs #5387

23

Changed 7 weeks ago by thijs

(In [37919]) update setup files, refs #5387

24

Changed 7 weeks ago by thijs

  • branch changed from branches/remove-py24-refs-5387-2 to branches/remove-py24-refs-5387-3
  • branch_author changed from bartekci, MostAwesomeDude to bartekci, MostAwesomeDude, thijs

(In [37920]) Branching to 'remove-py24-refs-5387-3'

25

Changed 7 weeks ago by thijs

(In [37921]) merge forward, refs #5387

26

Changed 7 weeks ago by thijs

  • owner thijs deleted
  • status changed from assigned to new
  • keywords review added

Forced a  build, up for review.

27

Changed 5 weeks ago by Julian

Should the reference & conditional rockstar mentioned in t.i.unix._UNIXPort now be removed?

Note: See TracTickets for help on using tickets.