1. 07 Kas, 2005 1 kayıt (commit)
  2. 16 Ock, 2005 1 kayıt (commit)
  3. 13 Ock, 2005 1 kayıt (commit)
  4. 16 Eyl, 2004 1 kayıt (commit)
  5. 20 Haz, 2004 1 kayıt (commit)
    • Tim Peters's avatar
      Bug 975996: Add _PyTime_DoubleToTimet to C API · 1b6f7a90
      Tim Peters yazdı
      New include file timefuncs.h exports private API function
      _PyTime_DoubleToTimet() from timemodule.c.  timemodule should export
      some other functions too (look for painful bits in datetimemodule.c).
      
      Added insane-argument checking to datetime's assorted fromtimestamp()
      and utcfromtimestamp() methods.  Added insane-argument tests of these
      to test_datetime, and insane-argument tests for ctime(), localtime()
      and gmtime() to test_time.
      1b6f7a90
  6. 07 Haz, 2004 1 kayıt (commit)
  7. 21 Mar, 2004 1 kayıt (commit)
  8. 27 Haz, 2003 1 kayıt (commit)
    • Raymond Hettinger's avatar
      SF bug #761337: datetime.strftime fails on trivial format string · f69d9f68
      Raymond Hettinger yazdı
      The interning of short strings violates the refcnt==1 assumption for
      _PyString_Resize().
      
      A simple fix is to boost the initial value of "totalnew" by 1.
      Combined with an NULL argument to PyString_FromStringAndSize(),
      this assures that resulting format string is not interned.
      This will remain true even if the implementation of
      PyString_FromStringAndSize() changes because only the uninitialized
      strings that can be interned are those of zero length.
      
      Added a test case.
      f69d9f68
  9. 17 May, 2003 3 kayıt (commit)
  10. 14 Nis, 2003 1 kayıt (commit)
  11. 19 Şub, 2003 1 kayıt (commit)
  12. 08 Şub, 2003 1 kayıt (commit)
  13. 07 Şub, 2003 2 kayıt (commit)
    • Tim Peters's avatar
      Comparison for timedelta, time, date and datetime objects: __eq__ and · 07534a60
      Tim Peters yazdı
      __ne__ no longer complain if they don't know how to compare to the other
      thing.  If no meaningful way to compare is known, saying "not equal" is
      sensible.  This allows things like
      
          if adatetime in some_sequence:
      and
          somedict[adatetime] = whatever
      
      to work as expected even if some_sequence contains non-datetime objects,
      or somedict non-datetime keys, because they only call __eq__.
      
      It still complains (raises TypeError) for mixed-type comparisons in
      contexts that require a total ordering, such as list.sort(), use as a
      key in a BTree-based data structure, and cmp().
      07534a60
    • Guido van Rossum's avatar
      Merge the test part of the below checkin to the sandbox and Zope3, so · 275666fd
      Guido van Rossum yazdı
      the tests will remain in sync:
      
      """
      Tres discovered a weird bug when a datetime is pickled, caused by the
      shadowing of __year, __month, __day and the use of proxies.
      
      Here's a quick fix and a quick unit test.  I don't quite understand
      why this wasn't caught by the pickling unit tests.
      """
      275666fd
  14. 06 Şub, 2003 1 kayıt (commit)
  15. 05 Şub, 2003 1 kayıt (commit)
  16. 03 Şub, 2003 1 kayıt (commit)
  17. 01 Şub, 2003 1 kayıt (commit)
  18. 31 Ock, 2003 1 kayıt (commit)
  19. 30 Ock, 2003 1 kayıt (commit)
  20. 24 Ock, 2003 1 kayıt (commit)
    • Tim Peters's avatar
      date and datetime comparison: when we don't know how to · 8d81a012
      Tim Peters yazdı
      compare against "the other" argument, we raise TypeError,
      in order to prevent comparison from falling back to the
      default (and worse than useless, in this case) comparison
      by object address.
      
      That's fine so far as it goes, but leaves no way for
      another date/datetime object to make itself comparable
      to our objects.  For example, it leaves Marc-Andre no way
      to teach mxDateTime dates how to compare against Python
      dates.
      
      Discussion on Python-Dev raised a number of impractical
      ideas, and the simple one implemented here:  when we don't
      know how to compare against "the other" argument, we raise
      TypeError *unless* the other object has a timetuple attr.
      In that case, we return NotImplemented instead, and Python
      will give the other object a shot at handling the
      comparison then.
      
      Note that comparisons of time and timedelta objects still
      suffer the original problem, though.
      8d81a012
  21. 23 Ock, 2003 3 kayıt (commit)
    • Tim Peters's avatar
      SF bug 660872: datetimetz constructors behave counterintuitively (2.3a1). · 2a44a8d3
      Tim Peters yazdı
      This gives much the same treatment to datetime.fromtimestamp(stamp, tz) as
      the last batch of checkins gave to datetime.now(tz):  do "the obvious"
      thing with the tz argument instead of a senseless thing.
      2a44a8d3
    • Tim Peters's avatar
      Reimplemented datetime.now() to be useful. · 10cadce4
      Tim Peters yazdı
      10cadce4
    • Tim Peters's avatar
      Bringing the code and test suite into line with doc and NEWS changes · 52dcce24
      Tim Peters yazdı
      checked in two days agao:
      
      Refactoring of, and new rules for, dt.astimezone(tz).
      
      dt must be aware now, and tz.utcoffset() and tz.dst() must not return None.
      The old dt.astimezone(None) no longer works to change an aware datetime
      into a naive datetime; use dt.replace(tzinfo=None) instead.
      
      The tzinfo base class now supplies a new fromutc(self, dt) method, and
      datetime.astimezone(tz) invokes tz.fromutc().  The default implementation
      of fromutc() reproduces the same results as the old astimezone()
      implementation, but tzinfo subclasses can override fromutc() if the
      default implementation isn't strong enough to get the correct results
      in all cases (for example, this may be necessary if a tzinfo subclass
      models a time zone whose "standard offset" (wrt UTC) changed in some
      year(s), or in some variations of double-daylight time -- the creativity
      of time zone politics can't be captured in a single default implementation).
      52dcce24
  22. 20 Ock, 2003 1 kayıt (commit)
    • Tim Peters's avatar
      New rule for tzinfo subclasses handling both standard and daylight time: · 327098a6
      Tim Peters yazdı
      When daylight time ends, an hour repeats on the local clock (for example,
      in US Eastern, the clock jumps from 1:59 back to 1:00 again).  Times in
      the repeated hour are ambiguous.  A tzinfo subclass that wants to play
      with astimezone() needs to treat times in the repeated hour as being
      standard time.  astimezone() previously required that such times be
      treated as daylight time.  There seems no killer argument either way,
      but Guido wants the standard-time version, and it does seem easier the
      new way to code both American (local-time based) and European (UTC-based)
      switch rules, and the astimezone() implementation is simpler.
      327098a6
  23. 11 Ock, 2003 1 kayıt (commit)
  24. 10 Ock, 2003 1 kayıt (commit)
  25. 08 Ock, 2003 1 kayıt (commit)
    • Tim Peters's avatar
      Utterly minimal changes to collapse datetimetz into datetime, and timetz · 0bf60bd6
      Tim Peters yazdı
      into time.  This is little more than *exporting* the datetimetz object
      under the name "datetime", and similarly for timetz.  A good implementation
      of this change requires more work, but this is fully functional if you
      don't stare too hard at the internals (e.g., right now a type named
      "datetime" shows up as a base class of the type named "datetime").  The
      docs also need extensive revision, not part of this checkin.
      0bf60bd6
  26. 04 Ock, 2003 1 kayıt (commit)
  27. 02 Ock, 2003 2 kayıt (commit)
  28. 01 Ock, 2003 2 kayıt (commit)
    • Tim Peters's avatar
      A quicker astimezone() implementation, rehabilitating an earlier · f3615155
      Tim Peters yazdı
      suggestion from Guido, along with a formal correctness proof of the
      trickiest bit.  The intricacy of the proof reveals how delicate this
      is, but also how robust the conclusion:  correctness doesn't rely on
      dst() returning +- one hour (not all real time zones do!), it only
      relies on:
      
      1. That dst() returns a (any) non-zero value if and only if daylight
         time is in effect.
      
      and
      
      2. That the tzinfo subclass implements a consistent notion of time zone.
      
      The meaning of "consistent" was a hidden assumption, which is now an
      explicit requirement in the docs.  Alas, it's an unverifiable (by the
      datetime implementation) requirement, but so it goes.
      f3615155
    • Tim Peters's avatar
      The failure of the last-second addition to the timezone coversion test is · 36087edc
      Tim Peters yazdı
      understood now:  it can't work.  Added comments explaining why (it's "the
      usual"-- unrepresentable hours in local time --but in a slightly different
      guise).
      36087edc
  29. 31 Ara, 2002 1 kayıt (commit)
    • Tim Peters's avatar
      A new, and much hairier, implementation of astimezone(), building on · 521fc15e
      Tim Peters yazdı
      an idea from Guido.  This restores that the datetime implementation
      never passes a datetime d to a tzinfo method unless d.tzinfo is the
      tzinfo instance whose method is being called.  That in turn allows
      enormous simplifications in user-written tzinfo classes (see the Python
      sandbox US.py and EU.py for fully fleshed-out examples).
      
      d.astimezone(tz) also raises ValueError now if d lands in the one hour
      of the year that can't be expressed in tz (this can happen iff tz models
      both standard and daylight time).  That it used to return a nonsense
      result always ate at me, and it turned out that it seemed impossible to
      force a consistent nonsense result under the new implementation (which
      doesn't know anything about how tzinfo classes implement their methods --
      it can only infer properties indirectly).  Guido doesn't like this --
      expect it to change.
      
      New tests of conversion between adjacent DST-aware timezones don't pass
      yet, and are commented out.
      
      Running the datetime tests in a loop under a debug build leaks 9
      references per test run, but I don't believe the datetime code is the
      cause (it didn't leak the last time I changed the C code, and the leak
      is the same if I disable all the tests that invoke the only function
      that changed here).  I'll pursue that next.
      521fc15e
  30. 30 Ara, 2002 3 kayıt (commit)
  31. 29 Ara, 2002 1 kayıt (commit)