Opened 4 years ago

Closed 4 years ago

#5973 enhancement closed fixed (fixed)

Port twisted.internet.main to Python 3

Reported by: Itamar Turner-Trauring Owned by: Itamar Turner-Trauring
Priority: normal Milestone: Python 3.3 Minimal
Component: core Keywords:
Cc: Branch: branches/imain-py3-5973-2
branch-diff, diff-cov, branch-cov, buildbot
Author: itamarst

Description

twisted.internet.main should run on Python 3.

Change History (9)

comment:1 Changed 4 years ago by itamarst

Author: itamarst
Branch: branches/imain-py3-5973

(In [35633]) Branching to 'imain-py3-5973'

comment:2 Changed 4 years ago by Itamar Turner-Trauring

Keywords: review added
Owner: changed from Itamar Turner-Trauring to Jean-Paul Calderone

comment:3 Changed 4 years ago by Jean-Paul Calderone

Keywords: review removed
Owner: changed from Jean-Paul Calderone to Itamar Turner-Trauring
  1. Add future imports to twisted/internet/main.py
  2. Relying on addCleanup to put the original reactor back makes me nervous. What code is going to run between the test method returning and the addCleanup functions running? What if it tries to import twisted.internet.reactor? It seems safer to me to restore sys.modules['twisted.internet.reactor'] before the test method returns. (In fact, I wrote a utility for doing this in #5935 which I guess is basically ready to be merged.)
  3. I don't understand the try/except or the new comment in test_alreadyInstalled.

comment:4 Changed 4 years ago by itamarst

(In [35650]) Address review comments 1 and 3. Refs #5973

comment:5 Changed 4 years ago by itamarst

Branch: branches/imain-py3-5973branches/imain-py3-5973-2

(In [35651]) Branching to 'imain-py3-5973-2'

comment:6 Changed 4 years ago by itamarst

(In [35653]) Address review comment 2. Refs #5973

comment:7 Changed 4 years ago by Itamar Turner-Trauring

Keywords: review added
Owner: changed from Itamar Turner-Trauring to Jean-Paul Calderone

comment:8 Changed 4 years ago by Jean-Paul Calderone

Keywords: review removed
Owner: changed from Jean-Paul Calderone to Itamar Turner-Trauring
  1. Shouldn't NoReactor.__enter__ also delete twisted.internet.reactor if it exists? Also, I think self._currentReactor is synonymous with self.modules["twisted.internet.reactor"].

Looks good otherwise, please merge when you're happy with that one point.

comment:9 Changed 4 years ago by itamarst

Resolution: fixed
Status: newclosed

(In [35665]) Merge imain-py3-5973-2.

Author: itamar Review: exarkun Fixes: #5973

Port twisted.internet.main to Python 3.

Note: See TracTickets for help on using tickets.