{"action":"closed","number":1536,"pull_request":{"url":"https://api.github.com/repos/pypa/pipenv/pulls/1536","id":172674102,"html_url":"https://github.com/pypa/pipenv/pull/1536","diff_url":"https://github.com/pypa/pipenv/pull/1536.diff","patch_url":"https://github.com/pypa/pipenv/pull/1536.patch","issue_url":"https://api.github.com/repos/pypa/pipenv/issues/1536","number":1536,"state":"closed","locked":false,"title":"Fix __delitem__ in prettytoml’s table element","user":{"login":"uranusjr","id":605277,"avatar_url":"https://avatars1.githubusercontent.com/u/605277?v=4","gravatar_id":"","url":"https://api.github.com/users/uranusjr","html_url":"https://github.com/uranusjr","followers_url":"https://api.github.com/users/uranusjr/followers","following_url":"https://api.github.com/users/uranusjr/following{/other_user}","gists_url":"https://api.github.com/users/uranusjr/gists{/gist_id}","starred_url":"https://api.github.com/users/uranusjr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uranusjr/subscriptions","organizations_url":"https://api.github.com/users/uranusjr/orgs","repos_url":"https://api.github.com/users/uranusjr/repos","events_url":"https://api.github.com/users/uranusjr/events{/privacy}","received_events_url":"https://api.github.com/users/uranusjr/received_events","type":"User","site_admin":false},"body":"Two bugs involved here.\r\n\r\nFirst of all, `__delitem__` uses `_find_following_newline` to find where the line to delete ends, which in turns looks for the next closest newline element. But if the previous line ends with a comment element (which implies a newline), it will also be deleted. This would be a problem if the comment is inline.\r\n\r\n```\r\nfoo=1  # comment\r\nbar=2\r\n```\r\n\r\nIn this minimal example, the elements in play are\r\n\r\n```python\r\nAtomicElement('foo')\r\nPunctuationElement('=')\r\nAtomicElement(1)\r\nWhitespaceElement('  ')\r\nCommentElement('# comment')\r\nAtomicElement('bar')\r\nPunctuationElement('=')\r\nAtomicElement(2)\r\n```\r\n\r\nWhen deleting `foo`, it starts from `AtomicElement('foo')` and looks for the next newline, but does not consider `CommentElement`, ending up deleting all elements. This fix replaces `_find_following_newline` with `_find_following_line_terminator`, which does consider both newline and comment.\r\n\r\nAlso there is a logic error in _find_following_line_terminator that prevents it from even working. The two -inf/inf clauses should serve as guards when either or both indexes are infinity, but they were flip-flopped and not working at all. This change doesn't seem to affect existing tests (at least not breaking them more than they already were).","created_at":"2018-03-03T16:09:59Z","updated_at":"2018-03-03T16:34:27Z","closed_at":"2018-03-03T16:34:27Z","merged_at":"2018-03-03T16:34:26Z","merge_commit_sha":"f9f59c96fbd0294a72d9768cb2dc4532c38ddbb8","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/pypa/pipenv/pulls/1536/commits","review_comments_url":"https://api.github.com/repos/pypa/pipenv/pulls/1536/comments","review_comment_url":"https://api.github.com/repos/pypa/pipenv/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pypa/pipenv/issues/1536/comments","statuses_url":"https://api.github.com/repos/pypa/pipenv/statuses/b411d20bd185b9c8e3c8300977d6ead422276ccb","head":{"label":"uranusjr:fix-prettytoml-del","ref":"fix-prettytoml-del","sha":"b411d20bd185b9c8e3c8300977d6ead422276ccb","user":{"login":"uranusjr","id":605277,"avatar_url":"https://avatars1.githubusercontent.com/u/605277?v=4","gravatar_id":"","url":"https://api.github.com/users/uranusjr","html_url":"https://github.com/uranusjr","followers_url":"https://api.github.com/users/uranusjr/followers","following_url":"https://api.github.com/users/uranusjr/following{/other_user}","gists_url":"https://api.github.com/users/uranusjr/gists{/gist_id}","starred_url":"https://api.github.com/users/uranusjr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uranusjr/subscriptions","organizations_url":"https://api.github.com/users/uranusjr/orgs","repos_url":"https://api.github.com/users/uranusjr/repos","events_url":"https://api.github.com/users/uranusjr/events{/privacy}","received_events_url":"https://api.github.com/users/uranusjr/received_events","type":"User","site_admin":false},"repo":{"id":79778897,"name":"pipenv","full_name":"uranusjr/pipenv","owner":{"login":"uranusjr","id":605277,"avatar_url":"https://avatars1.githubusercontent.com/u/605277?v=4","gravatar_id":"","url":"https://api.github.com/users/uranusjr","html_url":"https://github.com/uranusjr","followers_url":"https://api.github.com/users/uranusjr/followers","following_url":"https://api.github.com/users/uranusjr/following{/other_user}","gists_url":"https://api.github.com/users/uranusjr/gists{/gist_id}","starred_url":"https://api.github.com/users/uranusjr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uranusjr/subscriptions","organizations_url":"https://api.github.com/users/uranusjr/orgs","repos_url":"https://api.github.com/users/uranusjr/repos","events_url":"https://api.github.com/users/uranusjr/events{/privacy}","received_events_url":"https://api.github.com/users/uranusjr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/uranusjr/pipenv","description":"Sacred Marriage of Pipfile, Pip, & Virtualenv.","fork":true,"url":"https://api.github.com/repos/uranusjr/pipenv","forks_url":"https://api.github.com/repos/uranusjr/pipenv/forks","keys_url":"https://api.github.com/repos/uranusjr/pipenv/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uranusjr/pipenv/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uranusjr/pipenv/teams","hooks_url":"https://api.github.com/repos/uranusjr/pipenv/hooks","issue_events_url":"https://api.github.com/repos/uranusjr/pipenv/issues/events{/number}","events_url":"https://api.github.com/repos/uranusjr/pipenv/events","assignees_url":"https://api.github.com/repos/uranusjr/pipenv/assignees{/user}","branches_url":"https://api.github.com/repos/uranusjr/pipenv/branches{/branch}","tags_url":"https://api.github.com/repos/uranusjr/pipenv/tags","blobs_url":"https://api.github.com/repos/uranusjr/pipenv/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uranusjr/pipenv/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uranusjr/pipenv/git/refs{/sha}","trees_url":"https://api.github.com/repos/uranusjr/pipenv/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uranusjr/pipenv/statuses/{sha}","languages_url":"https://api.github.com/repos/uranusjr/pipenv/languages","stargazers_url":"https://api.github.com/repos/uranusjr/pipenv/stargazers","contributors_url":"https://api.github.com/repos/uranusjr/pipenv/contributors","subscribers_url":"https://api.github.com/repos/uranusjr/pipenv/subscribers","subscription_url":"https://api.github.com/repos/uranusjr/pipenv/subscription","commits_url":"https://api.github.com/repos/uranusjr/pipenv/commits{/sha}","git_commits_url":"https://api.github.com/repos/uranusjr/pipenv/git/commits{/sha}","comments_url":"https://api.github.com/repos/uranusjr/pipenv/comments{/number}","issue_comment_url":"https://api.github.com/repos/uranusjr/pipenv/issues/comments{/number}","contents_url":"https://api.github.com/repos/uranusjr/pipenv/contents/{+path}","compare_url":"https://api.github.com/repos/uranusjr/pipenv/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uranusjr/pipenv/merges","archive_url":"https://api.github.com/repos/uranusjr/pipenv/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uranusjr/pipenv/downloads","issues_url":"https://api.github.com/repos/uranusjr/pipenv/issues{/number}","pulls_url":"https://api.github.com/repos/uranusjr/pipenv/pulls{/number}","milestones_url":"https://api.github.com/repos/uranusjr/pipenv/milestones{/number}","notifications_url":"https://api.github.com/repos/uranusjr/pipenv/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uranusjr/pipenv/labels{/name}","releases_url":"https://api.github.com/repos/uranusjr/pipenv/releases{/id}","deployments_url":"https://api.github.com/repos/uranusjr/pipenv/deployments","created_at":"2017-01-23T07:00:53Z","updated_at":"2017-01-23T07:00:54Z","pushed_at":"2018-03-03T16:12:24Z","git_url":"git://github.com/uranusjr/pipenv.git","ssh_url":"git@github.com:uranusjr/pipenv.git","clone_url":"https://github.com/uranusjr/pipenv.git","svn_url":"https://github.com/uranusjr/pipenv","homepage":"https://pypi.org/project/pipenv/","size":14183,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pypa:master","ref":"master","sha":"6bb67a8ab0ff13a6c5a81550968d76657161f145","user":{"login":"pypa","id":647025,"avatar_url":"https://avatars2.githubusercontent.com/u/647025?v=4","gravatar_id":"","url":"https://api.github.com/users/pypa","html_url":"https://github.com/pypa","followers_url":"https://api.github.com/users/pypa/followers","following_url":"https://api.github.com/users/pypa/following{/other_user}","gists_url":"https://api.github.com/users/pypa/gists{/gist_id}","starred_url":"https://api.github.com/users/pypa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pypa/subscriptions","organizations_url":"https://api.github.com/users/pypa/orgs","repos_url":"https://api.github.com/users/pypa/repos","events_url":"https://api.github.com/users/pypa/events{/privacy}","received_events_url":"https://api.github.com/users/pypa/received_events","type":"Organization","site_admin":false},"repo":{"id":79510167,"name":"pipenv","full_name":"pypa/pipenv","owner":{"login":"pypa","id":647025,"avatar_url":"https://avatars2.githubusercontent.com/u/647025?v=4","gravatar_id":"","url":"https://api.github.com/users/pypa","html_url":"https://github.com/pypa","followers_url":"https://api.github.com/users/pypa/followers","following_url":"https://api.github.com/users/pypa/following{/other_user}","gists_url":"https://api.github.com/users/pypa/gists{/gist_id}","starred_url":"https://api.github.com/users/pypa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pypa/subscriptions","organizations_url":"https://api.github.com/users/pypa/orgs","repos_url":"https://api.github.com/users/pypa/repos","events_url":"https://api.github.com/users/pypa/events{/privacy}","received_events_url":"https://api.github.com/users/pypa/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pypa/pipenv","description":" Python Development Workflow for Humans.","fork":false,"url":"https://api.github.com/repos/pypa/pipenv","forks_url":"https://api.github.com/repos/pypa/pipenv/forks","keys_url":"https://api.github.com/repos/pypa/pipenv/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pypa/pipenv/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pypa/pipenv/teams","hooks_url":"https://api.github.com/repos/pypa/pipenv/hooks","issue_events_url":"https://api.github.com/repos/pypa/pipenv/issues/events{/number}","events_url":"https://api.github.com/repos/pypa/pipenv/events","assignees_url":"https://api.github.com/repos/pypa/pipenv/assignees{/user}","branches_url":"https://api.github.com/repos/pypa/pipenv/branches{/branch}","tags_url":"https://api.github.com/repos/pypa/pipenv/tags","blobs_url":"https://api.github.com/repos/pypa/pipenv/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pypa/pipenv/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pypa/pipenv/git/refs{/sha}","trees_url":"https://api.github.com/repos/pypa/pipenv/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pypa/pipenv/statuses/{sha}","languages_url":"https://api.github.com/repos/pypa/pipenv/languages","stargazers_url":"https://api.github.com/repos/pypa/pipenv/stargazers","contributors_url":"https://api.github.com/repos/pypa/pipenv/contributors","subscribers_url":"https://api.github.com/repos/pypa/pipenv/subscribers","subscription_url":"https://api.github.com/repos/pypa/pipenv/subscription","commits_url":"https://api.github.com/repos/pypa/pipenv/commits{/sha}","git_commits_url":"https://api.github.com/repos/pypa/pipenv/git/commits{/sha}","comments_url":"https://api.github.com/repos/pypa/pipenv/comments{/number}","issue_comment_url":"https://api.github.com/repos/pypa/pipenv/issues/comments{/number}","contents_url":"https://api.github.com/repos/pypa/pipenv/contents/{+path}","compare_url":"https://api.github.com/repos/pypa/pipenv/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pypa/pipenv/merges","archive_url":"https://api.github.com/repos/pypa/pipenv/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pypa/pipenv/downloads","issues_url":"https://api.github.com/repos/pypa/pipenv/issues{/number}","pulls_url":"https://api.github.com/repos/pypa/pipenv/pulls{/number}","milestones_url":"https://api.github.com/repos/pypa/pipenv/milestones{/number}","notifications_url":"https://api.github.com/repos/pypa/pipenv/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pypa/pipenv/labels{/name}","releases_url":"https://api.github.com/repos/pypa/pipenv/releases{/id}","deployments_url":"https://api.github.com/repos/pypa/pipenv/deployments","created_at":"2017-01-20T00:44:02Z","updated_at":"2018-03-03T15:40:41Z","pushed_at":"2018-03-03T16:34:26Z","git_url":"git://github.com/pypa/pipenv.git","ssh_url":"git@github.com:pypa/pipenv.git","clone_url":"https://github.com/pypa/pipenv.git","svn_url":"https://github.com/pypa/pipenv","homepage":"https://docs.pipenv.org/","size":14670,"stargazers_count":9107,"watchers_count":9107,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":516,"mirror_url":null,"archived":false,"open_issues_count":28,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":516,"open_issues":28,"watchers":9107,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pypa/pipenv/pulls/1536"},"html":{"href":"https://github.com/pypa/pipenv/pull/1536"},"issue":{"href":"https://api.github.com/repos/pypa/pipenv/issues/1536"},"comments":{"href":"https://api.github.com/repos/pypa/pipenv/issues/1536/comments"},"review_comments":{"href":"https://api.github.com/repos/pypa/pipenv/pulls/1536/comments"},"review_comment":{"href":"https://api.github.com/repos/pypa/pipenv/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pypa/pipenv/pulls/1536/commits"},"statuses":{"href":"https://api.github.com/repos/pypa/pipenv/statuses/b411d20bd185b9c8e3c8300977d6ead422276ccb"}},"author_association":"COLLABORATOR","merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"kennethreitz","id":119893,"avatar_url":"https://avatars2.githubusercontent.com/u/119893?v=4","gravatar_id":"","url":"https://api.github.com/users/kennethreitz","html_url":"https://github.com/kennethreitz","followers_url":"https://api.github.com/users/kennethreitz/followers","following_url":"https://api.github.com/users/kennethreitz/following{/other_user}","gists_url":"https://api.github.com/users/kennethreitz/gists{/gist_id}","starred_url":"https://api.github.com/users/kennethreitz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kennethreitz/subscriptions","organizations_url":"https://api.github.com/users/kennethreitz/orgs","repos_url":"https://api.github.com/users/kennethreitz/repos","events_url":"https://api.github.com/users/kennethreitz/events{/privacy}","received_events_url":"https://api.github.com/users/kennethreitz/received_events","type":"User","site_admin":false},"comments":0,"review_comments":0,"maintainer_can_modify":false,"commits":1,"additions":3,"deletions":3,"changed_files":2}}
{"actor":{"display_login":"kennethreitz"}}