{"action":"created","issue":{"url":"https://api.github.com/repos/kennethreitz/maya/issues/6","repository_url":"https://api.github.com/repos/kennethreitz/maya","labels_url":"https://api.github.com/repos/kennethreitz/maya/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/kennethreitz/maya/issues/6/comments","events_url":"https://api.github.com/repos/kennethreitz/maya/issues/6/events","html_url":"https://github.com/kennethreitz/maya/issues/6","id":196266016,"number":6,"title":"Maya gains an extra second when parsing dates after the year 2243","user":{"login":"alexwlchan","id":301220,"avatar_url":"https://avatars.githubusercontent.com/u/301220?v=3","gravatar_id":"","url":"https://api.github.com/users/alexwlchan","html_url":"https://github.com/alexwlchan","followers_url":"https://api.github.com/users/alexwlchan/followers","following_url":"https://api.github.com/users/alexwlchan/following{/other_user}","gists_url":"https://api.github.com/users/alexwlchan/gists{/gist_id}","starred_url":"https://api.github.com/users/alexwlchan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexwlchan/subscriptions","organizations_url":"https://api.github.com/users/alexwlchan/orgs","repos_url":"https://api.github.com/users/alexwlchan/repos","events_url":"https://api.github.com/users/alexwlchan/events{/privacy}","received_events_url":"https://api.github.com/users/alexwlchan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-12-18T09:10:08Z","updated_at":"2016-12-18T09:38:06Z","closed_at":null,"body":"Consider the following program:\r\n\r\n```python\r\nimport datetime\r\nimport maya\r\n\r\nd = datetime.datetime(2243, 1, 1, 0, 0, 0, 1)\r\nprint(d)\r\nprint(str(d))\r\n\r\nparsed_d = maya.parse(str(d)).datetime()\r\nprint(parsed_d)\r\nprint(str(parsed_d))\r\n\r\nassert d == parsed_d\r\n```\r\n\r\n```\r\n2243-01-01 00:00:00.000001\r\n2243-01-01 00:00:00.000001\r\n2243-01-01 00:00:00.000002+00:00\r\n2243-01-01 00:00:00.000002+00:00\r\nTraceback (most recent call last):\r\n  File \"counterexample.py\", line 15, in <module>\r\n    assert d == parsed_d\r\nAssertionError\r\n```\r\n\r\nThis is a bug introduced somewhere in Maya – I see that Maya is using dateutil for the main machinery of its `parse` function, but if I try this with dateutil everything is fine:\r\n\r\n```python\r\nimport datetime\r\nfrom dateutil import parser\r\n\r\nd = datetime.datetime(2243, 1, 1, 0, 0, 0, 1)\r\nprint(d)\r\nprint(str(d))\r\n\r\nparsed_d = parser.parse(str(d))\r\nprint(parsed_d)\r\nprint(str(parsed_d))\r\n\r\nassert d == parsed_d\r\n```\r\n\r\n```\r\n2243-01-01 00:00:00.000001\r\n2243-01-01 00:00:00.000001\r\n2243-01-01 00:00:00.000001\r\n2243-01-01 00:00:00.000001\r\n```\r\n\r\nEnvironment details:\r\n\r\n```console\r\n$ pip freeze\r\ndateparser==0.5.0\r\nhumanize==0.5.1\r\niso8601==0.1.11\r\njdatetime==1.8.1\r\n-e git+git@github.com:kennethreitz/maya.git@6a4ddff215edbdce4a0f5b8bd5ba87710697b7f9#egg=maya-master\r\npython-dateutil==2.6.0\r\npytz==2016.10\r\nregex==2016.11.21\r\nruamel.yaml==0.13.4\r\nsix==1.10.0\r\ntzlocal==1.3\r\numalqurra==0.2\r\nwheel==0.24.0\r\n```\r\n\r\nI don’t actually care if you fix this (by 2243, I’ll either be dead, or hopefully have better things to do with my time), but having found it, I thought I’d share.\r\n\r\nYes, I know I’m a terrible person for finding this."},"comment":{"url":"https://api.github.com/repos/kennethreitz/maya/issues/comments/267811833","html_url":"https://github.com/kennethreitz/maya/issues/6#issuecomment-267811833","issue_url":"https://api.github.com/repos/kennethreitz/maya/issues/6","id":267811833,"user":{"login":"mithrandi","id":856430,"avatar_url":"https://avatars.githubusercontent.com/u/856430?v=3","gravatar_id":"","url":"https://api.github.com/users/mithrandi","html_url":"https://github.com/mithrandi","followers_url":"https://api.github.com/users/mithrandi/followers","following_url":"https://api.github.com/users/mithrandi/following{/other_user}","gists_url":"https://api.github.com/users/mithrandi/gists{/gist_id}","starred_url":"https://api.github.com/users/mithrandi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mithrandi/subscriptions","organizations_url":"https://api.github.com/users/mithrandi/orgs","repos_url":"https://api.github.com/users/mithrandi/repos","events_url":"https://api.github.com/users/mithrandi/events{/privacy}","received_events_url":"https://api.github.com/users/mithrandi/received_events","type":"User","site_admin":false},"created_at":"2016-12-18T09:38:06Z","updated_at":"2016-12-18T09:38:06Z","body":"For those who care: the bug is caused by the `float` type having insufficient precision to represent the underlying POSIX timestamp correctly. The further away you get from the POSIX epoch (in either direction), the more precision you'll lose in the timestamp."}}
{"actor":{"display_login":"mithrandi"}}