{"action":"created","comment":{"url":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments/50478385","id":50478385,"diff_hunk":"@@ -430,22 +430,22 @@ defmodule File do\n   Typical error reasons are the same as in `open/2`,\n   `read/1` and `write/3`.\n   \"\"\"\n-  @spec copy(Path.t, Path.t, pos_integer | :infinity) :: {:ok, non_neg_integer} | {:error, posix}\n+  @spec copy(Path.t | io_device, Path.t | io_device, pos_integer | :infinity) :: {:ok, non_neg_integer} | {:error, posix}\n   def copy(source, destination, bytes_count \\\\ :infinity) do\n-    F.copy(IO.chardata_to_string(source), IO.chardata_to_string(destination), bytes_count)\n+    F.copy(maybe_to_string(source), maybe_to_string(destination), bytes_count)\n   end\n \n   @doc \"\"\"\n   The same as `copy/3` but raises an `File.CopyError` if it fails.\n   Returns the `bytes_copied` otherwise.\n   \"\"\"\n-  @spec copy!(Path.t, Path.t, pos_integer | :infinity) :: non_neg_integer | no_return\n+  @spec copy!(Path.t | io_device, Path.t | io_device, pos_integer | :infinity) :: non_neg_integer | no_return\n   def copy!(source, destination, bytes_count \\\\ :infinity) do\n     case copy(source, destination, bytes_count) do\n       {:ok, bytes_count} -> bytes_count\n       {:error, reason} ->\n         raise File.CopyError, reason: reason, action: \"copy\",\n-          source: IO.chardata_to_string(source), destination: IO.chardata_to_string(destination)\n+          source: maybe_to_string(source), destination: maybe_to_string(destination)","path":"lib/elixir/lib/file.ex","position":23,"original_position":23,"commit_id":"5d1695c718c1efc519e4e7ff18020f534904244e","original_commit_id":"d6e28e270da738612c606c29e015b915787176d8","user":{"login":"lexmag","id":248290,"avatar_url":"https://avatars.githubusercontent.com/u/248290?v=3","gravatar_id":"","url":"https://api.github.com/users/lexmag","html_url":"https://github.com/lexmag","followers_url":"https://api.github.com/users/lexmag/followers","following_url":"https://api.github.com/users/lexmag/following{/other_user}","gists_url":"https://api.github.com/users/lexmag/gists{/gist_id}","starred_url":"https://api.github.com/users/lexmag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lexmag/subscriptions","organizations_url":"https://api.github.com/users/lexmag/orgs","repos_url":"https://api.github.com/users/lexmag/repos","events_url":"https://api.github.com/users/lexmag/events{/privacy}","received_events_url":"https://api.github.com/users/lexmag/received_events","type":"User","site_admin":false},"body":"I'd say `inspect(source)`. And same for `destination` of course.","created_at":"2016-01-21T22:56:01Z","updated_at":"2016-01-21T22:56:01Z","html_url":"https://github.com/elixir-lang/elixir/pull/4217#discussion_r50478385","pull_request_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/4217","_links":{"self":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments/50478385"},"html":{"href":"https://github.com/elixir-lang/elixir/pull/4217#discussion_r50478385"},"pull_request":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/4217"}}},"pull_request":{"url":"https://api.github.com/repos/elixir-lang/elixir/pulls/4217","id":56821184,"html_url":"https://github.com/elixir-lang/elixir/pull/4217","diff_url":"https://github.com/elixir-lang/elixir/pull/4217.diff","patch_url":"https://github.com/elixir-lang/elixir/pull/4217.patch","issue_url":"https://api.github.com/repos/elixir-lang/elixir/issues/4217","number":4217,"state":"open","locked":false,"title":"Support passing io_device to File.copy/3","user":{"login":"sorentwo","id":270831,"avatar_url":"https://avatars.githubusercontent.com/u/270831?v=3","gravatar_id":"","url":"https://api.github.com/users/sorentwo","html_url":"https://github.com/sorentwo","followers_url":"https://api.github.com/users/sorentwo/followers","following_url":"https://api.github.com/users/sorentwo/following{/other_user}","gists_url":"https://api.github.com/users/sorentwo/gists{/gist_id}","starred_url":"https://api.github.com/users/sorentwo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sorentwo/subscriptions","organizations_url":"https://api.github.com/users/sorentwo/orgs","repos_url":"https://api.github.com/users/sorentwo/repos","events_url":"https://api.github.com/users/sorentwo/events{/privacy}","received_events_url":"https://api.github.com/users/sorentwo/received_events","type":"User","site_admin":false},"body":"Technically it is possible to pass an io_device to File.copy/3 as either the source, destination, or both. However, all input was being converted to a string, which fails for any non-binary data and prevents `:file.copy` from being reached.\r\n\r\nThis updates the typespec and conditionally converts chardata to a string.","created_at":"2016-01-21T22:44:41Z","updated_at":"2016-01-21T22:56:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4445c37f1b525e5654a35a79816984d3be3bde15","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/4217/commits","review_comments_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/4217/comments","review_comment_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elixir-lang/elixir/issues/4217/comments","statuses_url":"https://api.github.com/repos/elixir-lang/elixir/statuses/5d1695c718c1efc519e4e7ff18020f534904244e","head":{"label":"sorentwo:file-copy-iodevice","ref":"file-copy-iodevice","sha":"5d1695c718c1efc519e4e7ff18020f534904244e","user":{"login":"sorentwo","id":270831,"avatar_url":"https://avatars.githubusercontent.com/u/270831?v=3","gravatar_id":"","url":"https://api.github.com/users/sorentwo","html_url":"https://github.com/sorentwo","followers_url":"https://api.github.com/users/sorentwo/followers","following_url":"https://api.github.com/users/sorentwo/following{/other_user}","gists_url":"https://api.github.com/users/sorentwo/gists{/gist_id}","starred_url":"https://api.github.com/users/sorentwo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sorentwo/subscriptions","organizations_url":"https://api.github.com/users/sorentwo/orgs","repos_url":"https://api.github.com/users/sorentwo/repos","events_url":"https://api.github.com/users/sorentwo/events{/privacy}","received_events_url":"https://api.github.com/users/sorentwo/received_events","type":"User","site_admin":false},"repo":{"id":13472283,"name":"elixir","full_name":"sorentwo/elixir","owner":{"login":"sorentwo","id":270831,"avatar_url":"https://avatars.githubusercontent.com/u/270831?v=3","gravatar_id":"","url":"https://api.github.com/users/sorentwo","html_url":"https://github.com/sorentwo","followers_url":"https://api.github.com/users/sorentwo/followers","following_url":"https://api.github.com/users/sorentwo/following{/other_user}","gists_url":"https://api.github.com/users/sorentwo/gists{/gist_id}","starred_url":"https://api.github.com/users/sorentwo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sorentwo/subscriptions","organizations_url":"https://api.github.com/users/sorentwo/orgs","repos_url":"https://api.github.com/users/sorentwo/repos","events_url":"https://api.github.com/users/sorentwo/events{/privacy}","received_events_url":"https://api.github.com/users/sorentwo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sorentwo/elixir","description":"Elixir is a metaprogrammable, functional language built atop the Erlang VM. It is a dynamic language with hygienic macros that leverages Erlang's ability to build concurrent, distributed, and fault-tolerant applications with hot code upgrades.","fork":true,"url":"https://api.github.com/repos/sorentwo/elixir","forks_url":"https://api.github.com/repos/sorentwo/elixir/forks","keys_url":"https://api.github.com/repos/sorentwo/elixir/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sorentwo/elixir/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sorentwo/elixir/teams","hooks_url":"https://api.github.com/repos/sorentwo/elixir/hooks","issue_events_url":"https://api.github.com/repos/sorentwo/elixir/issues/events{/number}","events_url":"https://api.github.com/repos/sorentwo/elixir/events","assignees_url":"https://api.github.com/repos/sorentwo/elixir/assignees{/user}","branches_url":"https://api.github.com/repos/sorentwo/elixir/branches{/branch}","tags_url":"https://api.github.com/repos/sorentwo/elixir/tags","blobs_url":"https://api.github.com/repos/sorentwo/elixir/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sorentwo/elixir/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sorentwo/elixir/git/refs{/sha}","trees_url":"https://api.github.com/repos/sorentwo/elixir/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sorentwo/elixir/statuses/{sha}","languages_url":"https://api.github.com/repos/sorentwo/elixir/languages","stargazers_url":"https://api.github.com/repos/sorentwo/elixir/stargazers","contributors_url":"https://api.github.com/repos/sorentwo/elixir/contributors","subscribers_url":"https://api.github.com/repos/sorentwo/elixir/subscribers","subscription_url":"https://api.github.com/repos/sorentwo/elixir/subscription","commits_url":"https://api.github.com/repos/sorentwo/elixir/commits{/sha}","git_commits_url":"https://api.github.com/repos/sorentwo/elixir/git/commits{/sha}","comments_url":"https://api.github.com/repos/sorentwo/elixir/comments{/number}","issue_comment_url":"https://api.github.com/repos/sorentwo/elixir/issues/comments{/number}","contents_url":"https://api.github.com/repos/sorentwo/elixir/contents/{+path}","compare_url":"https://api.github.com/repos/sorentwo/elixir/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sorentwo/elixir/merges","archive_url":"https://api.github.com/repos/sorentwo/elixir/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sorentwo/elixir/downloads","issues_url":"https://api.github.com/repos/sorentwo/elixir/issues{/number}","pulls_url":"https://api.github.com/repos/sorentwo/elixir/pulls{/number}","milestones_url":"https://api.github.com/repos/sorentwo/elixir/milestones{/number}","notifications_url":"https://api.github.com/repos/sorentwo/elixir/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sorentwo/elixir/labels{/name}","releases_url":"https://api.github.com/repos/sorentwo/elixir/releases{/id}","created_at":"2013-10-10T13:39:39Z","updated_at":"2016-01-06T18:01:41Z","pushed_at":"2016-01-21T22:50:44Z","git_url":"git://github.com/sorentwo/elixir.git","ssh_url":"git@github.com:sorentwo/elixir.git","clone_url":"https://github.com/sorentwo/elixir.git","svn_url":"https://github.com/sorentwo/elixir","homepage":"http://elixir-lang.org/","size":32796,"stargazers_count":0,"watchers_count":0,"language":"Elixir","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"elixir-lang:master","ref":"master","sha":"cf1bf914b9ce47eb39530c75f5f8b1a7b204866c","user":{"login":"elixir-lang","id":1481354,"avatar_url":"https://avatars.githubusercontent.com/u/1481354?v=3","gravatar_id":"","url":"https://api.github.com/users/elixir-lang","html_url":"https://github.com/elixir-lang","followers_url":"https://api.github.com/users/elixir-lang/followers","following_url":"https://api.github.com/users/elixir-lang/following{/other_user}","gists_url":"https://api.github.com/users/elixir-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/elixir-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elixir-lang/subscriptions","organizations_url":"https://api.github.com/users/elixir-lang/orgs","repos_url":"https://api.github.com/users/elixir-lang/repos","events_url":"https://api.github.com/users/elixir-lang/events{/privacy}","received_events_url":"https://api.github.com/users/elixir-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":1234714,"name":"elixir","full_name":"elixir-lang/elixir","owner":{"login":"elixir-lang","id":1481354,"avatar_url":"https://avatars.githubusercontent.com/u/1481354?v=3","gravatar_id":"","url":"https://api.github.com/users/elixir-lang","html_url":"https://github.com/elixir-lang","followers_url":"https://api.github.com/users/elixir-lang/followers","following_url":"https://api.github.com/users/elixir-lang/following{/other_user}","gists_url":"https://api.github.com/users/elixir-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/elixir-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elixir-lang/subscriptions","organizations_url":"https://api.github.com/users/elixir-lang/orgs","repos_url":"https://api.github.com/users/elixir-lang/repos","events_url":"https://api.github.com/users/elixir-lang/events{/privacy}","received_events_url":"https://api.github.com/users/elixir-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elixir-lang/elixir","description":"Elixir is a dynamic, functional language designed for building scalable and maintainable applications","fork":false,"url":"https://api.github.com/repos/elixir-lang/elixir","forks_url":"https://api.github.com/repos/elixir-lang/elixir/forks","keys_url":"https://api.github.com/repos/elixir-lang/elixir/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elixir-lang/elixir/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elixir-lang/elixir/teams","hooks_url":"https://api.github.com/repos/elixir-lang/elixir/hooks","issue_events_url":"https://api.github.com/repos/elixir-lang/elixir/issues/events{/number}","events_url":"https://api.github.com/repos/elixir-lang/elixir/events","assignees_url":"https://api.github.com/repos/elixir-lang/elixir/assignees{/user}","branches_url":"https://api.github.com/repos/elixir-lang/elixir/branches{/branch}","tags_url":"https://api.github.com/repos/elixir-lang/elixir/tags","blobs_url":"https://api.github.com/repos/elixir-lang/elixir/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elixir-lang/elixir/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elixir-lang/elixir/git/refs{/sha}","trees_url":"https://api.github.com/repos/elixir-lang/elixir/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elixir-lang/elixir/statuses/{sha}","languages_url":"https://api.github.com/repos/elixir-lang/elixir/languages","stargazers_url":"https://api.github.com/repos/elixir-lang/elixir/stargazers","contributors_url":"https://api.github.com/repos/elixir-lang/elixir/contributors","subscribers_url":"https://api.github.com/repos/elixir-lang/elixir/subscribers","subscription_url":"https://api.github.com/repos/elixir-lang/elixir/subscription","commits_url":"https://api.github.com/repos/elixir-lang/elixir/commits{/sha}","git_commits_url":"https://api.github.com/repos/elixir-lang/elixir/git/commits{/sha}","comments_url":"https://api.github.com/repos/elixir-lang/elixir/comments{/number}","issue_comment_url":"https://api.github.com/repos/elixir-lang/elixir/issues/comments{/number}","contents_url":"https://api.github.com/repos/elixir-lang/elixir/contents/{+path}","compare_url":"https://api.github.com/repos/elixir-lang/elixir/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elixir-lang/elixir/merges","archive_url":"https://api.github.com/repos/elixir-lang/elixir/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elixir-lang/elixir/downloads","issues_url":"https://api.github.com/repos/elixir-lang/elixir/issues{/number}","pulls_url":"https://api.github.com/repos/elixir-lang/elixir/pulls{/number}","milestones_url":"https://api.github.com/repos/elixir-lang/elixir/milestones{/number}","notifications_url":"https://api.github.com/repos/elixir-lang/elixir/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elixir-lang/elixir/labels{/name}","releases_url":"https://api.github.com/repos/elixir-lang/elixir/releases{/id}","created_at":"2011-01-09T08:43:57Z","updated_at":"2016-01-21T22:03:49Z","pushed_at":"2016-01-21T22:50:44Z","git_url":"git://github.com/elixir-lang/elixir.git","ssh_url":"git@github.com:elixir-lang/elixir.git","clone_url":"https://github.com/elixir-lang/elixir.git","svn_url":"https://github.com/elixir-lang/elixir","homepage":"http://elixir-lang.org/","size":41292,"stargazers_count":6045,"watchers_count":6045,"language":"Elixir","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":829,"mirror_url":null,"open_issues_count":48,"forks":829,"open_issues":48,"watchers":6045,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/4217"},"html":{"href":"https://github.com/elixir-lang/elixir/pull/4217"},"issue":{"href":"https://api.github.com/repos/elixir-lang/elixir/issues/4217"},"comments":{"href":"https://api.github.com/repos/elixir-lang/elixir/issues/4217/comments"},"review_comments":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/4217/comments"},"review_comment":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/4217/commits"},"statuses":{"href":"https://api.github.com/repos/elixir-lang/elixir/statuses/5d1695c718c1efc519e4e7ff18020f534904244e"}}}}