nuodb-python icon indicating copy to clipboard operation
nuodb-python copied to clipboard

In Python2, passing a unicode object to execute() results in an exception

Open madscientist opened this issue 4 years ago • 0 comments

If you pass a unicode object, rather than a str object, to execute() (etc.) then you'll get a bizarre exception from Cryptography:

  File "nuodb-python/pynuodb/cursor.py", line 120, in execute
    exec_result = self._execute(operation)
  File "nuodb-python/pynuodb/cursor.py", line 153, in _execute
    return self.session.execute_statement(self._statement_cache.get_statement(), operation)
  File "nuodb-python/pynuodb/encodedsession.py", line 309, in execute_statement
    self._exchangeMessages()
  File "nuodb-python/pynuodb/encodedsession.py", line 1073, in _exchangeMessages
    self.send(self.__output)
  File "nuodb-python/pynuodb/session.py", line 351, in send
    message = self.__cipherOut.transform(message)
  File "nuodb-python/pynuodb/crypt.py", line 321, in transform
    transformed = self.cipher.update(data)
  File "/usr/lib/python2.7/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 149, in update
    return self._ctx.update(data)
  File "/usr/lib/python2.7/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 124, in update
    n = self.update_into(data, buf)
  File "/usr/lib/python2.7/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 140, in update_into
    self._backend._ffi.from_buffer(data), len(data)
TypeError: from_buffer() cannot return the address of a unicode object

madscientist avatar Oct 20 '20 18:10 madscientist