Skip to content

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

@madscientist

Description

@madscientist

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions