{"action":"created","issue":{"url":"https://api.github.com/repos/chapel-lang/chapel/issues/11557","repository_url":"https://api.github.com/repos/chapel-lang/chapel","labels_url":"https://api.github.com/repos/chapel-lang/chapel/issues/11557/labels{/name}","comments_url":"https://api.github.com/repos/chapel-lang/chapel/issues/11557/comments","events_url":"https://api.github.com/repos/chapel-lang/chapel/issues/11557/events","html_url":"https://github.com/chapel-lang/chapel/pull/11557","id":376925217,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI4MDI2MDMx","number":11557,"title":"Add support for literal argument default values in Python interoperability","user":{"login":"lydia-duncan","id":2454710,"node_id":"MDQ6VXNlcjI0NTQ3MTA=","avatar_url":"https://avatars2.githubusercontent.com/u/2454710?v=4","gravatar_id":"","url":"https://api.github.com/users/lydia-duncan","html_url":"https://github.com/lydia-duncan","followers_url":"https://api.github.com/users/lydia-duncan/followers","following_url":"https://api.github.com/users/lydia-duncan/following{/other_user}","gists_url":"https://api.github.com/users/lydia-duncan/gists{/gist_id}","starred_url":"https://api.github.com/users/lydia-duncan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lydia-duncan/subscriptions","organizations_url":"https://api.github.com/users/lydia-duncan/orgs","repos_url":"https://api.github.com/users/lydia-duncan/repos","events_url":"https://api.github.com/users/lydia-duncan/events{/privacy}","received_events_url":"https://api.github.com/users/lydia-duncan/received_events","type":"User","site_admin":false},"labels":[{"id":496591117,"node_id":"MDU6TGFiZWw0OTY1OTExMTc=","url":"https://api.github.com/repos/chapel-lang/chapel/labels/area:%20Compiler","name":"area: Compiler","color":"d4c5f9","default":false},{"id":514878410,"node_id":"MDU6TGFiZWw1MTQ4Nzg0MTA=","url":"https://api.github.com/repos/chapel-lang/chapel/labels/area:%20Tests","name":"area: Tests","color":"d4c5f9","default":false},{"id":514878276,"node_id":"MDU6TGFiZWw1MTQ4NzgyNzY=","url":"https://api.github.com/repos/chapel-lang/chapel/labels/area:%20Tools","name":"area: Tools","color":"d4c5f9","default":false},{"id":514878968,"node_id":"MDU6TGFiZWw1MTQ4Nzg5Njg=","url":"https://api.github.com/repos/chapel-lang/chapel/labels/stat:%20Needs%20Code%20Review","name":"stat: Needs Code Review","color":"c5def5","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-11-02T18:40:28Z","updated_at":"2018-11-02T22:03:57Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/chapel-lang/chapel/pulls/11557","html_url":"https://github.com/chapel-lang/chapel/pull/11557","diff_url":"https://github.com/chapel-lang/chapel/pull/11557.diff","patch_url":"https://github.com/chapel-lang/chapel/pull/11557.patch"},"body":"C does not support default values for arguments, but Python does.  Add support for the\r\ndefault values when interoperating with Python, and a warning message when the code\r\nis compiled for interoperating with C.  Currently only handles when literals are used as\r\nthe default value, but we anticipate being able to support cases like computations,\r\nfunction calls, referring to previous arguments, and referring to exported global\r\nvariables in the future.\r\n\r\nResolves #10667 \r\n\r\nDetails:\r\nDefault values for arguments are no longer relevant to the AST after function\r\nresolution and get cleaned up between there and code generation.  So when\r\nresolving exported functions, save the value into a map from the argument to\r\na string.  Then, at code generation, output the default value into the function\r\nheader in the .pyx file.\r\n\r\nAlso made a minor change to the param cname support for exported functions\r\nso that they wouldn't trigger my analysis (since they had been removed from the\r\ntree already anyways).\r\n\r\nGenerates a warning that the default value has been dropped on the floor for:\r\n- C, on any exported function\r\n- Python when the default value is not a literal like `4`, `\"blah\"`, etc.\r\n\r\nAdds 6 new tests, covering:\r\n- The warning message for C library compilation\r\n- Ensures that even with the warning, the library function can still be called when\r\ngiven a value for the argument with a default\r\n- support for default literal values for `c_string`s, `bool`s, `int`s, `real`s, `uint`s\r\n- a future for the default value of an argument of type `complex` (this test also covers\r\nwhen the default value is a computation of some sort instead of just a recognizable\r\nliteral)\r\n- a future for when the default value references an exported global variable\r\n- a future for when the default value references a prior argument\r\n\r\nTesting:\r\n- Passed full paratest with futures\r\n- Passed fresh checkout on python testing machine\r\n"},"comment":{"url":"https://api.github.com/repos/chapel-lang/chapel/issues/comments/435522736","html_url":"https://github.com/chapel-lang/chapel/pull/11557#issuecomment-435522736","issue_url":"https://api.github.com/repos/chapel-lang/chapel/issues/11557","id":435522736,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNTUyMjczNg==","user":{"login":"lydia-duncan","id":2454710,"node_id":"MDQ6VXNlcjI0NTQ3MTA=","avatar_url":"https://avatars2.githubusercontent.com/u/2454710?v=4","gravatar_id":"","url":"https://api.github.com/users/lydia-duncan","html_url":"https://github.com/lydia-duncan","followers_url":"https://api.github.com/users/lydia-duncan/followers","following_url":"https://api.github.com/users/lydia-duncan/following{/other_user}","gists_url":"https://api.github.com/users/lydia-duncan/gists{/gist_id}","starred_url":"https://api.github.com/users/lydia-duncan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lydia-duncan/subscriptions","organizations_url":"https://api.github.com/users/lydia-duncan/orgs","repos_url":"https://api.github.com/users/lydia-duncan/repos","events_url":"https://api.github.com/users/lydia-duncan/events{/privacy}","received_events_url":"https://api.github.com/users/lydia-duncan/received_events","type":"User","site_admin":false},"created_at":"2018-11-02T22:03:57Z","updated_at":"2018-11-02T22:03:57Z","author_association":"MEMBER","body":"I added your comment on the default value functions to the issue I made for the more complicated case"}}
{"actor":{"display_login":"lydia-duncan"}}