{"action":"opened","number":595,"pull_request":{"url":"https://api.github.com/repos/pypa/setuptools/pulls/595","id":71544335,"html_url":"https://github.com/pypa/setuptools/pull/595","diff_url":"https://github.com/pypa/setuptools/pull/595.diff","patch_url":"https://github.com/pypa/setuptools/pull/595.patch","issue_url":"https://api.github.com/repos/pypa/setuptools/issues/595","number":595,"state":"open","locked":false,"title":"launcher.c: add support for Unicode sys.argv in cli/gui.exe Windows launchers","user":{"login":"anthrotype","id":6939968,"avatar_url":"https://avatars.githubusercontent.com/u/6939968?v=3","gravatar_id":"","url":"https://api.github.com/users/anthrotype","html_url":"https://github.com/anthrotype","followers_url":"https://api.github.com/users/anthrotype/followers","following_url":"https://api.github.com/users/anthrotype/following{/other_user}","gists_url":"https://api.github.com/users/anthrotype/gists{/gist_id}","starred_url":"https://api.github.com/users/anthrotype/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anthrotype/subscriptions","organizations_url":"https://api.github.com/users/anthrotype/orgs","repos_url":"https://api.github.com/users/anthrotype/repos","events_url":"https://api.github.com/users/anthrotype/events{/privacy}","received_events_url":"https://api.github.com/users/anthrotype/received_events","type":"User","site_admin":false},"body":"In Python 3 on Windows, `sys.argv` is created through the Windows Unicode API.\r\nThat means command line arguments are retrieved as `wchar_t*` through the Windows-specific `wmain` (for console programs) and `wWinMain` (for gui programs) entry points.\r\n\r\nSee https://bugs.python.org/issue2128\r\n\r\nHowever, setuptools' \"cli.exe\" and \"gui.exe\" launchers, as defined in `launcher.c`, are still using the Windows ANSI API: i.e. the entry point is `main`, and `argv` type is `char *` instead of `wchar_t*`, which means it's dependant on the current console's codepage.\r\n\r\nThis prevents Windows Python 3 from accessing the Unicode command line arguments which are sent by Windows when running python scripts via the usual `python.exe` command. When run through launchers, the `sys.argv` contains instead replacement strings like \"?????\", which is not nice.\r\n\r\nThe fix proposed here is similar to the one which introduced support for Unicode sys.argv in Python 3: https://hg.python.org/cpython/rev/22a74eaf6b22/\r\n\r\nBasically:\r\n- we use 'wmain' and 'wWinMain' as entry points, so we can use `wchar_t *argv` \r\n- we replace all char* with wchar_t*\r\n- we use the 'wide' Unicode version of all relevant functions (`wcslen` instead\r\n  of `strlen`, `CreateProcessW` instead of `CreateProcessA`, etc.)\r\n\r\nPlease let me know what you think.\r\n\r\nThank you.","created_at":"2016-05-26T12:04:12Z","updated_at":"2016-05-26T12:04:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pypa/setuptools/pulls/595/commits","review_comments_url":"https://api.github.com/repos/pypa/setuptools/pulls/595/comments","review_comment_url":"https://api.github.com/repos/pypa/setuptools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pypa/setuptools/issues/595/comments","statuses_url":"https://api.github.com/repos/pypa/setuptools/statuses/ad5193d67242ee86276db626fdd25ade3024eec5","head":{"label":"anthrotype:launcher-unicode-argv","ref":"launcher-unicode-argv","sha":"ad5193d67242ee86276db626fdd25ade3024eec5","user":{"login":"anthrotype","id":6939968,"avatar_url":"https://avatars.githubusercontent.com/u/6939968?v=3","gravatar_id":"","url":"https://api.github.com/users/anthrotype","html_url":"https://github.com/anthrotype","followers_url":"https://api.github.com/users/anthrotype/followers","following_url":"https://api.github.com/users/anthrotype/following{/other_user}","gists_url":"https://api.github.com/users/anthrotype/gists{/gist_id}","starred_url":"https://api.github.com/users/anthrotype/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anthrotype/subscriptions","organizations_url":"https://api.github.com/users/anthrotype/orgs","repos_url":"https://api.github.com/users/anthrotype/repos","events_url":"https://api.github.com/users/anthrotype/events{/privacy}","received_events_url":"https://api.github.com/users/anthrotype/received_events","type":"User","site_admin":false},"repo":{"id":57972188,"name":"setuptools","full_name":"anthrotype/setuptools","owner":{"login":"anthrotype","id":6939968,"avatar_url":"https://avatars.githubusercontent.com/u/6939968?v=3","gravatar_id":"","url":"https://api.github.com/users/anthrotype","html_url":"https://github.com/anthrotype","followers_url":"https://api.github.com/users/anthrotype/followers","following_url":"https://api.github.com/users/anthrotype/following{/other_user}","gists_url":"https://api.github.com/users/anthrotype/gists{/gist_id}","starred_url":"https://api.github.com/users/anthrotype/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anthrotype/subscriptions","organizations_url":"https://api.github.com/users/anthrotype/orgs","repos_url":"https://api.github.com/users/anthrotype/repos","events_url":"https://api.github.com/users/anthrotype/events{/privacy}","received_events_url":"https://api.github.com/users/anthrotype/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/anthrotype/setuptools","description":"Fork of the official project repository for the Setuptools build system","fork":true,"url":"https://api.github.com/repos/anthrotype/setuptools","forks_url":"https://api.github.com/repos/anthrotype/setuptools/forks","keys_url":"https://api.github.com/repos/anthrotype/setuptools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/anthrotype/setuptools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/anthrotype/setuptools/teams","hooks_url":"https://api.github.com/repos/anthrotype/setuptools/hooks","issue_events_url":"https://api.github.com/repos/anthrotype/setuptools/issues/events{/number}","events_url":"https://api.github.com/repos/anthrotype/setuptools/events","assignees_url":"https://api.github.com/repos/anthrotype/setuptools/assignees{/user}","branches_url":"https://api.github.com/repos/anthrotype/setuptools/branches{/branch}","tags_url":"https://api.github.com/repos/anthrotype/setuptools/tags","blobs_url":"https://api.github.com/repos/anthrotype/setuptools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/anthrotype/setuptools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/anthrotype/setuptools/git/refs{/sha}","trees_url":"https://api.github.com/repos/anthrotype/setuptools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/anthrotype/setuptools/statuses/{sha}","languages_url":"https://api.github.com/repos/anthrotype/setuptools/languages","stargazers_url":"https://api.github.com/repos/anthrotype/setuptools/stargazers","contributors_url":"https://api.github.com/repos/anthrotype/setuptools/contributors","subscribers_url":"https://api.github.com/repos/anthrotype/setuptools/subscribers","subscription_url":"https://api.github.com/repos/anthrotype/setuptools/subscription","commits_url":"https://api.github.com/repos/anthrotype/setuptools/commits{/sha}","git_commits_url":"https://api.github.com/repos/anthrotype/setuptools/git/commits{/sha}","comments_url":"https://api.github.com/repos/anthrotype/setuptools/comments{/number}","issue_comment_url":"https://api.github.com/repos/anthrotype/setuptools/issues/comments{/number}","contents_url":"https://api.github.com/repos/anthrotype/setuptools/contents/{+path}","compare_url":"https://api.github.com/repos/anthrotype/setuptools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/anthrotype/setuptools/merges","archive_url":"https://api.github.com/repos/anthrotype/setuptools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/anthrotype/setuptools/downloads","issues_url":"https://api.github.com/repos/anthrotype/setuptools/issues{/number}","pulls_url":"https://api.github.com/repos/anthrotype/setuptools/pulls{/number}","milestones_url":"https://api.github.com/repos/anthrotype/setuptools/milestones{/number}","notifications_url":"https://api.github.com/repos/anthrotype/setuptools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/anthrotype/setuptools/labels{/name}","releases_url":"https://api.github.com/repos/anthrotype/setuptools/releases{/id}","deployments_url":"https://api.github.com/repos/anthrotype/setuptools/deployments","created_at":"2016-05-03T13:41:54Z","updated_at":"2016-05-03T13:42:23Z","pushed_at":"2016-05-26T11:22:28Z","git_url":"git://github.com/anthrotype/setuptools.git","ssh_url":"git@github.com:anthrotype/setuptools.git","clone_url":"https://github.com/anthrotype/setuptools.git","svn_url":"https://github.com/anthrotype/setuptools","homepage":"https://pypi.python.org/pypi/setuptools","size":38424,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"pypa:master","ref":"master","sha":"29bef0ef4c71c0e9a88f1db889b47310568cc160","user":{"login":"pypa","id":647025,"avatar_url":"https://avatars.githubusercontent.com/u/647025?v=3","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":54980593,"name":"setuptools","full_name":"pypa/setuptools","owner":{"login":"pypa","id":647025,"avatar_url":"https://avatars.githubusercontent.com/u/647025?v=3","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/setuptools","description":"Official project repository for the Setuptools build system","fork":false,"url":"https://api.github.com/repos/pypa/setuptools","forks_url":"https://api.github.com/repos/pypa/setuptools/forks","keys_url":"https://api.github.com/repos/pypa/setuptools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pypa/setuptools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pypa/setuptools/teams","hooks_url":"https://api.github.com/repos/pypa/setuptools/hooks","issue_events_url":"https://api.github.com/repos/pypa/setuptools/issues/events{/number}","events_url":"https://api.github.com/repos/pypa/setuptools/events","assignees_url":"https://api.github.com/repos/pypa/setuptools/assignees{/user}","branches_url":"https://api.github.com/repos/pypa/setuptools/branches{/branch}","tags_url":"https://api.github.com/repos/pypa/setuptools/tags","blobs_url":"https://api.github.com/repos/pypa/setuptools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pypa/setuptools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pypa/setuptools/git/refs{/sha}","trees_url":"https://api.github.com/repos/pypa/setuptools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pypa/setuptools/statuses/{sha}","languages_url":"https://api.github.com/repos/pypa/setuptools/languages","stargazers_url":"https://api.github.com/repos/pypa/setuptools/stargazers","contributors_url":"https://api.github.com/repos/pypa/setuptools/contributors","subscribers_url":"https://api.github.com/repos/pypa/setuptools/subscribers","subscription_url":"https://api.github.com/repos/pypa/setuptools/subscription","commits_url":"https://api.github.com/repos/pypa/setuptools/commits{/sha}","git_commits_url":"https://api.github.com/repos/pypa/setuptools/git/commits{/sha}","comments_url":"https://api.github.com/repos/pypa/setuptools/comments{/number}","issue_comment_url":"https://api.github.com/repos/pypa/setuptools/issues/comments{/number}","contents_url":"https://api.github.com/repos/pypa/setuptools/contents/{+path}","compare_url":"https://api.github.com/repos/pypa/setuptools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pypa/setuptools/merges","archive_url":"https://api.github.com/repos/pypa/setuptools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pypa/setuptools/downloads","issues_url":"https://api.github.com/repos/pypa/setuptools/issues{/number}","pulls_url":"https://api.github.com/repos/pypa/setuptools/pulls{/number}","milestones_url":"https://api.github.com/repos/pypa/setuptools/milestones{/number}","notifications_url":"https://api.github.com/repos/pypa/setuptools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pypa/setuptools/labels{/name}","releases_url":"https://api.github.com/repos/pypa/setuptools/releases{/id}","deployments_url":"https://api.github.com/repos/pypa/setuptools/deployments","created_at":"2016-03-29T14:02:33Z","updated_at":"2016-05-26T10:06:51Z","pushed_at":"2016-05-22T20:08:34Z","git_url":"git://github.com/pypa/setuptools.git","ssh_url":"git@github.com:pypa/setuptools.git","clone_url":"https://github.com/pypa/setuptools.git","svn_url":"https://github.com/pypa/setuptools","homepage":"https://pypi.python.org/pypi/setuptools","size":38434,"stargazers_count":45,"watchers_count":45,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":38,"mirror_url":null,"open_issues_count":215,"forks":38,"open_issues":215,"watchers":45,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pypa/setuptools/pulls/595"},"html":{"href":"https://github.com/pypa/setuptools/pull/595"},"issue":{"href":"https://api.github.com/repos/pypa/setuptools/issues/595"},"comments":{"href":"https://api.github.com/repos/pypa/setuptools/issues/595/comments"},"review_comments":{"href":"https://api.github.com/repos/pypa/setuptools/pulls/595/comments"},"review_comment":{"href":"https://api.github.com/repos/pypa/setuptools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pypa/setuptools/pulls/595/commits"},"statuses":{"href":"https://api.github.com/repos/pypa/setuptools/statuses/ad5193d67242ee86276db626fdd25ade3024eec5"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":86,"deletions":83,"changed_files":1}}
{"actor":{"display_login":"anthrotype"}}