Edgewall Software

Opened 7 years ago

Closed 7 years ago

Last modified 4 years ago

#12558 closed enhancement (fixed)

Add contextmanager for Popen

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.3.1
Component: general Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:

Added context manager for Popen to trac.util.compat. The code is copied from the Python 3.2 implementation.

Internal Changes:

Refactored code to use Popen context manager.


I'm using Popen in a test case and rather than duplicate code again for closing the file descriptors, I thought I would investigate the following idea.

The Popen class has a context manager since Python 3.2. We could subclass Popen in trac.util.compat and copy the __enter__ and __exit__ methods.

Attachments (0)

Change History (5)

comment:1 by Ryan J Ollos, 7 years ago

Proposed changes in log:rjollos.git:t12558_popen.1.

Last edited 7 years ago by Ryan J Ollos (previous) (diff)

comment:2 by Ryan J Ollos, 7 years ago

Minor change in r15074, and I corrected the link to my proposed changes in comment:1.

comment:3 by Ryan J Ollos, 7 years ago

API Changes: modified (diff)
Release Notes: modified (diff)

Committed to trunk in r15077.

comment:4 by Ryan J Ollos, 7 years ago

Resolution: fixed
Status: assignedclosed

comment:5 by Ryan J Ollos, 4 years ago

Internal Changes: modified (diff)
Release Notes: modified (diff)

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.