Steps to replicate the issue (include links if applicable):
>>> from pywikibot import Timestamp >>> ts = Timestamp.now() >>> ts
What happens?:
Timestamp(2022, 12, 24, 10, 49, 6, 958707) is given for CPython but pywikibot.time.Timestamp(2022, 12, 24, 10, 49, 6, 958707) for Pypy.
https://github.com/wikimedia/pywikibot/actions/runs/3768283603/jobs/6406590317
Timestamp inherits from datetime.datetime. The repr of datetime is definded as:
def __repr__(self): """Convert to formal string, for repr().""" L = [self._year, self._month, self._day, # These are never zero self._hour, self._minute, self._second, self._microsecond] if L[-1] == 0: del L[-1] if L[-1] == 0: del L[-1] s = "%s.%s(%s)" % (self.__class__.__module__, self.__class__.__qualname__, ", ".join(map(str, L))) if self._tzinfo is not None: assert s[-1:] == ")" s = s[:-1] + ", tzinfo=%r" % self._tzinfo + ")" if self._fold: assert s[-1:] == ")" s = s[:-1] + ", fold=1)" return s
but obviously only pypy takes this into account. Neither datetime.repr nor Timestamp.repr calls it because the datetime implementation is overridden by _datetime:
try: from _datetime import * except ImportError: pass
I guess this is a C-implementation.
What should have happened instead?:
The result should be unique.
Software version (skip for WMF-hosted wikis like Wikipedia):
Tested with CPython 3.6-3.12 and Pypy 3.7