{"action":"created","issue":{"url":"https://api.github.com/repos/sagemathinc/smc/issues/70","repository_url":"https://api.github.com/repos/sagemathinc/smc","labels_url":"https://api.github.com/repos/sagemathinc/smc/issues/70/labels{/name}","comments_url":"https://api.github.com/repos/sagemathinc/smc/issues/70/comments","events_url":"https://api.github.com/repos/sagemathinc/smc/issues/70/events","html_url":"https://github.com/sagemathinc/smc/issues/70","id":102395609,"number":70,"title":"sagews syntax error after indentions","user":{"login":"haraldschilly","id":207405,"avatar_url":"https://avatars.githubusercontent.com/u/207405?v=3","gravatar_id":"","url":"https://api.github.com/users/haraldschilly","html_url":"https://github.com/haraldschilly","followers_url":"https://api.github.com/users/haraldschilly/followers","following_url":"https://api.github.com/users/haraldschilly/following{/other_user}","gists_url":"https://api.github.com/users/haraldschilly/gists{/gist_id}","starred_url":"https://api.github.com/users/haraldschilly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haraldschilly/subscriptions","organizations_url":"https://api.github.com/users/haraldschilly/orgs","repos_url":"https://api.github.com/users/haraldschilly/repos","events_url":"https://api.github.com/users/haraldschilly/events{/privacy}","received_events_url":"https://api.github.com/users/haraldschilly/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/sagemathinc/smc/labels/A-sagews","name":"A-sagews","color":"fbca04"},{"url":"https://api.github.com/repos/sagemathinc/smc/labels/I-bug","name":"I-bug","color":"cc0000"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2015-08-21T14:47:32Z","updated_at":"2016-08-05T00:40:13Z","closed_at":null,"body":"this gives a syntax error:\r\n```\r\nfor i in range(1):\r\n    pass\r\n'x'\r\n```\r\nor this\r\n```\r\nif True:\r\n    pass\r\n\"x\"\r\n```\r\nlike\r\n```\r\nError in lines 1-3\r\nTraceback (most recent call last):\r\n  File \"/projects/20e4a191-73ea-4921-80e9-0a5d792fc511/.sagemathcloud/sage_server.py\", line 879, in execute\r\n    exec compile(block+'\\n', '', 'single') in namespace, locals\r\n  File \"<string>\", line 3\r\n    'x'\r\n      ^\r\nSyntaxError: invalid syntax\r\n```\r\n\r\nwhile this works:\r\n\r\n```\r\ny = 2\r\n\"x\"\r\n```"},"comment":{"url":"https://api.github.com/repos/sagemathinc/smc/issues/comments/237726641","html_url":"https://github.com/sagemathinc/smc/issues/70#issuecomment-237726641","issue_url":"https://api.github.com/repos/sagemathinc/smc/issues/70","id":237726641,"user":{"login":"DrXyzzy","id":528072,"avatar_url":"https://avatars.githubusercontent.com/u/528072?v=3","gravatar_id":"","url":"https://api.github.com/users/DrXyzzy","html_url":"https://github.com/DrXyzzy","followers_url":"https://api.github.com/users/DrXyzzy/followers","following_url":"https://api.github.com/users/DrXyzzy/following{/other_user}","gists_url":"https://api.github.com/users/DrXyzzy/gists{/gist_id}","starred_url":"https://api.github.com/users/DrXyzzy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DrXyzzy/subscriptions","organizations_url":"https://api.github.com/users/DrXyzzy/orgs","repos_url":"https://api.github.com/users/DrXyzzy/repos","events_url":"https://api.github.com/users/DrXyzzy/events{/privacy}","received_events_url":"https://api.github.com/users/DrXyzzy/received_events","type":"User","site_admin":false},"created_at":"2016-08-05T00:40:13Z","updated_at":"2016-08-05T00:40:13Z","body":"Problem is caused by the last line starting with a string literal. Workaround is to put the literal in parens.\r\n\r\nExplanation: function [sage_parsing.divide_into_blocks](https://github.com/sagemathinc/smc/blob/master/src/smc_sagews/smc_sagews/sage_parsing.py#L219) merges a line that starts with a literal to the previous block. This causes `exec compile(block+'\\n', '', 'single')` to fail in [sage_server.Salvus.execute()](https://github.com/sagemathinc/smc/blob/master/src/smc_sagews/smc_sagews/sage_server.py#L947) because block is not a single statement.\r\n\r\nProblem goes away if check `code[i][:2] == '%('` is eliminated in the while statement near [sage_parsing.py:219](https://github.com/sagemathinc/smc/blob/master/src/smc_sagews/smc_sagews/sage_parsing.py#L219). Is there some other case that will fail if this test is removed?"}}
{"actor":{"display_login":"DrXyzzy"}}