Skip to content

Commit

Permalink
Aim for consistent repr of timestamp between C and Python impl.
Browse files Browse the repository at this point in the history
  • Loading branch information
tseaver committed Dec 14, 2012
1 parent bbdaeeb commit db732a8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions persistent/tests/test_timestamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,9 @@ def test_laterThan_self_is_later(self):

def test_repr(self):
from persistent.timestamp import _makeOctets
from persistent._compat import _native
SERIAL = _makeOctets('\x01' * 8)
ts = self._makeOne(SERIAL)
self.assertEqual(repr(ts), _native(SERIAL))
self.assertEqual(repr(ts), repr(SERIAL))

class TimeStampTests(pyTimeStampTests):

Expand Down
2 changes: 1 addition & 1 deletion persistent/timestamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def raw(self):
return self._raw

def __repr__(self):
return _native(self._raw)
return repr(self._raw)

def year(self):
return self._elements[0]
Expand Down

5 comments on commit db732a8

@do3cc
Copy link
Member

@do3cc do3cc commented on db732a8 Nov 27, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this introduced a bug, or maybe the c version was not got already.
self._raw already is a string. So repr(self._raw) returns a double quoted string.
I stumbled over this in plone, my comment on it has a traceback that ends with
ValueError: _p_serial must be an 8-character bytes array

ploneintranet/ploneintranet.todo@7f215f6#commitcomment-8752965

What do you think?

@do3cc
Copy link
Member

@do3cc do3cc commented on db732a8 Nov 27, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using persistent 4.0.3 which does not contain this change, solves the problem for me.

@mgedmin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@do3cc, can you file a bug so this doesn't get lost in commit comments?

@do3cc
Copy link
Member

@do3cc do3cc commented on db732a8 Nov 27, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it is: #12

@mgedmin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Please sign in to comment.