ResponseFuture._set_result crashes on connection error when used with PrepareMessage

Description

Calling cassandra.cluster.Session.prepare or cassandra.cluster.Session.prepare_on_all_hosts creates a ResponseFuture that is passed an instance of PrepareMessage as it's message value. This message value is used in a few places in that class as self.message.consistency_level, however a PrepareMessage object does not have that property. The ResponseFuture._retry method would set the consistency_level property on that object, however that method is not called until after an attempt to access the property.

See here for the core of the issue: https://github.com/datastax/python-driver/blob/3.20.2/cassandra/cluster.py#L4108-L4111

The stack trace we've seen is:

Environment

None

Pull Requests

None

Status

Assignee

Alan Boudreault

Reporter

Glen Oakley

Fix versions

Labels

None

Reproduced in

3.18.0

PM Priority

None

External issue ID

None

Doc Impact

None

Reviewer

None

Size

None

Affects versions

Priority

Major
Configure