Opened 4 years ago

Closed 7 months ago

#8243 enhancement closed wontfix (wontfix)

☂ new style object flag day

Reported by: Glyph Owned by: hawkowl
Priority: normal Milestone: New-Style Classes Only
Component: core Keywords:
Cc: Branch:


We should get rid of old style classes within Twisted.

This is unfortunately sort of a all-or-nothing proposition for users, and comes with a compatibility break, although an implicit, subtle one. This is the sort of compat break which may take users some time to cope with, so we want to ensure they can start working on this well before we actually do a release that turns it off. To that end, I suggest the following 7-part plan:

  1. Add a module, let's say, twisted.python._oldstyle, which contains a class decorator, oldStyle, that is applied to every old-style class within Twisted (initially this decorator can be a no-op, for informational purposes only).
  2. Add a test case which ensures we aren't adding any new old-style classes, perhaps by looking for ClassType instances in memory after importing everything. Add this to the buildbot to ensure we don't regress.
  3. Add an implementation to oldStyle that conditionally converts its argument to an old-style class if it's new-style, only if a TWISTED_NEWSTYLE environment variable is not set.
  4. Make all classes newstyle (perhaps by __metaclass__ boilerplate), converted only by @oldStyle.
  5. Announce this feature on the list and elsewhere, and then issue a release.
  6. Emit a deprecation warning at startup if python2 + TWISTED_NEWSTYLE is not set; issue another release.
  7. Make oldStyle a no-op; issue a final release, and all old-style classes are banished forever.

Change History (4)

comment:1 Changed 4 years ago by hawkowl

Summary: new style object flag day☂ new style object flag day

comment:2 Changed 4 years ago by hawkowl

See #8244 for 1 (+ 3 + 4 if possible)

comment:3 Changed 4 years ago by hawkowl

Milestone: New-Style Classes Only

comment:4 Changed 7 months ago by hawkowl

Resolution: wontfix
Status: newclosed

I don't think we can do this before Py2 goes away, so.... oh well. We tried (kind of).

Note: See TracTickets for help on using tickets.