zopefoundation / DateTime

This package provides a DateTime data type, as known from Zope. Unless you need to communicate with Zope APIs, you're probably better off using Python's built-in datetime module.
Other
19 stars 25 forks source link

Fix regression in 4.7 on Python 2 when calling asdatetime. #48

Closed mauritsvanrees closed 1 year ago

mauritsvanrees commented 1 year ago

Fixes https://github.com/zopefoundation/DateTime/issues/47. Note that this PR targets the new branch 4.x. See my comment in that issue.

mauritsvanrees commented 1 year ago

Thanks for the review.

@icemac @dataflake Can we have a release of the 4.x branch please? Then Zope 4.x can use it.

d-maurer commented 1 year ago

Michael Howitz wrote at 2022-12-23 00:24 -0800:

@icemac commented on this pull request.

@@ -680,6 +680,8 @@ def _parse_args(self, *args, **kw):

flag indicating whether this was constructed in a timezone naive

manner

yr, mo, dy, hr, mn, sc, tz, t, d, s, microsecs, tznaive = args

  • if isinstance(microsecs, float):
  • microsecs = long(round(microsecs))

I see NameError: name 'long' is not defined on Python 3. Does this branch only get executed on Python 2? At least a comment would be helpful.

In principle, the code should have a definition long = int for Py3.