Opened 8 years ago

Closed 7 years ago

#4259 defect closed duplicate (duplicate)

twisted.python.logfile.BaseLogFile.__init__ uses an assert to check the existence of the directory passed to it

Reported by: Jean-Paul Calderone Owned by:
Priority: normal Milestone:
Component: core Keywords:
Cc: Adam Branch:
Author:

Description

This is wrong for a number of reasons.

  1. It shouldn't use assert
  2. When it fails it provides too little information
  3. It doesn't guarantee things will work, since the directory could be removed after the check

Just letting the open fail later on would provide essentially the same behavior, but with more information. A test and documentation for this failure mode wouldn't hurt, either.

Attachments (1)

4259-1.patch (2.5 KB) - added by Adam 7 years ago.

Download all attachments as: .zip

Change History (5)

Changed 7 years ago by Adam

Attachment: 4259-1.patch added

comment:1 Changed 7 years ago by Adam

Cc: Adam added
Keywords: review added
Owner: Glyph deleted

attached patch hopefully addresses all the issues satisfactorily.

comment:2 Changed 7 years ago by therve

Keywords: review removed

There is already a test file in twisted.test.test_logfile. Until we move it, it would be better to add the tests there.

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

Resolution: duplicate
Status: newclosed

Uh. Sad. #4701, just resolved, was a duplicate of this.

comment:4 Changed 7 years ago by <automation>

Note: See TracTickets for help on using tickets.