• Neal Norwitz's avatar
    Fix the refleak in strftime when converting a %Z with a user defined tzinfo. · aea70e03
    Neal Norwitz authored
    I inverted some of the conditionals to reduce indent levels.  Hopefully
    this makes it a little easier to read.
    
    This code caused the leak:
    
        class FixedOffset(datetime.tzinfo):
            def tzname(self, dt): return "UTC"
    
        datetime.time(12, 47, tzinfo=FixedOffset()).strftime('%Z')
    
    This code is very tricky and I'm not positive it works.  However,
    it neither crashes nor leaks.
    aea70e03
datetimemodule.c 134 KB