{"action":"created","issue":{"url":"https://api.github.com/repos/construct/construct/issues/416","repository_url":"https://api.github.com/repos/construct/construct","labels_url":"https://api.github.com/repos/construct/construct/issues/416/labels{/name}","comments_url":"https://api.github.com/repos/construct/construct/issues/416/comments","events_url":"https://api.github.com/repos/construct/construct/issues/416/events","html_url":"https://github.com/construct/construct/issues/416","id":281166522,"number":416,"title":"Regression from enum rework","user":{"login":"rytilahti","id":3705853,"avatar_url":"https://avatars3.githubusercontent.com/u/3705853?v=4","gravatar_id":"","url":"https://api.github.com/users/rytilahti","html_url":"https://github.com/rytilahti","followers_url":"https://api.github.com/users/rytilahti/followers","following_url":"https://api.github.com/users/rytilahti/following{/other_user}","gists_url":"https://api.github.com/users/rytilahti/gists{/gist_id}","starred_url":"https://api.github.com/users/rytilahti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rytilahti/subscriptions","organizations_url":"https://api.github.com/users/rytilahti/orgs","repos_url":"https://api.github.com/users/rytilahti/repos","events_url":"https://api.github.com/users/rytilahti/events{/privacy}","received_events_url":"https://api.github.com/users/rytilahti/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-12-11T21:04:20Z","updated_at":"2017-12-11T22:05:40Z","closed_at":"2017-12-11T22:05:40Z","author_association":"NONE","body":"Hi,\r\n\r\nlooks like the newest release breaks something which used to work in 2.8.16:\r\n\r\n* https://github.com/rytilahti/python-miio/pull/140\r\n* https://github.com/home-assistant/home-assistant/issues/11048 (experiences)\r\n\r\nI was able to bisect the breakage to this commit: https://github.com/construct/construct/commit/3c6714d22a55656e265a8d4cd43e6aaeab4c7641 .\r\n\r\nAny ideas what is the best approach to fix it? The corresponding code is in https://github.com/rytilahti/python-miio/blob/master/miio/protocol.py#L193 . \r\n\r\nAs that information is not really used in my code, I could just remove the enum and leave it to be a non-capture 16b value, however I thought it's worth reporting as it may break also code of others."},"comment":{"url":"https://api.github.com/repos/construct/construct/issues/comments/350873764","html_url":"https://github.com/construct/construct/issues/416#issuecomment-350873764","issue_url":"https://api.github.com/repos/construct/construct/issues/416","id":350873764,"user":{"login":"rytilahti","id":3705853,"avatar_url":"https://avatars3.githubusercontent.com/u/3705853?v=4","gravatar_id":"","url":"https://api.github.com/users/rytilahti","html_url":"https://github.com/rytilahti","followers_url":"https://api.github.com/users/rytilahti/followers","following_url":"https://api.github.com/users/rytilahti/following{/other_user}","gists_url":"https://api.github.com/users/rytilahti/gists{/gist_id}","starred_url":"https://api.github.com/users/rytilahti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rytilahti/subscriptions","organizations_url":"https://api.github.com/users/rytilahti/orgs","repos_url":"https://api.github.com/users/rytilahti/repos","events_url":"https://api.github.com/users/rytilahti/events{/privacy}","received_events_url":"https://api.github.com/users/rytilahti/received_events","type":"User","site_admin":false},"created_at":"2017-12-11T22:05:40Z","updated_at":"2017-12-11T22:05:40Z","author_association":"NONE","body":"Yup, here's a minimal working example:\r\n```\r\nfrom construct import Enum, Default, Pass, Int16ub\r\n\r\nx = Enum(Default(Int16ub, 0x02f2), default=Pass, test=0x02f2)\r\nexisting = x.build(0x02f2)\r\nprint(existing)\r\nparsed = x.parse(existing)\r\nprint(parsed)\r\nnon_existing = x.build(0x02f3)\r\nprint(non_existing)\r\n```\r\n\r\nand outputs;\r\n2.8.16:\r\n```\r\n$ python test.py\r\nb'\\x02\\xf2'\r\ntest\r\nb'\\x02\\xf3'\r\n```\r\nand 2.8.17:\r\n```\r\n$ python test.py\r\nb'\\x02\\xf2'\r\ntest\r\nb''\r\n```\r\n\r\nBut as you said it's an expected behavior, so I'm closing this bug.\r\n\r\nThanks for your input and your work on this awesome library!"}}
{"actor":{"display_login":"rytilahti"}}