{"action":"created","issue":{"url":"https://api.github.com/repos/pyldap/pyldap/issues/117","repository_url":"https://api.github.com/repos/pyldap/pyldap","labels_url":"https://api.github.com/repos/pyldap/pyldap/issues/117/labels{/name}","comments_url":"https://api.github.com/repos/pyldap/pyldap/issues/117/comments","events_url":"https://api.github.com/repos/pyldap/pyldap/issues/117/events","html_url":"https://github.com/pyldap/pyldap/issues/117","id":253201967,"number":117,"title":"Is Python 3.2 supported?  pyldap uses missing symbol _PyUnicode_AsUTF8","user":{"login":"akkornel","id":7297508,"avatar_url":"https://avatars1.githubusercontent.com/u/7297508?v=4","gravatar_id":"","url":"https://api.github.com/users/akkornel","html_url":"https://github.com/akkornel","followers_url":"https://api.github.com/users/akkornel/followers","following_url":"https://api.github.com/users/akkornel/following{/other_user}","gists_url":"https://api.github.com/users/akkornel/gists{/gist_id}","starred_url":"https://api.github.com/users/akkornel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akkornel/subscriptions","organizations_url":"https://api.github.com/users/akkornel/orgs","repos_url":"https://api.github.com/users/akkornel/repos","events_url":"https://api.github.com/users/akkornel/events{/privacy}","received_events_url":"https://api.github.com/users/akkornel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-08-28T00:44:33Z","updated_at":"2017-08-28T09:26:24Z","closed_at":null,"body":"Hello!\r\n\r\nIt seems like pyldap does not support Python 3.2 (and presumably lower Python 3), because it is using the symbol `_PyUnicode_AsUTF8`.  At least from my perspective, I don't have a need for Python 3.2 or lower.  But still, the README and `setup.py` don't seem to mention that Python 3 needs 3.3 or later, so I wanted to report this!\r\n\r\nHere's how I set up a Python 3.2 environment to verify this.  I'm running on macOS 10.12:\r\n\r\n```\r\n# If using MacPorts, bring in Python 3.2 and OpenLDAP.\r\n# If not using MacPorts, then this assumes Python 3.2 is `python3.2`,\r\n# and that the OpenLDAP headers are installed in system paths.\r\nsudo port install openldap python32\r\nTMPDIR=$(mktemp -d)\r\ncd $TMPDIR\r\ncurl https://pypi.python.org/packages/47/15/7f9aabb1ce09d3dc5ecdff2f5a97e0a47f724fe8e398eff6a88626d0164c/setuptools-5.5.1.tar.gz#md5=86bbbfa732c234535316a7d74a49c6ad | tar -xzf -\r\ncurl https://pypi.python.org/packages/e4/3a/43fbf0c2ed567efd409d19968da3f373f83b99831090e3660be937f645a6/pyldap-2.4.37.tar.gz#md5=55b3b39d9c1c7837d80203a04d52c6a1 | tar -xzf -\r\ncd setuptools-5.5.1\r\npython3.2 setup.py build ; python3.2 setup.py install --user\r\ncd ../pyldap-2.4.37\r\n\r\n# The next two lines are only needed when MacPorts installed OpenLDAP.\r\n# Otherwise, it tries to use OS LDAP headers, which doesn't work.\r\nsed -i -e 's|library_dirs =|library_dirs = /opt/local/lib|' setup.cfg\r\nsed -i -e 's|include_dirs =|include_dirs = /opt/local/include|' setup.cfg\r\n\r\npython3.2 setup.py build ; python3.2 setup.py install --user\r\ncd ..\r\nrm -rf setuptools-5.5.1 pyldap-2.4.37\r\ncd ~\r\nrmdir $TMPDIR\r\n```\r\n\r\nThe build and install goes fine; the error is triggered when loading `ldap`:\r\n\r\n```\r\nKarls-Mac-Mini-9346:~ akkornel$ python3.2\r\nPython 3.2.6 (default, Oct 11 2016, 14:54:14) \r\n[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] on darwin\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>> import ldap\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"/Users/akkornel/Library/Python/3.2/lib/python/site-packages/pyldap-2.4.37-py3.2-macosx-10.12-x86_64.egg/ldap/__init__.py\", line 22, in <module>\r\n    import _ldap\r\nImportError: dlopen(/Users/akkornel/Library/Python/3.2/lib/python/site-packages/pyldap-2.4.37-py3.2-macosx-10.12-x86_64.egg/_ldap.so, 2): Symbol not found: _PyUnicode_AsUTF8\r\n  Referenced from: /Users/akkornel/Library/Python/3.2/lib/python/site-packages/pyldap-2.4.37-py3.2-macosx-10.12-x86_64.egg/_ldap.so\r\n  Expected in: flat namespace\r\n in /Users/akkornel/Library/Python/3.2/lib/python/site-packages/pyldap-2.4.37-py3.2-macosx-10.12-x86_64.egg/_ldap.so\r\n>>> ^D\r\n```\r\n\r\nIt seems that `PyUnicode_AsUTF8` is present starting in Python 3.3; it is not listed in the equivalent page for Python 3.2.\r\n\r\nhttps://docs.python.org/3.3/c-api/unicode.html#PyUnicode_AsUTF8\r\nhttps://docs.python.org/3.2/c-api/unicode.html\r\n\r\nIn terms of current active releases, I'm guessing that only Debian wheezy would really be affected (it ships with Python 3.2)."},"comment":{"url":"https://api.github.com/repos/pyldap/pyldap/issues/comments/325305922","html_url":"https://github.com/pyldap/pyldap/issues/117#issuecomment-325305922","issue_url":"https://api.github.com/repos/pyldap/pyldap/issues/117","id":325305922,"user":{"login":"encukou","id":302922,"avatar_url":"https://avatars1.githubusercontent.com/u/302922?v=4","gravatar_id":"","url":"https://api.github.com/users/encukou","html_url":"https://github.com/encukou","followers_url":"https://api.github.com/users/encukou/followers","following_url":"https://api.github.com/users/encukou/following{/other_user}","gists_url":"https://api.github.com/users/encukou/gists{/gist_id}","starred_url":"https://api.github.com/users/encukou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/encukou/subscriptions","organizations_url":"https://api.github.com/users/encukou/orgs","repos_url":"https://api.github.com/users/encukou/repos","events_url":"https://api.github.com/users/encukou/events{/privacy}","received_events_url":"https://api.github.com/users/encukou/received_events","type":"User","site_admin":false},"created_at":"2017-08-28T09:26:24Z","updated_at":"2017-08-28T09:26:24Z","body":"Right, Python 3.2 is not supported. The end of life for it was [in February 2016](https://www.python.org/dev/peps/pep-0392/#lifespan), so I'd hope no one is using it for anything security-related (unless their distro/vendor provides longer support, of course).\r\n\r\nCurrently pyldap is [tested](https://github.com/pyldap/pyldap/blob/master/tox.ini) on 2.7 and 3.4, 3.5, 3.6. Pull requests that would make this more obvious are welcome :)"}}
{"actor":{"display_login":"encukou"}}