The C++ publisher is using rclcpp::SensorDataQoS(), which uses the sensor data QoS profile. The Python subscriber is just specifying the queue size, which means it uses the default profile with the given queue size of 10. The incompatibility comes from the reliability setting. The sensor data profile specifies best effort while the default profile uses reliable. According to the QoS compatibilities table, a subscriber requiring reliable will not connect to a publisher providing only best effort reliability.