Commit eb46d10
BUG: add to_dict/from_dict to RingClusterMotor for serialization round-trip
RingClusterMotor defined neither to_dict nor from_dict, and its base class
Motor (ABC) has none either (only GenericMotor does). On decode, RocketPyDecoder
fell through to instantiating the class from the filtered dict, but the inherited
Motor.to_dict serializes computed motor fields (thrust_source, inertias, ...) and
none of the constructor arguments (motor, number, radius). Reconstruction called
RingClusterMotor() with no args:
TypeError: RingClusterMotor.__init__() missing 3 required positional
arguments: 'motor', 'number', and 'radius'
This TypeError is not caught by the decoder (only ImportError/AttributeError are),
so any Rocket/Flight carrying a RingClusterMotor could not be reloaded, which also
breaks Monte Carlo caching and .rpy save/load for the new motor.
The inner motor is a RocketPy object and is serialized/reconstructed recursively,
so from_dict just forwards the reconstructed motor plus number and radius.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 00e4952 commit eb46d10
1 file changed
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
291 | 291 | | |
292 | 292 | | |
293 | 293 | | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
294 | 313 | | |
295 | 314 | | |
296 | 315 | | |
| |||
0 commit comments