| 2764 | |
| 2765 | @staticmethod |
| 2766 | def protocol_version(): |
| 2767 | # By default, assume a client and server are compatible if they run |
| 2768 | # the same Python major.minor version. We'll try to keep backwards |
| 2769 | # compatibility between patch versions of a minor version if possible. |
| 2770 | # If we do need to change the protocol in a patch version, we'll change |
| 2771 | # `revision` to the patch version where the protocol changed. |
| 2772 | # We can ignore compatibility for pre-release versions; sys.remote_exec |
| 2773 | # can't attach to a pre-release version except from that same version. |
| 2774 | v = sys.version_info |
| 2775 | revision = 0 |
| 2776 | return int(f"{v.major:02X}{v.minor:02X}{revision:02X}F0", 16) |
| 2777 | |
| 2778 | def _ensure_valid_message(self, msg): |
| 2779 | # Ensure the message conforms to our protocol. |