Commit a9c3d8b
committed
Fix conversion of 'float' and 'double' values
Fix problem of conversion 'float' and 'double' values in converter.cs.
As there was a range check both for 'float' and 'double' values, which
are less or greater than its 'MinValue' and 'MaxValue' accordingly,
several values like 'float.NegativeInfinity', 'float.PositiveInfinity'
and the same 'double' values cannot be converted from Python to .NET
values.
Add error check after 'PyFloat_AsDouble' call.
Due to Python C API documentation, method 'PyFloat_AsDouble' can return
'-1.0' upon failure. So it requires error check. This rule forces to
check for error and throw exception in case of error.
Add tests, which cover problem of conversion 'float' and 'double'
values.
Resolves: #486.1 parent aef02e2 commit a9c3d8b
3 files changed
Lines changed: 55 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
770 | 770 | | |
771 | 771 | | |
772 | 772 | | |
| 773 | + | |
773 | 774 | | |
774 | 775 | | |
775 | 776 | | |
776 | | - | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
777 | 781 | | |
778 | 782 | | |
779 | 783 | | |
| |||
785 | 789 | | |
786 | 790 | | |
787 | 791 | | |
| 792 | + | |
788 | 793 | | |
789 | | - | |
790 | | - | |
791 | | - | |
792 | | - | |
793 | 794 | | |
794 | 795 | | |
795 | 796 | | |
| |||
0 commit comments