{"action":"created","comment":{"url":"https://api.github.com/repos/ros2/rclpy/pulls/comments/205917133","pull_request_review_id":141290193,"id":205917133,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNTkxNzEzMw==","diff_hunk":"@@ -2046,6 +2041,20 @@ rclpy_destroy_node_entity(PyObject * Py_UNUSED(self), PyObject * args)\n   Py_RETURN_NONE;\n }\n \n+/// Destructor for a clock\n+void\n+_rclpy_destroy_clock(PyObject * pycapsule)\n+{\n+  rcl_clock_t * clock = (rcl_clock_t *)PyCapsule_GetPointer(pycapsule, \"rcl_clock_t\");","path":"rclpy/src/rclpy/_rclpy.c","position":62,"original_position":62,"commit_id":"d4c43c63ecedb30ffe6de7888f13c14f99a7533e","original_commit_id":"d6bcef83cb053fcb1f988b1a7e75c49251193793","user":{"login":"sloretz","id":4175662,"node_id":"MDQ6VXNlcjQxNzU2NjI=","avatar_url":"https://avatars1.githubusercontent.com/u/4175662?v=4","gravatar_id":"","url":"https://api.github.com/users/sloretz","html_url":"https://github.com/sloretz","followers_url":"https://api.github.com/users/sloretz/followers","following_url":"https://api.github.com/users/sloretz/following{/other_user}","gists_url":"https://api.github.com/users/sloretz/gists{/gist_id}","starred_url":"https://api.github.com/users/sloretz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sloretz/subscriptions","organizations_url":"https://api.github.com/users/sloretz/orgs","repos_url":"https://api.github.com/users/sloretz/repos","events_url":"https://api.github.com/users/sloretz/events{/privacy}","received_events_url":"https://api.github.com/users/sloretz/received_events","type":"User","site_admin":false},"body":"> How is this early return different from the case where clock is not null and correctly finalized?\r\n\r\nIf `PyCapsule_GetPointer()` returns `NULL` then it raised an exception. If the clock is correctly finalized then no exception is raised.\r\n\r\n>  If clock is NULL that means a wrong parameter was passed\r\n\r\nI don't see a way to pass a wrong parameter to this function at the moment. It shouldn't get the wrong type of pointer when using it as a capsule destructor.\r\n\r\nhttps://github.com/ros2/rclpy/blob/5ed7ca2755ad8dbee293858f50f2a2707342624d/rclpy/src/rclpy/_rclpy.c#L3184\r\n\r\nAnd the new call in this PR calls `PyCapsule_IsValid()` first. `PyCapsule_GetPointer()` is guaranteed not to return `NULL` if that passes.","created_at":"2018-07-27T22:52:42Z","updated_at":"2018-07-27T22:52:42Z","html_url":"https://github.com/ros2/rclpy/pull/212#discussion_r205917133","pull_request_url":"https://api.github.com/repos/ros2/rclpy/pulls/212","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/ros2/rclpy/pulls/comments/205917133"},"html":{"href":"https://github.com/ros2/rclpy/pull/212#discussion_r205917133"},"pull_request":{"href":"https://api.github.com/repos/ros2/rclpy/pulls/212"}},"in_reply_to_id":205896856},"pull_request":{"url":"https://api.github.com/repos/ros2/rclpy/pulls/212","id":204510093,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA0NTEwMDkz","html_url":"https://github.com/ros2/rclpy/pull/212","diff_url":"https://github.com/ros2/rclpy/pull/212.diff","patch_url":"https://github.com/ros2/rclpy/pull/212.patch","issue_url":"https://api.github.com/repos/ros2/rclpy/issues/212","number":212,"state":"open","locked":false,"title":"Alternative way of giving timers a clock","user":{"login":"sloretz","id":4175662,"node_id":"MDQ6VXNlcjQxNzU2NjI=","avatar_url":"https://avatars1.githubusercontent.com/u/4175662?v=4","gravatar_id":"","url":"https://api.github.com/users/sloretz","html_url":"https://github.com/sloretz","followers_url":"https://api.github.com/users/sloretz/followers","following_url":"https://api.github.com/users/sloretz/following{/other_user}","gists_url":"https://api.github.com/users/sloretz/gists{/gist_id}","starred_url":"https://api.github.com/users/sloretz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sloretz/subscriptions","organizations_url":"https://api.github.com/users/sloretz/orgs","repos_url":"https://api.github.com/users/sloretz/repos","events_url":"https://api.github.com/users/sloretz/events{/privacy}","received_events_url":"https://api.github.com/users/sloretz/received_events","type":"User","site_admin":false},"body":"I was having trouble putting feedback for ros2/rclpy#211 into words. This passes the clock into `rclpy_create_timer()` instead of it being returned in an unused variable, and makes use of the cleanup code in `_rclpy_destroy_clock()`.","created_at":"2018-07-27T18:43:13Z","updated_at":"2018-07-27T22:52:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e3eb962eeef83f5c47ec39df3a3183ee58b46cd5","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":324944590,"node_id":"MDU6TGFiZWwzMjQ5NDQ1OTA=","url":"https://api.github.com/repos/ros2/rclpy/labels/in%20review","name":"in review","color":"388be2","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ros2/rclpy/pulls/212/commits","review_comments_url":"https://api.github.com/repos/ros2/rclpy/pulls/212/comments","review_comment_url":"https://api.github.com/repos/ros2/rclpy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ros2/rclpy/issues/212/comments","statuses_url":"https://api.github.com/repos/ros2/rclpy/statuses/d4c43c63ecedb30ffe6de7888f13c14f99a7533e","head":{"label":"ros2:timer-with-clock-alternative","ref":"timer-with-clock-alternative","sha":"d4c43c63ecedb30ffe6de7888f13c14f99a7533e","user":{"login":"ros2","id":3979232,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5NzkyMzI=","avatar_url":"https://avatars1.githubusercontent.com/u/3979232?v=4","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"repo":{"id":46515609,"node_id":"MDEwOlJlcG9zaXRvcnk0NjUxNTYwOQ==","name":"rclpy","full_name":"ros2/rclpy","owner":{"login":"ros2","id":3979232,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5NzkyMzI=","avatar_url":"https://avatars1.githubusercontent.com/u/3979232?v=4","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ros2/rclpy","description":"rclpy (ROS Client Library for Python)","fork":false,"url":"https://api.github.com/repos/ros2/rclpy","forks_url":"https://api.github.com/repos/ros2/rclpy/forks","keys_url":"https://api.github.com/repos/ros2/rclpy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ros2/rclpy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ros2/rclpy/teams","hooks_url":"https://api.github.com/repos/ros2/rclpy/hooks","issue_events_url":"https://api.github.com/repos/ros2/rclpy/issues/events{/number}","events_url":"https://api.github.com/repos/ros2/rclpy/events","assignees_url":"https://api.github.com/repos/ros2/rclpy/assignees{/user}","branches_url":"https://api.github.com/repos/ros2/rclpy/branches{/branch}","tags_url":"https://api.github.com/repos/ros2/rclpy/tags","blobs_url":"https://api.github.com/repos/ros2/rclpy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ros2/rclpy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ros2/rclpy/git/refs{/sha}","trees_url":"https://api.github.com/repos/ros2/rclpy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ros2/rclpy/statuses/{sha}","languages_url":"https://api.github.com/repos/ros2/rclpy/languages","stargazers_url":"https://api.github.com/repos/ros2/rclpy/stargazers","contributors_url":"https://api.github.com/repos/ros2/rclpy/contributors","subscribers_url":"https://api.github.com/repos/ros2/rclpy/subscribers","subscription_url":"https://api.github.com/repos/ros2/rclpy/subscription","commits_url":"https://api.github.com/repos/ros2/rclpy/commits{/sha}","git_commits_url":"https://api.github.com/repos/ros2/rclpy/git/commits{/sha}","comments_url":"https://api.github.com/repos/ros2/rclpy/comments{/number}","issue_comment_url":"https://api.github.com/repos/ros2/rclpy/issues/comments{/number}","contents_url":"https://api.github.com/repos/ros2/rclpy/contents/{+path}","compare_url":"https://api.github.com/repos/ros2/rclpy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ros2/rclpy/merges","archive_url":"https://api.github.com/repos/ros2/rclpy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ros2/rclpy/downloads","issues_url":"https://api.github.com/repos/ros2/rclpy/issues{/number}","pulls_url":"https://api.github.com/repos/ros2/rclpy/pulls{/number}","milestones_url":"https://api.github.com/repos/ros2/rclpy/milestones{/number}","notifications_url":"https://api.github.com/repos/ros2/rclpy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ros2/rclpy/labels{/name}","releases_url":"https://api.github.com/repos/ros2/rclpy/releases{/id}","deployments_url":"https://api.github.com/repos/ros2/rclpy/deployments","created_at":"2015-11-19T19:34:49Z","updated_at":"2018-07-26T22:51:04Z","pushed_at":"2018-07-27T22:16:33Z","git_url":"git://github.com/ros2/rclpy.git","ssh_url":"git@github.com:ros2/rclpy.git","clone_url":"https://github.com/ros2/rclpy.git","svn_url":"https://github.com/ros2/rclpy","homepage":null,"size":449,"stargazers_count":17,"watchers_count":17,"language":"Python","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":13,"mirror_url":null,"archived":false,"open_issues_count":20,"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":13,"open_issues":20,"watchers":17,"default_branch":"master"}},"base":{"label":"ros2:timer-with-clock","ref":"timer-with-clock","sha":"f938bac8f72d7ff0af79c0ba04abfd149ce68be6","user":{"login":"ros2","id":3979232,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5NzkyMzI=","avatar_url":"https://avatars1.githubusercontent.com/u/3979232?v=4","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"repo":{"id":46515609,"node_id":"MDEwOlJlcG9zaXRvcnk0NjUxNTYwOQ==","name":"rclpy","full_name":"ros2/rclpy","owner":{"login":"ros2","id":3979232,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5NzkyMzI=","avatar_url":"https://avatars1.githubusercontent.com/u/3979232?v=4","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ros2/rclpy","description":"rclpy (ROS Client Library for Python)","fork":false,"url":"https://api.github.com/repos/ros2/rclpy","forks_url":"https://api.github.com/repos/ros2/rclpy/forks","keys_url":"https://api.github.com/repos/ros2/rclpy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ros2/rclpy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ros2/rclpy/teams","hooks_url":"https://api.github.com/repos/ros2/rclpy/hooks","issue_events_url":"https://api.github.com/repos/ros2/rclpy/issues/events{/number}","events_url":"https://api.github.com/repos/ros2/rclpy/events","assignees_url":"https://api.github.com/repos/ros2/rclpy/assignees{/user}","branches_url":"https://api.github.com/repos/ros2/rclpy/branches{/branch}","tags_url":"https://api.github.com/repos/ros2/rclpy/tags","blobs_url":"https://api.github.com/repos/ros2/rclpy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ros2/rclpy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ros2/rclpy/git/refs{/sha}","trees_url":"https://api.github.com/repos/ros2/rclpy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ros2/rclpy/statuses/{sha}","languages_url":"https://api.github.com/repos/ros2/rclpy/languages","stargazers_url":"https://api.github.com/repos/ros2/rclpy/stargazers","contributors_url":"https://api.github.com/repos/ros2/rclpy/contributors","subscribers_url":"https://api.github.com/repos/ros2/rclpy/subscribers","subscription_url":"https://api.github.com/repos/ros2/rclpy/subscription","commits_url":"https://api.github.com/repos/ros2/rclpy/commits{/sha}","git_commits_url":"https://api.github.com/repos/ros2/rclpy/git/commits{/sha}","comments_url":"https://api.github.com/repos/ros2/rclpy/comments{/number}","issue_comment_url":"https://api.github.com/repos/ros2/rclpy/issues/comments{/number}","contents_url":"https://api.github.com/repos/ros2/rclpy/contents/{+path}","compare_url":"https://api.github.com/repos/ros2/rclpy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ros2/rclpy/merges","archive_url":"https://api.github.com/repos/ros2/rclpy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ros2/rclpy/downloads","issues_url":"https://api.github.com/repos/ros2/rclpy/issues{/number}","pulls_url":"https://api.github.com/repos/ros2/rclpy/pulls{/number}","milestones_url":"https://api.github.com/repos/ros2/rclpy/milestones{/number}","notifications_url":"https://api.github.com/repos/ros2/rclpy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ros2/rclpy/labels{/name}","releases_url":"https://api.github.com/repos/ros2/rclpy/releases{/id}","deployments_url":"https://api.github.com/repos/ros2/rclpy/deployments","created_at":"2015-11-19T19:34:49Z","updated_at":"2018-07-26T22:51:04Z","pushed_at":"2018-07-27T22:16:33Z","git_url":"git://github.com/ros2/rclpy.git","ssh_url":"git@github.com:ros2/rclpy.git","clone_url":"https://github.com/ros2/rclpy.git","svn_url":"https://github.com/ros2/rclpy","homepage":null,"size":449,"stargazers_count":17,"watchers_count":17,"language":"Python","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":13,"mirror_url":null,"archived":false,"open_issues_count":20,"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":13,"open_issues":20,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ros2/rclpy/pulls/212"},"html":{"href":"https://github.com/ros2/rclpy/pull/212"},"issue":{"href":"https://api.github.com/repos/ros2/rclpy/issues/212"},"comments":{"href":"https://api.github.com/repos/ros2/rclpy/issues/212/comments"},"review_comments":{"href":"https://api.github.com/repos/ros2/rclpy/pulls/212/comments"},"review_comment":{"href":"https://api.github.com/repos/ros2/rclpy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ros2/rclpy/pulls/212/commits"},"statuses":{"href":"https://api.github.com/repos/ros2/rclpy/statuses/d4c43c63ecedb30ffe6de7888f13c14f99a7533e"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"sloretz"}}