{"action":"created","issue":{"url":"https://api.github.com/repos/DRMacIver/hypothesis/issues/145","labels_url":"https://api.github.com/repos/DRMacIver/hypothesis/issues/145/labels{/name}","comments_url":"https://api.github.com/repos/DRMacIver/hypothesis/issues/145/comments","events_url":"https://api.github.com/repos/DRMacIver/hypothesis/issues/145/events","html_url":"https://github.com/DRMacIver/hypothesis/pull/145","id":105609838,"number":145,"title":"Avoid races when execing source as modules.","user":{"login":"Lukasa","id":1382556,"avatar_url":"https://avatars.githubusercontent.com/u/1382556?v=3","gravatar_id":"","url":"https://api.github.com/users/Lukasa","html_url":"https://github.com/Lukasa","followers_url":"https://api.github.com/users/Lukasa/followers","following_url":"https://api.github.com/users/Lukasa/following{/other_user}","gists_url":"https://api.github.com/users/Lukasa/gists{/gist_id}","starred_url":"https://api.github.com/users/Lukasa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lukasa/subscriptions","organizations_url":"https://api.github.com/users/Lukasa/orgs","repos_url":"https://api.github.com/users/Lukasa/repos","events_url":"https://api.github.com/users/Lukasa/events{/privacy}","received_events_url":"https://api.github.com/users/Lukasa/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-09T14:36:17Z","updated_at":"2015-09-09T14:40:13Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/DRMacIver/hypothesis/pulls/145","html_url":"https://github.com/DRMacIver/hypothesis/pull/145","diff_url":"https://github.com/DRMacIver/hypothesis/pull/145.diff","patch_url":"https://github.com/DRMacIver/hypothesis/pull/145.patch"},"body":"Resolves #143.\r\n\r\nThis change adjusts the logic when compiling source into a module and then importing it. Previously this could race, as multiple test processes running in parallel could attempt to write the same file at roughly the same time. This change prevents that by ensuring that each process writes to a unique file (by using a UUID4 in the filename), and then atomically renaming the file to the proper name.\r\n\r\nOn Windows this is a bit tricky because `os.rename` raises an `OSError` if the destination exists, so we allow for that. Otherwise, `os.rename` is atomic so this should be fine: no file should ever be empty.\r\n\r\nCurrently there are no tests here, I'm going to think about how best to test this, but I wanted the change up for review ASAP.\r\n\r\nConsider this change a gift from your friends at HP!"},"comment":{"url":"https://api.github.com/repos/DRMacIver/hypothesis/issues/comments/138931787","html_url":"https://github.com/DRMacIver/hypothesis/pull/145#issuecomment-138931787","issue_url":"https://api.github.com/repos/DRMacIver/hypothesis/issues/145","id":138931787,"user":{"login":"DRMacIver","id":28623,"avatar_url":"https://avatars.githubusercontent.com/u/28623?v=3","gravatar_id":"","url":"https://api.github.com/users/DRMacIver","html_url":"https://github.com/DRMacIver","followers_url":"https://api.github.com/users/DRMacIver/followers","following_url":"https://api.github.com/users/DRMacIver/following{/other_user}","gists_url":"https://api.github.com/users/DRMacIver/gists{/gist_id}","starred_url":"https://api.github.com/users/DRMacIver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DRMacIver/subscriptions","organizations_url":"https://api.github.com/users/DRMacIver/orgs","repos_url":"https://api.github.com/users/DRMacIver/repos","events_url":"https://api.github.com/users/DRMacIver/events{/privacy}","received_events_url":"https://api.github.com/users/DRMacIver/received_events","type":"User","site_admin":false},"created_at":"2015-09-09T14:40:13Z","updated_at":"2015-09-09T14:40:13Z","body":"Thanks for this! Reviewing now."}}