Skip to content

Commit bdb55d0

Browse files
committed
Make python ProtocolHandler available even with Cython
PYTHON-501
1 parent aa88936 commit bdb55d0

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

cassandra/protocol.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -894,15 +894,15 @@ def recv_schema_change(cls, f, protocol_version):
894894
return event
895895

896896

897-
class ProtocolHandler(object):
897+
class _ProtocolHandler(object):
898898
"""
899-
ProtocolHander handles encoding and decoding messages.
899+
_ProtocolHander handles encoding and decoding messages.
900900
901901
This class can be specialized to compose Handlers which implement alternative
902902
result decoding or type deserialization. Class definitions are passed to :class:`cassandra.cluster.Cluster`
903903
on initialization.
904904
905-
Contracted class methods are :meth:`ProtocolHandler.encode_message` and :meth:`ProtocolHandler.decode_message`.
905+
Contracted class methods are :meth:`_ProtocolHandler.encode_message` and :meth:`_ProtocolHandler.decode_message`.
906906
"""
907907

908908
message_types_by_opcode = _message_types_by_opcode.copy()
@@ -1039,12 +1039,12 @@ class FastResultMessage(ResultMessage):
10391039
code_to_type = dict((v, k) for k, v in ResultMessage.type_codes.items())
10401040
recv_results_rows = classmethod(make_recv_results_rows(colparser))
10411041

1042-
class CythonProtocolHandler(ProtocolHandler):
1042+
class CythonProtocolHandler(_ProtocolHandler):
10431043
"""
10441044
Use FastResultMessage to decode query result message messages.
10451045
"""
10461046

1047-
my_opcodes = ProtocolHandler.message_types_by_opcode.copy()
1047+
my_opcodes = _ProtocolHandler.message_types_by_opcode.copy()
10481048
my_opcodes[FastResultMessage.opcode] = FastResultMessage
10491049
message_types_by_opcode = my_opcodes
10501050

@@ -1059,6 +1059,7 @@ class CythonProtocolHandler(ProtocolHandler):
10591059
LazyProtocolHandler = cython_protocol_handler(LazyParser())
10601060
else:
10611061
# Use Python-based ProtocolHandler
1062+
ProtocolHandler = _ProtocolHandler
10621063
LazyProtocolHandler = None
10631064

10641065

docs/api/cassandra/protocol.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ a custom QueryHandler.
1616

1717
See :meth:`.Session.execute`, ::meth:`.Session.execute_async`, :attr:`.ResponseFuture.custom_payload`.
1818

19-
.. autoclass:: ProtocolHandler
19+
.. autoclass:: _ProtocolHandler
2020

2121
.. autoattribute:: message_types_by_opcode
2222
:annotation: = {default mapping}

0 commit comments

Comments
 (0)