#6297 task closed fixed (fixed)

Remove usage of twisted.python.compat.set and frozenset

Reported by: thijs Owned by: tom.prince
Priority: low Milestone:
Component: core Keywords: easy
Cc: thijs Branch: branches/remove-set-frozenset-6297
(diff, github, buildbot, log)
Author: tomprince Launchpad Bug:

Description (last modified by thijs)

set and frozenset builtins were introduced in python2.4 and the sets module deprecated since python2.6. This makes compat.set and compat.frozenset redundant and the following imports can be removed:

./twisted/trial/runner.py:26:from twisted.python.compat import set
./twisted/trial/reporter.py:21:from twisted.python.compat import set
./twisted/trial/test/test_script.py:13:from twisted.python.compat import set
./twisted/scripts/trial.py:15:from twisted.python.compat import set
./twisted/mail/relaymanager.py:33:from twisted.python.compat import set
./twisted/mail/maildir.py:21:from twisted.python.compat import set
./twisted/web/_newclient.py:36:from twisted.python.compat import set
./twisted/web/test/test_wsgi.py:17:from twisted.python.compat import set
./twisted/web/test/test_static.py:13:from twisted.python.compat import set
./twisted/web/client.py:39:from twisted.python.compat import set
./twisted/protocols/amp.py:185:from twisted.python.compat import set
./twisted/names/test/test_client.py:12:from twisted.python.compat import set
./twisted/python/test/test_zipstream.py:12:from twisted.python.compat import set
./twisted/python/test/test_fakepwd.py:23:from twisted.python.compat import set
./twisted/internet/posixbase.py:18:from twisted.python.compat import set, _PY3
./twisted/internet/base.py:20:from twisted.python.compat import set
./twisted/internet/_glibbase.py:23:from twisted.python.compat import set
./twisted/internet/test/test_posixbase.py:10:from twisted.python.compat import set, _PY3
./twisted/internet/test/test_process.py:14:from twisted.python.compat import set
./twisted/internet/iocpreactor/reactor.py:35:from twisted.python.compat import set
./twisted/conch/test/test_openssh_compat.py:12:from twisted.python.compat import set
./twisted/conch/test/test_tap.py:27:from twisted.python.compat import set
./twisted/test/test_compat.py:15:from twisted.python.compat import set, frozenset, reduce, execfile, _PY3
./twisted/test/test_process.py:31:from twisted.python.compat import set
./twisted/test/test_paths.py:14:from twisted.python.compat import set, _PY3
./twisted/test/test_task.py:10:from twisted.python.compat import set
./twisted/words/protocols/irc.py:44:from twisted.python.compat import set

The compat versions could also be deprecated if deemed necessary.

Attachments (2)

kevinwo-6297.patch (12.8 KB) - added by kevinwo 22 months ago.
remove-set-frozenset-kevinwo-6297-1.patch (17.3 KB) - added by kevinwo 22 months ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 23 months ago by thijs

  • Description modified (diff)

comment:2 Changed 22 months ago by Julian

  • Keywords easy added

comment:3 Changed 22 months ago by kevinwo

  • Owner set to kevinwo
  • Status changed from new to assigned

Changed 22 months ago by kevinwo

comment:4 Changed 22 months ago by kevinwo

  • Keywords review added
  • Owner kevinwo deleted
  • Status changed from assigned to new

All traces of 'set' and 'frozenset' have been removed

comment:5 Changed 22 months ago by tom.prince

  • Owner set to tom.prince

comment:6 Changed 22 months ago by tom.prince

  • Keywords review removed
  • Owner changed from tom.prince to kevinwo

Thanks for your contribution.

There are a couple of more uses:

twisted/web/test/test_http_headers.py
twisted/web/test/test_http.py
twisted/python/test/test_release.py

Also, you need to add news files (.misc probably) to each touched component.

Please resubmit for review after removing the remaining uses and adding a topfile.

Changed 22 months ago by kevinwo

comment:7 Changed 22 months ago by kevinwo

  • Keywords review added
  • Owner changed from kevinwo to tom.prince

Thanks, Tom. I've attached an updated patch handling the uses you mentioned along with topfiles.

comment:8 Changed 22 months ago by tomprince

  • Author set to tomprince
  • Branch set to branches/remove-set-frozenset-6297

(In [37414]) Branching to remove-set-frozenset-6297.

comment:9 Changed 22 months ago by tom.prince

  • Keywords review removed

build results

Just a note: .misc topfiles don't need (and ignore) conetent. And for the rest of the topfiles, they should contain something appropriate to go in the NEWS files and they get rewrapped. For this particular change, since there is no user visibile change, the misc file just causes the ticket to appear under "Other".

I'll merge.

comment:10 Changed 22 months ago by tomprince

  • Resolution set to fixed
  • Status changed from new to closed

(In [37416]) Merge remove-set-frozenset-6297: Remove usage of twisted.python.compat.set and frozenset.

Author: kevinwo
Reviewers: therve
Fixes: #6297

set and frozenset builtins were introduced in python2.4 and
the sets module deprecated since python2.6. This makes
compat.set and compat.frozenset redundant.

Note: See TracTickets for help on using tickets.