{"action":"created","comment":{"url":"https://api.github.com/repos/IronLanguages/ironpython3/pulls/comments/313458495","pull_request_review_id":274361848,"id":313458495,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMxMzQ1ODQ5NQ==","diff_hunk":"@@ -543,6 +552,95 @@ public sealed class MemoryView : ICodeFormattable, IWeakReferenceable {\n             }\n         }\n \n+        public object this[[NotNull]PythonTuple index] {\n+            get {\n+                CheckBuffer();\n+                return getAtFlatIndex(GetFlatIndex(index));\n+            }\n+            set {\n+                CheckBuffer();\n+                setAtFlatIndex(GetFlatIndex(index), value);\n+            }\n+        }\n+\n+        /// <summary>\n+        /// Gets the \"flat\" index from the access of a tuple as if the\n+        /// multidimensional tuple were layed out in contiguous memory.\n+        /// </summary>\n+        private int GetFlatIndex(PythonTuple tuple) {\n+            int flatIndex = 0;\n+            int tupleLength = tuple.Count;\n+            int ndim = (int)this.ndim;\n+            int firstOutOfRangeIndex = -1;\n+\n+            bool sawSlice = false;\n+            bool sawInt = false;\n+\n+            // A few notes about the ordering of operations here:\n+            // 1) CPython checks the types of the objects in the tuple\n+            //    first, then the dimensions, then finally for the range.\n+            //    Because we do a range check while we go through the tuple,\n+            //    we have to remember that we had something out of range\n+            // 2) CPython checks for a multislice tuple, then for all ints,\n+            //    and throws an invalid slice key otherwise. We again try to\n+            //    do this in one pass, so we remember whether we've seen an int\n+            //    and whether we've seen a slice. If we haven't seen both, we\n+            //    it means it's entirely ints or entirely slices\n+            for (int i = 0; i < tupleLength; i++) {\n+                object indexObject = tuple[i];\n+                if (Converter.TryConvertToInt32(indexObject, out int indexValue)) {","path":"Src/IronPython/Runtime/MemoryView.cs","position":76,"original_position":76,"commit_id":"7f748a3a62c10f1fc78d55015e09207db5878a2d","original_commit_id":"7f748a3a62c10f1fc78d55015e09207db5878a2d","user":{"login":"gfmcknight","id":20712970,"node_id":"MDQ6VXNlcjIwNzEyOTcw","avatar_url":"https://avatars3.githubusercontent.com/u/20712970?v=4","gravatar_id":"","url":"https://api.github.com/users/gfmcknight","html_url":"https://github.com/gfmcknight","followers_url":"https://api.github.com/users/gfmcknight/followers","following_url":"https://api.github.com/users/gfmcknight/following{/other_user}","gists_url":"https://api.github.com/users/gfmcknight/gists{/gist_id}","starred_url":"https://api.github.com/users/gfmcknight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gfmcknight/subscriptions","organizations_url":"https://api.github.com/users/gfmcknight/orgs","repos_url":"https://api.github.com/users/gfmcknight/repos","events_url":"https://api.github.com/users/gfmcknight/events{/privacy}","received_events_url":"https://api.github.com/users/gfmcknight/received_events","type":"User","site_admin":false},"body":"The only thing here is if we have a mix of ints and slices we need to throw the invalid slice key, and they wrote tests to explicitly check that","created_at":"2019-08-13T15:19:15Z","updated_at":"2019-08-13T15:19:15Z","html_url":"https://github.com/IronLanguages/ironpython3/pull/636#discussion_r313458495","pull_request_url":"https://api.github.com/repos/IronLanguages/ironpython3/pulls/636","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/IronLanguages/ironpython3/pulls/comments/313458495"},"html":{"href":"https://github.com/IronLanguages/ironpython3/pull/636#discussion_r313458495"},"pull_request":{"href":"https://api.github.com/repos/IronLanguages/ironpython3/pulls/636"}},"in_reply_to_id":313441167},"pull_request":{"url":"https://api.github.com/repos/IronLanguages/ironpython3/pulls/636","id":306335452,"node_id":"MDExOlB1bGxSZXF1ZXN0MzA2MzM1NDUy","html_url":"https://github.com/IronLanguages/ironpython3/pull/636","diff_url":"https://github.com/IronLanguages/ironpython3/pull/636.diff","patch_url":"https://github.com/IronLanguages/ironpython3/pull/636.patch","issue_url":"https://api.github.com/repos/IronLanguages/ironpython3/issues/636","number":636,"state":"open","locked":false,"title":"Allow indexing of memoryviews with a tuple.","user":{"login":"gfmcknight","id":20712970,"node_id":"MDQ6VXNlcjIwNzEyOTcw","avatar_url":"https://avatars3.githubusercontent.com/u/20712970?v=4","gravatar_id":"","url":"https://api.github.com/users/gfmcknight","html_url":"https://github.com/gfmcknight","followers_url":"https://api.github.com/users/gfmcknight/followers","following_url":"https://api.github.com/users/gfmcknight/following{/other_user}","gists_url":"https://api.github.com/users/gfmcknight/gists{/gist_id}","starred_url":"https://api.github.com/users/gfmcknight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gfmcknight/subscriptions","organizations_url":"https://api.github.com/users/gfmcknight/orgs","repos_url":"https://api.github.com/users/gfmcknight/repos","events_url":"https://api.github.com/users/gfmcknight/events{/privacy}","received_events_url":"https://api.github.com/users/gfmcknight/received_events","type":"User","site_admin":false},"body":"","created_at":"2019-08-12T02:30:49Z","updated_at":"2019-08-13T15:19:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e5b9d1c05426e818405b87743b583fbac944e37a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/IronLanguages/ironpython3/pulls/636/commits","review_comments_url":"https://api.github.com/repos/IronLanguages/ironpython3/pulls/636/comments","review_comment_url":"https://api.github.com/repos/IronLanguages/ironpython3/pulls/comments{/number}","comments_url":"https://api.github.com/repos/IronLanguages/ironpython3/issues/636/comments","statuses_url":"https://api.github.com/repos/IronLanguages/ironpython3/statuses/7f748a3a62c10f1fc78d55015e09207db5878a2d","head":{"label":"gfmcknight:scratch/memoryview","ref":"scratch/memoryview","sha":"7f748a3a62c10f1fc78d55015e09207db5878a2d","user":{"login":"gfmcknight","id":20712970,"node_id":"MDQ6VXNlcjIwNzEyOTcw","avatar_url":"https://avatars3.githubusercontent.com/u/20712970?v=4","gravatar_id":"","url":"https://api.github.com/users/gfmcknight","html_url":"https://github.com/gfmcknight","followers_url":"https://api.github.com/users/gfmcknight/followers","following_url":"https://api.github.com/users/gfmcknight/following{/other_user}","gists_url":"https://api.github.com/users/gfmcknight/gists{/gist_id}","starred_url":"https://api.github.com/users/gfmcknight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gfmcknight/subscriptions","organizations_url":"https://api.github.com/users/gfmcknight/orgs","repos_url":"https://api.github.com/users/gfmcknight/repos","events_url":"https://api.github.com/users/gfmcknight/events{/privacy}","received_events_url":"https://api.github.com/users/gfmcknight/received_events","type":"User","site_admin":false},"repo":{"id":155137079,"node_id":"MDEwOlJlcG9zaXRvcnkxNTUxMzcwNzk=","name":"ironpython3","full_name":"gfmcknight/ironpython3","private":false,"owner":{"login":"gfmcknight","id":20712970,"node_id":"MDQ6VXNlcjIwNzEyOTcw","avatar_url":"https://avatars3.githubusercontent.com/u/20712970?v=4","gravatar_id":"","url":"https://api.github.com/users/gfmcknight","html_url":"https://github.com/gfmcknight","followers_url":"https://api.github.com/users/gfmcknight/followers","following_url":"https://api.github.com/users/gfmcknight/following{/other_user}","gists_url":"https://api.github.com/users/gfmcknight/gists{/gist_id}","starred_url":"https://api.github.com/users/gfmcknight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gfmcknight/subscriptions","organizations_url":"https://api.github.com/users/gfmcknight/orgs","repos_url":"https://api.github.com/users/gfmcknight/repos","events_url":"https://api.github.com/users/gfmcknight/events{/privacy}","received_events_url":"https://api.github.com/users/gfmcknight/received_events","type":"User","site_admin":false},"html_url":"https://github.com/gfmcknight/ironpython3","description":"DO NOT USE. Implementation of Python 3.x for .NET Framework that is built on top of the Dynamic Language Runtime.","fork":true,"url":"https://api.github.com/repos/gfmcknight/ironpython3","forks_url":"https://api.github.com/repos/gfmcknight/ironpython3/forks","keys_url":"https://api.github.com/repos/gfmcknight/ironpython3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gfmcknight/ironpython3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gfmcknight/ironpython3/teams","hooks_url":"https://api.github.com/repos/gfmcknight/ironpython3/hooks","issue_events_url":"https://api.github.com/repos/gfmcknight/ironpython3/issues/events{/number}","events_url":"https://api.github.com/repos/gfmcknight/ironpython3/events","assignees_url":"https://api.github.com/repos/gfmcknight/ironpython3/assignees{/user}","branches_url":"https://api.github.com/repos/gfmcknight/ironpython3/branches{/branch}","tags_url":"https://api.github.com/repos/gfmcknight/ironpython3/tags","blobs_url":"https://api.github.com/repos/gfmcknight/ironpython3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gfmcknight/ironpython3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gfmcknight/ironpython3/git/refs{/sha}","trees_url":"https://api.github.com/repos/gfmcknight/ironpython3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gfmcknight/ironpython3/statuses/{sha}","languages_url":"https://api.github.com/repos/gfmcknight/ironpython3/languages","stargazers_url":"https://api.github.com/repos/gfmcknight/ironpython3/stargazers","contributors_url":"https://api.github.com/repos/gfmcknight/ironpython3/contributors","subscribers_url":"https://api.github.com/repos/gfmcknight/ironpython3/subscribers","subscription_url":"https://api.github.com/repos/gfmcknight/ironpython3/subscription","commits_url":"https://api.github.com/repos/gfmcknight/ironpython3/commits{/sha}","git_commits_url":"https://api.github.com/repos/gfmcknight/ironpython3/git/commits{/sha}","comments_url":"https://api.github.com/repos/gfmcknight/ironpython3/comments{/number}","issue_comment_url":"https://api.github.com/repos/gfmcknight/ironpython3/issues/comments{/number}","contents_url":"https://api.github.com/repos/gfmcknight/ironpython3/contents/{+path}","compare_url":"https://api.github.com/repos/gfmcknight/ironpython3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gfmcknight/ironpython3/merges","archive_url":"https://api.github.com/repos/gfmcknight/ironpython3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gfmcknight/ironpython3/downloads","issues_url":"https://api.github.com/repos/gfmcknight/ironpython3/issues{/number}","pulls_url":"https://api.github.com/repos/gfmcknight/ironpython3/pulls{/number}","milestones_url":"https://api.github.com/repos/gfmcknight/ironpython3/milestones{/number}","notifications_url":"https://api.github.com/repos/gfmcknight/ironpython3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gfmcknight/ironpython3/labels{/name}","releases_url":"https://api.github.com/repos/gfmcknight/ironpython3/releases{/id}","deployments_url":"https://api.github.com/repos/gfmcknight/ironpython3/deployments","created_at":"2018-10-29T01:59:39Z","updated_at":"2019-08-03T04:04:50Z","pushed_at":"2019-08-13T07:37:23Z","git_url":"git://github.com/gfmcknight/ironpython3.git","ssh_url":"git@github.com:gfmcknight/ironpython3.git","clone_url":"https://github.com/gfmcknight/ironpython3.git","svn_url":"https://github.com/gfmcknight/ironpython3","homepage":"","size":52494,"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,"disabled":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"IronLanguages:master","ref":"master","sha":"198b6ad2910f1c23d39b1ad6b693c88936cfa8cf","user":{"login":"IronLanguages","id":18199,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE4MTk5","avatar_url":"https://avatars1.githubusercontent.com/u/18199?v=4","gravatar_id":"","url":"https://api.github.com/users/IronLanguages","html_url":"https://github.com/IronLanguages","followers_url":"https://api.github.com/users/IronLanguages/followers","following_url":"https://api.github.com/users/IronLanguages/following{/other_user}","gists_url":"https://api.github.com/users/IronLanguages/gists{/gist_id}","starred_url":"https://api.github.com/users/IronLanguages/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IronLanguages/subscriptions","organizations_url":"https://api.github.com/users/IronLanguages/orgs","repos_url":"https://api.github.com/users/IronLanguages/repos","events_url":"https://api.github.com/users/IronLanguages/events{/privacy}","received_events_url":"https://api.github.com/users/IronLanguages/received_events","type":"Organization","site_admin":false},"repo":{"id":17266066,"node_id":"MDEwOlJlcG9zaXRvcnkxNzI2NjA2Ng==","name":"ironpython3","full_name":"IronLanguages/ironpython3","private":false,"owner":{"login":"IronLanguages","id":18199,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE4MTk5","avatar_url":"https://avatars1.githubusercontent.com/u/18199?v=4","gravatar_id":"","url":"https://api.github.com/users/IronLanguages","html_url":"https://github.com/IronLanguages","followers_url":"https://api.github.com/users/IronLanguages/followers","following_url":"https://api.github.com/users/IronLanguages/following{/other_user}","gists_url":"https://api.github.com/users/IronLanguages/gists{/gist_id}","starred_url":"https://api.github.com/users/IronLanguages/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IronLanguages/subscriptions","organizations_url":"https://api.github.com/users/IronLanguages/orgs","repos_url":"https://api.github.com/users/IronLanguages/repos","events_url":"https://api.github.com/users/IronLanguages/events{/privacy}","received_events_url":"https://api.github.com/users/IronLanguages/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/IronLanguages/ironpython3","description":"DO NOT USE. Implementation of Python 3.x for .NET Framework that is built on top of the Dynamic Language Runtime.","fork":false,"url":"https://api.github.com/repos/IronLanguages/ironpython3","forks_url":"https://api.github.com/repos/IronLanguages/ironpython3/forks","keys_url":"https://api.github.com/repos/IronLanguages/ironpython3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/IronLanguages/ironpython3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/IronLanguages/ironpython3/teams","hooks_url":"https://api.github.com/repos/IronLanguages/ironpython3/hooks","issue_events_url":"https://api.github.com/repos/IronLanguages/ironpython3/issues/events{/number}","events_url":"https://api.github.com/repos/IronLanguages/ironpython3/events","assignees_url":"https://api.github.com/repos/IronLanguages/ironpython3/assignees{/user}","branches_url":"https://api.github.com/repos/IronLanguages/ironpython3/branches{/branch}","tags_url":"https://api.github.com/repos/IronLanguages/ironpython3/tags","blobs_url":"https://api.github.com/repos/IronLanguages/ironpython3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/IronLanguages/ironpython3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/IronLanguages/ironpython3/git/refs{/sha}","trees_url":"https://api.github.com/repos/IronLanguages/ironpython3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/IronLanguages/ironpython3/statuses/{sha}","languages_url":"https://api.github.com/repos/IronLanguages/ironpython3/languages","stargazers_url":"https://api.github.com/repos/IronLanguages/ironpython3/stargazers","contributors_url":"https://api.github.com/repos/IronLanguages/ironpython3/contributors","subscribers_url":"https://api.github.com/repos/IronLanguages/ironpython3/subscribers","subscription_url":"https://api.github.com/repos/IronLanguages/ironpython3/subscription","commits_url":"https://api.github.com/repos/IronLanguages/ironpython3/commits{/sha}","git_commits_url":"https://api.github.com/repos/IronLanguages/ironpython3/git/commits{/sha}","comments_url":"https://api.github.com/repos/IronLanguages/ironpython3/comments{/number}","issue_comment_url":"https://api.github.com/repos/IronLanguages/ironpython3/issues/comments{/number}","contents_url":"https://api.github.com/repos/IronLanguages/ironpython3/contents/{+path}","compare_url":"https://api.github.com/repos/IronLanguages/ironpython3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/IronLanguages/ironpython3/merges","archive_url":"https://api.github.com/repos/IronLanguages/ironpython3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/IronLanguages/ironpython3/downloads","issues_url":"https://api.github.com/repos/IronLanguages/ironpython3/issues{/number}","pulls_url":"https://api.github.com/repos/IronLanguages/ironpython3/pulls{/number}","milestones_url":"https://api.github.com/repos/IronLanguages/ironpython3/milestones{/number}","notifications_url":"https://api.github.com/repos/IronLanguages/ironpython3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/IronLanguages/ironpython3/labels{/name}","releases_url":"https://api.github.com/repos/IronLanguages/ironpython3/releases{/id}","deployments_url":"https://api.github.com/repos/IronLanguages/ironpython3/deployments","created_at":"2014-02-27T21:50:49Z","updated_at":"2019-08-13T12:14:18Z","pushed_at":"2019-08-13T07:37:24Z","git_url":"git://github.com/IronLanguages/ironpython3.git","ssh_url":"git@github.com:IronLanguages/ironpython3.git","clone_url":"https://github.com/IronLanguages/ironpython3.git","svn_url":"https://github.com/IronLanguages/ironpython3","homepage":"","size":52313,"stargazers_count":942,"watchers_count":942,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":119,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":91,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":119,"open_issues":91,"watchers":942,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/IronLanguages/ironpython3/pulls/636"},"html":{"href":"https://github.com/IronLanguages/ironpython3/pull/636"},"issue":{"href":"https://api.github.com/repos/IronLanguages/ironpython3/issues/636"},"comments":{"href":"https://api.github.com/repos/IronLanguages/ironpython3/issues/636/comments"},"review_comments":{"href":"https://api.github.com/repos/IronLanguages/ironpython3/pulls/636/comments"},"review_comment":{"href":"https://api.github.com/repos/IronLanguages/ironpython3/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/IronLanguages/ironpython3/pulls/636/commits"},"statuses":{"href":"https://api.github.com/repos/IronLanguages/ironpython3/statuses/7f748a3a62c10f1fc78d55015e09207db5878a2d"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"gfmcknight"}}