toddlipcon / python-sasl

SASL wrappers for Python, borrowed from QPid

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python 3 support would be nice

zoltan-fedor opened this issue · comments

Python 3 support would be nice.

Lots of other packages depending on it:
BradRuderman/pyhs2#44
http://stackoverflow.com/questions/31701493/problems-installing-pyhs2-in-python3

Currently compiling on Python 3 fails with "PyString_AsString" and other errors.

I have just seen there is a branch for Python 3 at https://github.com/laserson/python-sasl/tree/py3
Just tried, it does compile under Python 3.4.3. now the question is whether it works too.

+1 if this could be merged

I was able to compile lasersons py3 branch, but I get this when I try to establish a connection:

/export/home/kweiler/ip3-test/anaconda3/lib/python3.4/site-packages/impala/dbapi.py in connect(host, port, protocol, database, timeout, use_ssl, ca_cert, auth_mechanism, user, password, kerberos_service_name, use_ldap, ldap_user, ldap_password, use_kerberos)
     80                               ca_cert=ca_cert, user=user, password=password,
     81                               kerberos_service_name=kerberos_service_name,
---> 82                               auth_mechanism=auth_mechanism)
     83         return hs2.HiveServer2Connection(service, default_db=database)
     84     if protocol.lower() == 'beeswax':

/export/home/kweiler/ip3-test/anaconda3/lib/python3.4/site-packages/impala/hiveserver2.py in connect(host, port, timeout, use_ssl, ca_cert, user, password, kerberos_service_name, auth_mechanism)
    584     transport = get_transport(sock, host, kerberos_service_name,
    585                               auth_mechanism, user, password)
--> 586     transport.open()
    587     protocol = TBinaryProtocol(transport)
    588     if six.PY2:

/export/home/kweiler/ip3-test/anaconda3/lib/python3.4/site-packages/thrift_sasl/__init__.py in open(self)
     84       if status == self.COMPLETE:
     85         break
---> 86       ret, response = self.sasl.step(payload)
     87       if not ret:
     88         raise TTransportException(type=TTransportException.NOT_OPEN,

/export/home/kweiler/ip3-test/anaconda3/lib/python3.4/site-packages/sasl-0.2.0-py3.4-linux-x86_64.egg/sasl/saslwrapper.py in step(self, challenge)
    181
    182     def step(self, challenge):
--> 183         return _saslwrapper.Client_step(self, challenge)
    184
    185     def encode(self, clearText):

TypeError: in method 'Client_step', argument 2 of type 'std::string const &'

This looks like a type-error in C. I've tried casting the challenge object as a few different things with no success.