{"action":"created","comment":{"url":"https://api.github.com/repos/Pylons/pyramid/pulls/comments/43276399","id":43276399,"diff_hunk":"@@ -887,11 +889,28 @@ def check_reload(self):\n                 continue\n             if filename.endswith('.pyc') and os.path.exists(filename[:-1]):\n                 mtime = max(os.stat(filename[:-1]).st_mtime, mtime)\n+                pyc = True\n+            else:\n+                pyc = False\n             if filename not in self.module_mtimes:\n                 self.module_mtimes[filename] = mtime\n             elif self.module_mtimes[filename] < mtime:\n-                print(\"%s changed; reloading...\" % filename)\n-                return False\n+                if pyc:\n+                    filename = filename[:-1]\n+                # check if a file has syntax errors. If so, track it until it's fixed\n+                for filename_promise in self.syntax_error_files + [filename]:\n+                    try:\n+                        py_compile.compile(filename_promise, doraise=True)\n+                    except py_compile.PyCompileError:\n+                        print(\"%s has a SyntaxError; NOT reloading.\" % filename_promise)","path":"pyramid/scripts/pserve.py","position":44,"original_position":44,"commit_id":"315b19e8ea997f6b10c23dffa65d831aa42f3563","original_commit_id":"315b19e8ea997f6b10c23dffa65d831aa42f3563","user":{"login":"mmerickel","id":487237,"avatar_url":"https://avatars.githubusercontent.com/u/487237?v=3","gravatar_id":"","url":"https://api.github.com/users/mmerickel","html_url":"https://github.com/mmerickel","followers_url":"https://api.github.com/users/mmerickel/followers","following_url":"https://api.github.com/users/mmerickel/following{/other_user}","gists_url":"https://api.github.com/users/mmerickel/gists{/gist_id}","starred_url":"https://api.github.com/users/mmerickel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmerickel/subscriptions","organizations_url":"https://api.github.com/users/mmerickel/orgs","repos_url":"https://api.github.com/users/mmerickel/repos","events_url":"https://api.github.com/users/mmerickel/events{/privacy}","received_events_url":"https://api.github.com/users/mmerickel/received_events","type":"User","site_admin":false},"body":"We need to add a test and tweak the code to use the mockable `out` method instead of `print`.","created_at":"2015-10-28T16:02:41Z","updated_at":"2015-10-28T16:02:41Z","html_url":"https://github.com/Pylons/pyramid/pull/2044#discussion_r43276399","pull_request_url":"https://api.github.com/repos/Pylons/pyramid/pulls/2044","_links":{"self":{"href":"https://api.github.com/repos/Pylons/pyramid/pulls/comments/43276399"},"html":{"href":"https://github.com/Pylons/pyramid/pull/2044#discussion_r43276399"},"pull_request":{"href":"https://api.github.com/repos/Pylons/pyramid/pulls/2044"}}},"pull_request":{"url":"https://api.github.com/repos/Pylons/pyramid/pulls/2044","id":48849224,"html_url":"https://github.com/Pylons/pyramid/pull/2044","diff_url":"https://github.com/Pylons/pyramid/pull/2044.diff","patch_url":"https://github.com/Pylons/pyramid/pull/2044.patch","issue_url":"https://api.github.com/repos/Pylons/pyramid/issues/2044","number":2044,"state":"open","locked":false,"title":"pserve: track files with SyntaxError and skip reload","user":{"login":"domenkozar","id":126339,"avatar_url":"https://avatars.githubusercontent.com/u/126339?v=3","gravatar_id":"","url":"https://api.github.com/users/domenkozar","html_url":"https://github.com/domenkozar","followers_url":"https://api.github.com/users/domenkozar/followers","following_url":"https://api.github.com/users/domenkozar/following{/other_user}","gists_url":"https://api.github.com/users/domenkozar/gists{/gist_id}","starred_url":"https://api.github.com/users/domenkozar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/domenkozar/subscriptions","organizations_url":"https://api.github.com/users/domenkozar/orgs","repos_url":"https://api.github.com/users/domenkozar/repos","events_url":"https://api.github.com/users/domenkozar/events{/privacy}","received_events_url":"https://api.github.com/users/domenkozar/received_events","type":"User","site_admin":false},"body":"Current implementation tries to compile changed file and keeps a list (would be better to use a set) of syntax error files. Until that list exists, it won't reload.\r\n\r\nThere is a possible race condition if one would save a file with no syntax error and then quickly another file with a syntax error. Hard to solve that with current implementation.\r\n\r\nThe downside of this approach is, it prints error to stdout all the time while syntaxerror is present.\r\n\r\nFixes #681","created_at":"2015-10-27T10:01:25Z","updated_at":"2015-10-28T16:02:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7a1ccad4ec1d071ae17725ae3d401f7fe53f2bfa","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Pylons/pyramid/pulls/2044/commits","review_comments_url":"https://api.github.com/repos/Pylons/pyramid/pulls/2044/comments","review_comment_url":"https://api.github.com/repos/Pylons/pyramid/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Pylons/pyramid/issues/2044/comments","statuses_url":"https://api.github.com/repos/Pylons/pyramid/statuses/315b19e8ea997f6b10c23dffa65d831aa42f3563","head":{"label":"Pylons:pserve_reload_syntaxerror_handler","ref":"pserve_reload_syntaxerror_handler","sha":"315b19e8ea997f6b10c23dffa65d831aa42f3563","user":{"login":"Pylons","id":452227,"avatar_url":"https://avatars.githubusercontent.com/u/452227?v=3","gravatar_id":"","url":"https://api.github.com/users/Pylons","html_url":"https://github.com/Pylons","followers_url":"https://api.github.com/users/Pylons/followers","following_url":"https://api.github.com/users/Pylons/following{/other_user}","gists_url":"https://api.github.com/users/Pylons/gists{/gist_id}","starred_url":"https://api.github.com/users/Pylons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pylons/subscriptions","organizations_url":"https://api.github.com/users/Pylons/orgs","repos_url":"https://api.github.com/users/Pylons/repos","events_url":"https://api.github.com/users/Pylons/events{/privacy}","received_events_url":"https://api.github.com/users/Pylons/received_events","type":"Organization","site_admin":false},"repo":{"id":1020639,"name":"pyramid","full_name":"Pylons/pyramid","owner":{"login":"Pylons","id":452227,"avatar_url":"https://avatars.githubusercontent.com/u/452227?v=3","gravatar_id":"","url":"https://api.github.com/users/Pylons","html_url":"https://github.com/Pylons","followers_url":"https://api.github.com/users/Pylons/followers","following_url":"https://api.github.com/users/Pylons/following{/other_user}","gists_url":"https://api.github.com/users/Pylons/gists{/gist_id}","starred_url":"https://api.github.com/users/Pylons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pylons/subscriptions","organizations_url":"https://api.github.com/users/Pylons/orgs","repos_url":"https://api.github.com/users/Pylons/repos","events_url":"https://api.github.com/users/Pylons/events{/privacy}","received_events_url":"https://api.github.com/users/Pylons/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Pylons/pyramid","description":"Pyramid web framework","fork":false,"url":"https://api.github.com/repos/Pylons/pyramid","forks_url":"https://api.github.com/repos/Pylons/pyramid/forks","keys_url":"https://api.github.com/repos/Pylons/pyramid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Pylons/pyramid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Pylons/pyramid/teams","hooks_url":"https://api.github.com/repos/Pylons/pyramid/hooks","issue_events_url":"https://api.github.com/repos/Pylons/pyramid/issues/events{/number}","events_url":"https://api.github.com/repos/Pylons/pyramid/events","assignees_url":"https://api.github.com/repos/Pylons/pyramid/assignees{/user}","branches_url":"https://api.github.com/repos/Pylons/pyramid/branches{/branch}","tags_url":"https://api.github.com/repos/Pylons/pyramid/tags","blobs_url":"https://api.github.com/repos/Pylons/pyramid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Pylons/pyramid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Pylons/pyramid/git/refs{/sha}","trees_url":"https://api.github.com/repos/Pylons/pyramid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Pylons/pyramid/statuses/{sha}","languages_url":"https://api.github.com/repos/Pylons/pyramid/languages","stargazers_url":"https://api.github.com/repos/Pylons/pyramid/stargazers","contributors_url":"https://api.github.com/repos/Pylons/pyramid/contributors","subscribers_url":"https://api.github.com/repos/Pylons/pyramid/subscribers","subscription_url":"https://api.github.com/repos/Pylons/pyramid/subscription","commits_url":"https://api.github.com/repos/Pylons/pyramid/commits{/sha}","git_commits_url":"https://api.github.com/repos/Pylons/pyramid/git/commits{/sha}","comments_url":"https://api.github.com/repos/Pylons/pyramid/comments{/number}","issue_comment_url":"https://api.github.com/repos/Pylons/pyramid/issues/comments{/number}","contents_url":"https://api.github.com/repos/Pylons/pyramid/contents/{+path}","compare_url":"https://api.github.com/repos/Pylons/pyramid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Pylons/pyramid/merges","archive_url":"https://api.github.com/repos/Pylons/pyramid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Pylons/pyramid/downloads","issues_url":"https://api.github.com/repos/Pylons/pyramid/issues{/number}","pulls_url":"https://api.github.com/repos/Pylons/pyramid/pulls{/number}","milestones_url":"https://api.github.com/repos/Pylons/pyramid/milestones{/number}","notifications_url":"https://api.github.com/repos/Pylons/pyramid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Pylons/pyramid/labels{/name}","releases_url":"https://api.github.com/repos/Pylons/pyramid/releases{/id}","created_at":"2010-10-24T22:00:35Z","updated_at":"2015-10-28T14:57:08Z","pushed_at":"2015-10-28T08:14:12Z","git_url":"git://github.com/Pylons/pyramid.git","ssh_url":"git@github.com:Pylons/pyramid.git","clone_url":"https://github.com/Pylons/pyramid.git","svn_url":"https://github.com/Pylons/pyramid","homepage":"http://docs.pylonsproject.org/en/latest/docs/pyramid.html","size":33212,"stargazers_count":1800,"watchers_count":1800,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":617,"mirror_url":null,"open_issues_count":130,"forks":617,"open_issues":130,"watchers":1800,"default_branch":"master"}},"base":{"label":"Pylons:master","ref":"master","sha":"b2f8c871ae49f2d48c8a990e6a0ee2ed70a27234","user":{"login":"Pylons","id":452227,"avatar_url":"https://avatars.githubusercontent.com/u/452227?v=3","gravatar_id":"","url":"https://api.github.com/users/Pylons","html_url":"https://github.com/Pylons","followers_url":"https://api.github.com/users/Pylons/followers","following_url":"https://api.github.com/users/Pylons/following{/other_user}","gists_url":"https://api.github.com/users/Pylons/gists{/gist_id}","starred_url":"https://api.github.com/users/Pylons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pylons/subscriptions","organizations_url":"https://api.github.com/users/Pylons/orgs","repos_url":"https://api.github.com/users/Pylons/repos","events_url":"https://api.github.com/users/Pylons/events{/privacy}","received_events_url":"https://api.github.com/users/Pylons/received_events","type":"Organization","site_admin":false},"repo":{"id":1020639,"name":"pyramid","full_name":"Pylons/pyramid","owner":{"login":"Pylons","id":452227,"avatar_url":"https://avatars.githubusercontent.com/u/452227?v=3","gravatar_id":"","url":"https://api.github.com/users/Pylons","html_url":"https://github.com/Pylons","followers_url":"https://api.github.com/users/Pylons/followers","following_url":"https://api.github.com/users/Pylons/following{/other_user}","gists_url":"https://api.github.com/users/Pylons/gists{/gist_id}","starred_url":"https://api.github.com/users/Pylons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pylons/subscriptions","organizations_url":"https://api.github.com/users/Pylons/orgs","repos_url":"https://api.github.com/users/Pylons/repos","events_url":"https://api.github.com/users/Pylons/events{/privacy}","received_events_url":"https://api.github.com/users/Pylons/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Pylons/pyramid","description":"Pyramid web framework","fork":false,"url":"https://api.github.com/repos/Pylons/pyramid","forks_url":"https://api.github.com/repos/Pylons/pyramid/forks","keys_url":"https://api.github.com/repos/Pylons/pyramid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Pylons/pyramid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Pylons/pyramid/teams","hooks_url":"https://api.github.com/repos/Pylons/pyramid/hooks","issue_events_url":"https://api.github.com/repos/Pylons/pyramid/issues/events{/number}","events_url":"https://api.github.com/repos/Pylons/pyramid/events","assignees_url":"https://api.github.com/repos/Pylons/pyramid/assignees{/user}","branches_url":"https://api.github.com/repos/Pylons/pyramid/branches{/branch}","tags_url":"https://api.github.com/repos/Pylons/pyramid/tags","blobs_url":"https://api.github.com/repos/Pylons/pyramid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Pylons/pyramid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Pylons/pyramid/git/refs{/sha}","trees_url":"https://api.github.com/repos/Pylons/pyramid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Pylons/pyramid/statuses/{sha}","languages_url":"https://api.github.com/repos/Pylons/pyramid/languages","stargazers_url":"https://api.github.com/repos/Pylons/pyramid/stargazers","contributors_url":"https://api.github.com/repos/Pylons/pyramid/contributors","subscribers_url":"https://api.github.com/repos/Pylons/pyramid/subscribers","subscription_url":"https://api.github.com/repos/Pylons/pyramid/subscription","commits_url":"https://api.github.com/repos/Pylons/pyramid/commits{/sha}","git_commits_url":"https://api.github.com/repos/Pylons/pyramid/git/commits{/sha}","comments_url":"https://api.github.com/repos/Pylons/pyramid/comments{/number}","issue_comment_url":"https://api.github.com/repos/Pylons/pyramid/issues/comments{/number}","contents_url":"https://api.github.com/repos/Pylons/pyramid/contents/{+path}","compare_url":"https://api.github.com/repos/Pylons/pyramid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Pylons/pyramid/merges","archive_url":"https://api.github.com/repos/Pylons/pyramid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Pylons/pyramid/downloads","issues_url":"https://api.github.com/repos/Pylons/pyramid/issues{/number}","pulls_url":"https://api.github.com/repos/Pylons/pyramid/pulls{/number}","milestones_url":"https://api.github.com/repos/Pylons/pyramid/milestones{/number}","notifications_url":"https://api.github.com/repos/Pylons/pyramid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Pylons/pyramid/labels{/name}","releases_url":"https://api.github.com/repos/Pylons/pyramid/releases{/id}","created_at":"2010-10-24T22:00:35Z","updated_at":"2015-10-28T14:57:08Z","pushed_at":"2015-10-28T08:14:12Z","git_url":"git://github.com/Pylons/pyramid.git","ssh_url":"git@github.com:Pylons/pyramid.git","clone_url":"https://github.com/Pylons/pyramid.git","svn_url":"https://github.com/Pylons/pyramid","homepage":"http://docs.pylonsproject.org/en/latest/docs/pyramid.html","size":33212,"stargazers_count":1800,"watchers_count":1800,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":617,"mirror_url":null,"open_issues_count":130,"forks":617,"open_issues":130,"watchers":1800,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Pylons/pyramid/pulls/2044"},"html":{"href":"https://github.com/Pylons/pyramid/pull/2044"},"issue":{"href":"https://api.github.com/repos/Pylons/pyramid/issues/2044"},"comments":{"href":"https://api.github.com/repos/Pylons/pyramid/issues/2044/comments"},"review_comments":{"href":"https://api.github.com/repos/Pylons/pyramid/pulls/2044/comments"},"review_comment":{"href":"https://api.github.com/repos/Pylons/pyramid/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Pylons/pyramid/pulls/2044/commits"},"statuses":{"href":"https://api.github.com/repos/Pylons/pyramid/statuses/315b19e8ea997f6b10c23dffa65d831aa42f3563"}}}}