Commit dd8910b
committed
fix a bug when loading a config file
The HDF5 file stores config values like log_level_global as a numeric (e.g., numpy.int64). When loading, that integer is passed into VariPEPS_Config. In setattr, the field type for log_level_global is the Enum LogLevel, so integers must be coerced to LogLevel. Your version’s coercion path doesn’t catch your value, so it falls through and raises:
Type mismatch for option 'log_level_global', got '<class numpy.int64>', expected '<enum 'LogLevel'>'.
Why it falls through
The loader passes a numpy integer (or a 0-d/1-d array) instead of a Python int.
The Enum branch in setattr is too strict about the numeric checks, so it doesn’t convert that value into LogLevel.1 parent 8e1126b commit dd8910b
1 file changed
+22
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
370 | | - | |
| 370 | + | |
371 | 371 | | |
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
375 | 375 | | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
376 | 397 | | |
377 | 398 | | |
378 | 399 | | |
| |||
0 commit comments