{"action":"created","issue":{"url":"https://api.github.com/repos/brython-dev/brython/issues/121","labels_url":"https://api.github.com/repos/brython-dev/brython/issues/121/labels{/name}","comments_url":"https://api.github.com/repos/brython-dev/brython/issues/121/comments","events_url":"https://api.github.com/repos/brython-dev/brython/issues/121/events","html_url":"https://github.com/brython-dev/brython/issues/121","id":55882577,"number":121,"title":"nested scopes are overwritten when the enclosing function is called again","user":{"login":"glyph","id":716529,"avatar_url":"https://avatars.githubusercontent.com/u/716529?v=3","gravatar_id":"","url":"https://api.github.com/users/glyph","html_url":"https://github.com/glyph","followers_url":"https://api.github.com/users/glyph/followers","following_url":"https://api.github.com/users/glyph/following{/other_user}","gists_url":"https://api.github.com/users/glyph/gists{/gist_id}","starred_url":"https://api.github.com/users/glyph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glyph/subscriptions","organizations_url":"https://api.github.com/users/glyph/orgs","repos_url":"https://api.github.com/users/glyph/repos","events_url":"https://api.github.com/users/glyph/events{/privacy}","received_events_url":"https://api.github.com/users/glyph/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"PierreQuentel","id":3447215,"avatar_url":"https://avatars.githubusercontent.com/u/3447215?v=3","gravatar_id":"","url":"https://api.github.com/users/PierreQuentel","html_url":"https://github.com/PierreQuentel","followers_url":"https://api.github.com/users/PierreQuentel/followers","following_url":"https://api.github.com/users/PierreQuentel/following{/other_user}","gists_url":"https://api.github.com/users/PierreQuentel/gists{/gist_id}","starred_url":"https://api.github.com/users/PierreQuentel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PierreQuentel/subscriptions","organizations_url":"https://api.github.com/users/PierreQuentel/orgs","repos_url":"https://api.github.com/users/PierreQuentel/repos","events_url":"https://api.github.com/users/PierreQuentel/events{/privacy}","received_events_url":"https://api.github.com/users/PierreQuentel/received_events","type":"User","site_admin":false},"milestone":null,"comments":34,"created_at":"2015-01-29T10:35:05Z","updated_at":"2015-02-20T23:33:44Z","closed_at":null,"body":"To start, let me say that I know that this is a terrible bug report; I tried to get a minimal reproducing case and I was unable to do so.  I'm reporting it in the hopes that someone who knows brython's internals better than I do might be able to point me in the right direction to reproduce it.\r\n\r\nI'm working on a Brython-compatible port of Twisted's Deferred, here: https://github.com/glyph/deferred/tree/brython.  This is in service of creating a client-side framework sort sharing idioms with Twisted, here: https://github.com/glyph/brytly.\r\n\r\nThe problem is here:\r\n\r\nhttps://github.com/glyph/brytly/blob/master/brytly/phantestic.py#L29\r\n\r\nBasically, I have the same `lambda` callback either way; but if I define it *in the arg list* of `addBoth`, then it appears `self` takes on the wrong value in its closure.  You can see that if you load up `test.html` in a browser (after symlinking both these projects into `site-packages` in a brython checkout, which is the only way I've figured out how to \"install\" stuff, hence my filing of #119) with the assigned-to-a-variable lambda, the test run completes, but with the defined-in-the-arg-list lambda, it gets stuck and runs `SuiteRun.keepGoing` for `MyTest` twice, instead of properly running it once for `MyTest` and then once for the `Root` suite generated by the framework.\r\n\r\nAgain, sorry I couldn't make this example more minimal; it seems to be a very tricky failure mode.\r\n\r\nBy the way, I should note that Brython has come a *long* way in the last year - when I first took a look at doing this it would have been basically impossible.  So thanks a lot for all the hard work!"},"comment":{"url":"https://api.github.com/repos/brython-dev/brython/issues/comments/75339150","html_url":"https://github.com/brython-dev/brython/issues/121#issuecomment-75339150","issue_url":"https://api.github.com/repos/brython-dev/brython/issues/121","id":75339150,"user":{"login":"glyph","id":716529,"avatar_url":"https://avatars.githubusercontent.com/u/716529?v=3","gravatar_id":"","url":"https://api.github.com/users/glyph","html_url":"https://github.com/glyph","followers_url":"https://api.github.com/users/glyph/followers","following_url":"https://api.github.com/users/glyph/following{/other_user}","gists_url":"https://api.github.com/users/glyph/gists{/gist_id}","starred_url":"https://api.github.com/users/glyph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glyph/subscriptions","organizations_url":"https://api.github.com/users/glyph/orgs","repos_url":"https://api.github.com/users/glyph/repos","events_url":"https://api.github.com/users/glyph/events{/privacy}","received_events_url":"https://api.github.com/users/glyph/received_events","type":"User","site_admin":false},"created_at":"2015-02-20T23:33:44Z","updated_at":"2015-02-20T23:33:44Z","body":"@PierreQuentel Thank you *so* much for working on this.  I'm really glad my help was useful to you.  It looks like the implementation is much simpler – despite the addition of a bunch of whitespace, the diffstat says \"499 additions and 529 deletions\" – and I personally find the new implementation easier to understand as well.  Perhaps I will be able to hack on it more directly in the future :)."}}