{"action":"created","issue":{"url":"https://api.github.com/repos/zopefoundation/BTrees/issues/74","repository_url":"https://api.github.com/repos/zopefoundation/BTrees","labels_url":"https://api.github.com/repos/zopefoundation/BTrees/issues/74/labels{/name}","comments_url":"https://api.github.com/repos/zopefoundation/BTrees/issues/74/comments","events_url":"https://api.github.com/repos/zopefoundation/BTrees/issues/74/events","html_url":"https://github.com/zopefoundation/BTrees/issues/74","id":243268356,"number":74,"title":"TypeError with OOBTree.__getitem__ for composed keys containing None with py3","user":{"login":"ml31415","id":2386612,"avatar_url":"https://avatars1.githubusercontent.com/u/2386612?v=4","gravatar_id":"","url":"https://api.github.com/users/ml31415","html_url":"https://github.com/ml31415","followers_url":"https://api.github.com/users/ml31415/followers","following_url":"https://api.github.com/users/ml31415/following{/other_user}","gists_url":"https://api.github.com/users/ml31415/gists{/gist_id}","starred_url":"https://api.github.com/users/ml31415/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ml31415/subscriptions","organizations_url":"https://api.github.com/users/ml31415/orgs","repos_url":"https://api.github.com/users/ml31415/repos","events_url":"https://api.github.com/users/ml31415/events{/privacy}","received_events_url":"https://api.github.com/users/ml31415/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-07-16T21:40:40Z","updated_at":"2017-07-22T14:21:12Z","closed_at":null,"body":"```\r\nfrom BTrees.OOBTree import OOBTree\r\nkeys = [('a', 100), ('b', 200), ('c', None)]\r\n\r\ntree = OOBTree()\r\nfor i, key in enumerate(keys):\r\n    tree[key] = i\r\n\r\ntree[('c', None)] # works\r\ntree[('a', None)] # TypeError\r\ntree[(None, None)] # TypeError\r\n\r\n```\r\nI recently migrated from py2, where the above code worked fine. With py3, the more strict comparison seems to cause some trouble. Tested with the latest version from pypi."},"comment":{"url":"https://api.github.com/repos/zopefoundation/BTrees/issues/comments/317186730","html_url":"https://github.com/zopefoundation/BTrees/issues/74#issuecomment-317186730","issue_url":"https://api.github.com/repos/zopefoundation/BTrees/issues/74","id":317186730,"user":{"login":"jamadden","id":1256082,"avatar_url":"https://avatars3.githubusercontent.com/u/1256082?v=4","gravatar_id":"","url":"https://api.github.com/users/jamadden","html_url":"https://github.com/jamadden","followers_url":"https://api.github.com/users/jamadden/followers","following_url":"https://api.github.com/users/jamadden/following{/other_user}","gists_url":"https://api.github.com/users/jamadden/gists{/gist_id}","starred_url":"https://api.github.com/users/jamadden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamadden/subscriptions","organizations_url":"https://api.github.com/users/jamadden/orgs","repos_url":"https://api.github.com/users/jamadden/repos","events_url":"https://api.github.com/users/jamadden/events{/privacy}","received_events_url":"https://api.github.com/users/jamadden/received_events","type":"User","site_admin":false},"created_at":"2017-07-22T14:21:12Z","updated_at":"2017-07-22T14:21:12Z","body":"Those comments are presumably outdated. Support for None was added back to BTrees in 4.4.0, and I'm guessing those comments weren't updated.\r\n\r\nThe support for None [was special cased](https://github.com/zopefoundation/BTrees/commit/e7991d0167b15c85ffd4451669c4dd0118f4ab27#diff-9ccf6242b40ca08bb0276548bd2d1b00L26) to make Python 3 behave like Python 2.\r\n\r\nIn general, though, I don't know what we can do about arbitrary unorderable keys. It doesn't seem practical to try to special case tuples of any length that may have None at any position.\r\n```pycon\r\n>>> sys.version_info\r\nsys.version_info(major=3, minor=6, micro=1, releaselevel='final', serial=0)\r\n>>> (1, None) < (None, 1)\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\nTypeError: '<' not supported between instances of 'int' and 'NoneType'\r\n```"}}
{"actor":{"display_login":"jamadden"}}