Steps to replicate the issue (include links if applicable):
site = pywikibot.Site("wikidata", "wikidata") item = pywikibot.ItemPage(site, "Q4115189") claim = pywikibot.Claim(site, "P580") claim.setTarget(pywikibot.WbTime(year=2022, hour=5, precision=11)) item.addClaim(claim)
What happens?:
WARNING: API error modification-failed: Malformed input: +2022-01-01T05:00:00Z --------------------------------------------------------------------------- APIError Traceback (most recent call last) File /srv/paws/pwb/pywikibot/page/_decorators.py:34, in _allow_asynchronous.<locals>.handle(func, self, *args, **kwargs) 33 try: ---> 34 func(self, *args, **kwargs) 35 # TODO: other "expected" error types to catch? File /srv/paws/pwb/pywikibot/page/_wikibase.py:740, in WikibasePage.addClaim(self, claim, bot, **kwargs) 738 raise ValueError( 739 'The provided Claim instance is already used in an entity') --> 740 self.repo.addClaim(self, claim, bot=bot, **kwargs) 741 claim.on_item = self File /srv/paws/pwb/pywikibot/site/_decorators.py:92, in need_right.<locals>.decorator.<locals>.callee(self, *args, **kwargs) 89 raise UserRightsError('User "{}" does not have required ' 90 'user right "{}"' 91 .format(self.user(), right)) ---> 92 return fn(self, *args, **kwargs) File /srv/paws/pwb/pywikibot/site/_datasite.py:324, in DataSite.addClaim(self, entity, claim, bot, summary) 323 req = self.simple_request(**params) --> 324 data = req.submit() 325 # Update the item File /srv/paws/pwb/pywikibot/data/api/_requests.py:1108, in Request.submit(self) 1106 pywikibot.log(' response=\n{}'.format(result)) -> 1108 raise pywikibot.exceptions.APIError(**error) 1109 except TypeError: APIError: modification-failed: Malformed input: +2022-01-01T05:00:00Z [messages: [{'name': 'wikibase-validator-malformed-value', 'parameters': ['+2022-01-01T05:00:00Z'], 'html': {'*': 'Malformed input: +2022-01-01T05:00:00Z'}}]; servedby: mw1402; help: See https://www.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/> for notice of API deprecations and breaking changes.] During handling of the above exception, another exception occurred: OtherPageSaveError Traceback (most recent call last) Cell In[24], line 1 ----> 1 item.addClaim(claim) File /srv/paws/pwb/pywikibot/page/_decorators.py:55, in _allow_asynchronous.<locals>.wrapper(self, *args, **kwargs) 53 pywikibot.async_request(handle, func, self, *args, **kwargs) 54 else: ---> 55 handle(func, self, *args, **kwargs) File /srv/paws/pwb/pywikibot/page/_decorators.py:47, in _allow_asynchronous.<locals>.handle(func, self, *args, **kwargs) 45 if isinstance(err, PageSaveRelatedError): 46 raise err ---> 47 raise OtherPageSaveError(self, err) 48 if callback: 49 callback(self, err) OtherPageSaveError: Edit to page [[wikidata:Q4115189]] failed: modification-failed: Malformed input: +2022-01-01T05:00:00Z [messages: [{'name': 'wikibase-validator-malformed-value', 'parameters': ['+2022-01-01T05:00:00Z'], 'html': {'*': 'Malformed input: +2022-01-01T05:00:00Z'}}]; servedby: mw1402; help: See https://www.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/> for notice of API deprecations and breaking changes.]
What should have happened instead?: The time should be accepted.
Software version (skip for WMF-hosted wikis like Wikipedia):
Other information (browser name/version, screenshots, etc.): This makes making a WbTime via fromTimestamp() impossible because it copies everything including hours, minutes and seconds even when a precision of day or lower is given.