We describe an analytical technique for assessing the risk of partial demagnetization in tubular permanent-magnet (PM) machines. The technique establishes analytical expressions for the open-circuit and armature reaction fields in the cylindrical coordinate system and superposes the fields in the permanent-magnet regions to determine the extent to which the magnets may be partially irreversibly demagnetized. We have applied the technique to a quasi-Halbach magnetized tubular PM machine equipped with a modular stator winding, and have validated the predictions by finite-element analysis. We found that partial demagnetization may occur even under an open-circuit operating condition when the machine is operating at high temperature. We propose alternative Halbach magnetization distributions that improve the demagnetization withstand capability. The analytical technique provides a computationally efficient tool for identifying regions that are prone to partial demagnetization and for assessing the consequences. It enables the risk of demagnetization to be fully assessed at the design stage so as to achieve a robust machine, particularly when operating in harsh environments.