{"action":"created","comment":{"url":"https://api.github.com/repos/pybind/pybind11/pulls/comments/103832132","pull_request_review_id":24634306,"id":103832132,"diff_hunk":"@@ -173,16 +144,36 @@ inline PyTypeObject* make_default_metaclass() {\n     return type;\n }\n \n-/// Instance creation function for all pybind11 types. It only allocates space for the\n-/// C++ object, but doesn't call the constructor -- an `__init__` function must do that.\n-extern \"C\" inline PyObject *pybind11_object_new(PyTypeObject *type, PyObject *, PyObject *) {\n+/** Instance creation function for all pybind11 types. It only allocates space for the C++ object\n+ * (or multiple objects, for Python-side inheritance from multiple pybind11 types), but doesn't call\n+ * the constructor -- an `__init__` function must do that.\n+ */\n+extern \"C\" PYBIND11_NOINLINE inline PyObject *pybind11_object_new(PyTypeObject *type, PyObject *, PyObject *) {","path":"include/pybind11/class_support.h","position":null,"original_position":54,"commit_id":"2230fd1e80eff6cac63ad4a1aa2a144acef3a4aa","original_commit_id":"6445a1e38f6027421eefed561b620f53ba9bc3fc","user":{"login":"jagerman","id":4459524,"avatar_url":"https://avatars0.githubusercontent.com/u/4459524?v=3","gravatar_id":"","url":"https://api.github.com/users/jagerman","html_url":"https://github.com/jagerman","followers_url":"https://api.github.com/users/jagerman/followers","following_url":"https://api.github.com/users/jagerman/following{/other_user}","gists_url":"https://api.github.com/users/jagerman/gists{/gist_id}","starred_url":"https://api.github.com/users/jagerman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jagerman/subscriptions","organizations_url":"https://api.github.com/users/jagerman/orgs","repos_url":"https://api.github.com/users/jagerman/repos","events_url":"https://api.github.com/users/jagerman/events{/privacy}","received_events_url":"https://api.github.com/users/jagerman/received_events","type":"User","site_admin":false},"body":"(Fixed).","created_at":"2017-03-02T01:23:24Z","updated_at":"2017-03-02T01:23:24Z","html_url":"https://github.com/pybind/pybind11/pull/693#discussion_r103832132","pull_request_url":"https://api.github.com/repos/pybind/pybind11/pulls/693","_links":{"self":{"href":"https://api.github.com/repos/pybind/pybind11/pulls/comments/103832132"},"html":{"href":"https://github.com/pybind/pybind11/pull/693#discussion_r103832132"},"pull_request":{"href":"https://api.github.com/repos/pybind/pybind11/pulls/693"}}},"pull_request":{"url":"https://api.github.com/repos/pybind/pybind11/pulls/693","id":107560275,"html_url":"https://github.com/pybind/pybind11/pull/693","diff_url":"https://github.com/pybind/pybind11/pull/693.diff","patch_url":"https://github.com/pybind/pybind11/pull/693.patch","issue_url":"https://api.github.com/repos/pybind/pybind11/issues/693","number":693,"state":"open","locked":false,"title":"Python multiple inheritance","user":{"login":"jagerman","id":4459524,"avatar_url":"https://avatars0.githubusercontent.com/u/4459524?v=3","gravatar_id":"","url":"https://api.github.com/users/jagerman","html_url":"https://github.com/jagerman","followers_url":"https://api.github.com/users/jagerman/followers","following_url":"https://api.github.com/users/jagerman/following{/other_user}","gists_url":"https://api.github.com/users/jagerman/gists{/gist_id}","starred_url":"https://api.github.com/users/jagerman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jagerman/subscriptions","organizations_url":"https://api.github.com/users/jagerman/orgs","repos_url":"https://api.github.com/users/jagerman/repos","events_url":"https://api.github.com/users/jagerman/events{/privacy}","received_events_url":"https://api.github.com/users/jagerman/received_events","type":"User","site_admin":false},"body":"This builds on @dean0x7d's #679 to support multiple inheritance of C++ classes from Python.  This required no dispatch changing at all, but does require some changes to be able to store multiple C++ base objects in a single instance.\r\n\r\nThis is done by changing the `instance` layout to contain a single `void**` which is allocated to the correct size and contains value/holder pointer pairs.  The value pointers are themselves each set to newly-allocated memory of the size required for each value, and the holders are initialized to nullptr.\r\n\r\nThus the instance changes from this:\r\n\r\n- ... python stuff ...\r\n- pointer to VALUE data\r\n- weakrefs *\r\n- bools\r\n- HOLDER\r\n\r\nto:\r\n\r\n- ... python stuff ...\r\n- pointer to value/holder data: [[VALUE1 *][HOLDER1 *][VALUE2 *][HOLDER2 *]...]\r\n- weakrefs *\r\n- bools\r\n\r\nwhere each VALUEn pointer is to newly allocated memory of the size required by the value type, and each HOLDERn starts out set to nulptr.\r\n\r\nThis has three effects: First, all instances have the same size (more on this below).  Second, `instance` can store multiple base values and holders for those base values.  Third, we don't need the `instance_essentials`/`instance<HolderType>` distinction anymore: there is now just one `instance` which can contain any number of values and holders of whatever size.\r\n\r\nStructure aside, a new `get_all_type_info()` function is added which takes a type and returns a vector of all the pybind types that make up the input type.  For types that are already a pybind type, or that inheriting just one pybind-registered type, this is just that the `typeinfo` for that type.  For multiple inheritance, this will be a list.\r\n\r\nA companion function, `get_value_and_holder()`, contains the logic of using the `get_all_type_info()` to extract the correct references to the value and holder pointers for a given type from the `instance`.\r\n\r\nAs for method dispatching: we don't have to do anything.  Python takes care of the MRO.  (Cross-class overloads won't work, but that's true in Python in general).  The generic type caster now knows how to extract the correct value from a multi-valued instance, and an invoked constructor can get the correct holder type/pointer by simply using the parent of the constructor itself (rather than the instance itself, which may have multiple holders).\r\n\r\n.so size increases slightly (~1.2%, or about 20KB, on the full test suite compared to #679 under g++6).  I think it's worthwhile (and I expect a good chunk of that increase is constant).\r\n\r\nCurrently this fails under PyPy: I haven't investigated in detail, but will do so.\r\n\r\nSome other comments:\r\n\r\n- since we don't store the holder_type directly in the instance anymore (instead it's in the pointer of pointers), we don't need #679's one-base-per-instance-size (because there is now just one instance size): I've replaced it with just one base for all pybind11 types, instead of one per instance size.  It's also now constructed in the `get_internals()` initialization rather than on demand.\r\n\r\n- the `holder_constructed` flag isn't needed anymore: a `nullptr` holder pointer now indicates a non-constructed holder.  `instance_size` is similarly dropped.\r\n\r\n- the recursive loading in the generic type caster (and mirrored in the copyable holder caster) isn't needed anymore (the `get_all_type_info`/`get_value_and_holder` logic handles python base class traversal now).\r\n","created_at":"2017-02-23T05:54:42Z","updated_at":"2017-03-02T01:23:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"01147a30ad6f3af15515e67fa0e185ea48c1ea43","assignee":{"login":"jagerman","id":4459524,"avatar_url":"https://avatars0.githubusercontent.com/u/4459524?v=3","gravatar_id":"","url":"https://api.github.com/users/jagerman","html_url":"https://github.com/jagerman","followers_url":"https://api.github.com/users/jagerman/followers","following_url":"https://api.github.com/users/jagerman/following{/other_user}","gists_url":"https://api.github.com/users/jagerman/gists{/gist_id}","starred_url":"https://api.github.com/users/jagerman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jagerman/subscriptions","organizations_url":"https://api.github.com/users/jagerman/orgs","repos_url":"https://api.github.com/users/jagerman/repos","events_url":"https://api.github.com/users/jagerman/events{/privacy}","received_events_url":"https://api.github.com/users/jagerman/received_events","type":"User","site_admin":false},"assignees":[{"login":"jagerman","id":4459524,"avatar_url":"https://avatars0.githubusercontent.com/u/4459524?v=3","gravatar_id":"","url":"https://api.github.com/users/jagerman","html_url":"https://github.com/jagerman","followers_url":"https://api.github.com/users/jagerman/followers","following_url":"https://api.github.com/users/jagerman/following{/other_user}","gists_url":"https://api.github.com/users/jagerman/gists{/gist_id}","starred_url":"https://api.github.com/users/jagerman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jagerman/subscriptions","organizations_url":"https://api.github.com/users/jagerman/orgs","repos_url":"https://api.github.com/users/jagerman/repos","events_url":"https://api.github.com/users/jagerman/events{/privacy}","received_events_url":"https://api.github.com/users/jagerman/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/pybind/pybind11/pulls/693/commits","review_comments_url":"https://api.github.com/repos/pybind/pybind11/pulls/693/comments","review_comment_url":"https://api.github.com/repos/pybind/pybind11/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pybind/pybind11/issues/693/comments","statuses_url":"https://api.github.com/repos/pybind/pybind11/statuses/2230fd1e80eff6cac63ad4a1aa2a144acef3a4aa","head":{"label":"jagerman:python-mi","ref":"python-mi","sha":"2230fd1e80eff6cac63ad4a1aa2a144acef3a4aa","user":{"login":"jagerman","id":4459524,"avatar_url":"https://avatars0.githubusercontent.com/u/4459524?v=3","gravatar_id":"","url":"https://api.github.com/users/jagerman","html_url":"https://github.com/jagerman","followers_url":"https://api.github.com/users/jagerman/followers","following_url":"https://api.github.com/users/jagerman/following{/other_user}","gists_url":"https://api.github.com/users/jagerman/gists{/gist_id}","starred_url":"https://api.github.com/users/jagerman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jagerman/subscriptions","organizations_url":"https://api.github.com/users/jagerman/orgs","repos_url":"https://api.github.com/users/jagerman/repos","events_url":"https://api.github.com/users/jagerman/events{/privacy}","received_events_url":"https://api.github.com/users/jagerman/received_events","type":"User","site_admin":false},"repo":{"id":62475786,"name":"pybind11","full_name":"jagerman/pybind11","owner":{"login":"jagerman","id":4459524,"avatar_url":"https://avatars0.githubusercontent.com/u/4459524?v=3","gravatar_id":"","url":"https://api.github.com/users/jagerman","html_url":"https://github.com/jagerman","followers_url":"https://api.github.com/users/jagerman/followers","following_url":"https://api.github.com/users/jagerman/following{/other_user}","gists_url":"https://api.github.com/users/jagerman/gists{/gist_id}","starred_url":"https://api.github.com/users/jagerman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jagerman/subscriptions","organizations_url":"https://api.github.com/users/jagerman/orgs","repos_url":"https://api.github.com/users/jagerman/repos","events_url":"https://api.github.com/users/jagerman/events{/privacy}","received_events_url":"https://api.github.com/users/jagerman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jagerman/pybind11","description":"Seamless operability between C++11 and Python","fork":true,"url":"https://api.github.com/repos/jagerman/pybind11","forks_url":"https://api.github.com/repos/jagerman/pybind11/forks","keys_url":"https://api.github.com/repos/jagerman/pybind11/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jagerman/pybind11/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jagerman/pybind11/teams","hooks_url":"https://api.github.com/repos/jagerman/pybind11/hooks","issue_events_url":"https://api.github.com/repos/jagerman/pybind11/issues/events{/number}","events_url":"https://api.github.com/repos/jagerman/pybind11/events","assignees_url":"https://api.github.com/repos/jagerman/pybind11/assignees{/user}","branches_url":"https://api.github.com/repos/jagerman/pybind11/branches{/branch}","tags_url":"https://api.github.com/repos/jagerman/pybind11/tags","blobs_url":"https://api.github.com/repos/jagerman/pybind11/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jagerman/pybind11/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jagerman/pybind11/git/refs{/sha}","trees_url":"https://api.github.com/repos/jagerman/pybind11/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jagerman/pybind11/statuses/{sha}","languages_url":"https://api.github.com/repos/jagerman/pybind11/languages","stargazers_url":"https://api.github.com/repos/jagerman/pybind11/stargazers","contributors_url":"https://api.github.com/repos/jagerman/pybind11/contributors","subscribers_url":"https://api.github.com/repos/jagerman/pybind11/subscribers","subscription_url":"https://api.github.com/repos/jagerman/pybind11/subscription","commits_url":"https://api.github.com/repos/jagerman/pybind11/commits{/sha}","git_commits_url":"https://api.github.com/repos/jagerman/pybind11/git/commits{/sha}","comments_url":"https://api.github.com/repos/jagerman/pybind11/comments{/number}","issue_comment_url":"https://api.github.com/repos/jagerman/pybind11/issues/comments{/number}","contents_url":"https://api.github.com/repos/jagerman/pybind11/contents/{+path}","compare_url":"https://api.github.com/repos/jagerman/pybind11/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jagerman/pybind11/merges","archive_url":"https://api.github.com/repos/jagerman/pybind11/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jagerman/pybind11/downloads","issues_url":"https://api.github.com/repos/jagerman/pybind11/issues{/number}","pulls_url":"https://api.github.com/repos/jagerman/pybind11/pulls{/number}","milestones_url":"https://api.github.com/repos/jagerman/pybind11/milestones{/number}","notifications_url":"https://api.github.com/repos/jagerman/pybind11/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jagerman/pybind11/labels{/name}","releases_url":"https://api.github.com/repos/jagerman/pybind11/releases{/id}","deployments_url":"https://api.github.com/repos/jagerman/pybind11/deployments","created_at":"2016-07-03T01:01:55Z","updated_at":"2016-07-03T01:01:56Z","pushed_at":"2017-03-02T01:19:09Z","git_url":"git://github.com/jagerman/pybind11.git","ssh_url":"git@github.com:jagerman/pybind11.git","clone_url":"https://github.com/jagerman/pybind11.git","svn_url":"https://github.com/jagerman/pybind11","homepage":null,"size":2608,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pybind:master","ref":"master","sha":"a04410bd290aea0995086ce615d5421ef7861807","user":{"login":"pybind","id":17565521,"avatar_url":"https://avatars1.githubusercontent.com/u/17565521?v=3","gravatar_id":"","url":"https://api.github.com/users/pybind","html_url":"https://github.com/pybind","followers_url":"https://api.github.com/users/pybind/followers","following_url":"https://api.github.com/users/pybind/following{/other_user}","gists_url":"https://api.github.com/users/pybind/gists{/gist_id}","starred_url":"https://api.github.com/users/pybind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pybind/subscriptions","organizations_url":"https://api.github.com/users/pybind/orgs","repos_url":"https://api.github.com/users/pybind/repos","events_url":"https://api.github.com/users/pybind/events{/privacy}","received_events_url":"https://api.github.com/users/pybind/received_events","type":"Organization","site_admin":false},"repo":{"id":38581626,"name":"pybind11","full_name":"pybind/pybind11","owner":{"login":"pybind","id":17565521,"avatar_url":"https://avatars1.githubusercontent.com/u/17565521?v=3","gravatar_id":"","url":"https://api.github.com/users/pybind","html_url":"https://github.com/pybind","followers_url":"https://api.github.com/users/pybind/followers","following_url":"https://api.github.com/users/pybind/following{/other_user}","gists_url":"https://api.github.com/users/pybind/gists{/gist_id}","starred_url":"https://api.github.com/users/pybind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pybind/subscriptions","organizations_url":"https://api.github.com/users/pybind/orgs","repos_url":"https://api.github.com/users/pybind/repos","events_url":"https://api.github.com/users/pybind/events{/privacy}","received_events_url":"https://api.github.com/users/pybind/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pybind/pybind11","description":"Seamless operability between C++11 and Python","fork":false,"url":"https://api.github.com/repos/pybind/pybind11","forks_url":"https://api.github.com/repos/pybind/pybind11/forks","keys_url":"https://api.github.com/repos/pybind/pybind11/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pybind/pybind11/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pybind/pybind11/teams","hooks_url":"https://api.github.com/repos/pybind/pybind11/hooks","issue_events_url":"https://api.github.com/repos/pybind/pybind11/issues/events{/number}","events_url":"https://api.github.com/repos/pybind/pybind11/events","assignees_url":"https://api.github.com/repos/pybind/pybind11/assignees{/user}","branches_url":"https://api.github.com/repos/pybind/pybind11/branches{/branch}","tags_url":"https://api.github.com/repos/pybind/pybind11/tags","blobs_url":"https://api.github.com/repos/pybind/pybind11/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pybind/pybind11/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pybind/pybind11/git/refs{/sha}","trees_url":"https://api.github.com/repos/pybind/pybind11/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pybind/pybind11/statuses/{sha}","languages_url":"https://api.github.com/repos/pybind/pybind11/languages","stargazers_url":"https://api.github.com/repos/pybind/pybind11/stargazers","contributors_url":"https://api.github.com/repos/pybind/pybind11/contributors","subscribers_url":"https://api.github.com/repos/pybind/pybind11/subscribers","subscription_url":"https://api.github.com/repos/pybind/pybind11/subscription","commits_url":"https://api.github.com/repos/pybind/pybind11/commits{/sha}","git_commits_url":"https://api.github.com/repos/pybind/pybind11/git/commits{/sha}","comments_url":"https://api.github.com/repos/pybind/pybind11/comments{/number}","issue_comment_url":"https://api.github.com/repos/pybind/pybind11/issues/comments{/number}","contents_url":"https://api.github.com/repos/pybind/pybind11/contents/{+path}","compare_url":"https://api.github.com/repos/pybind/pybind11/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pybind/pybind11/merges","archive_url":"https://api.github.com/repos/pybind/pybind11/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pybind/pybind11/downloads","issues_url":"https://api.github.com/repos/pybind/pybind11/issues{/number}","pulls_url":"https://api.github.com/repos/pybind/pybind11/pulls{/number}","milestones_url":"https://api.github.com/repos/pybind/pybind11/milestones{/number}","notifications_url":"https://api.github.com/repos/pybind/pybind11/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pybind/pybind11/labels{/name}","releases_url":"https://api.github.com/repos/pybind/pybind11/releases{/id}","deployments_url":"https://api.github.com/repos/pybind/pybind11/deployments","created_at":"2015-07-05T19:46:48Z","updated_at":"2017-03-01T05:30:05Z","pushed_at":"2017-03-02T01:19:11Z","git_url":"git://github.com/pybind/pybind11.git","ssh_url":"git@github.com:pybind/pybind11.git","clone_url":"https://github.com/pybind/pybind11.git","svn_url":"https://github.com/pybind/pybind11","homepage":"","size":2367,"stargazers_count":1814,"watchers_count":1814,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":203,"mirror_url":null,"open_issues_count":37,"forks":203,"open_issues":37,"watchers":1814,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pybind/pybind11/pulls/693"},"html":{"href":"https://github.com/pybind/pybind11/pull/693"},"issue":{"href":"https://api.github.com/repos/pybind/pybind11/issues/693"},"comments":{"href":"https://api.github.com/repos/pybind/pybind11/issues/693/comments"},"review_comments":{"href":"https://api.github.com/repos/pybind/pybind11/pulls/693/comments"},"review_comment":{"href":"https://api.github.com/repos/pybind/pybind11/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pybind/pybind11/pulls/693/commits"},"statuses":{"href":"https://api.github.com/repos/pybind/pybind11/statuses/2230fd1e80eff6cac63ad4a1aa2a144acef3a4aa"}}}}
{"actor":{"display_login":"jagerman"}}