| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5fd77b1 commit 7e7cbca
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -698,19 +698,10 @@ private static bool ToPrimitive(IntPtr value, Type obType, out object result, bo | |||
| 698 | 698 | ||
| 699 | 699 | case TypeCode.UInt64: | |
| 700 | 700 | { | |
| 701 | - op = value; | ||
| 702 | - if (Runtime.PyObject_TYPE(value) != Runtime.PyLongType) | ||
| 703 | - { | ||
| 704 | - op = Runtime.PyNumber_Long(value); | ||
| 705 | - if (op == IntPtr.Zero) | ||
| 706 | - { | ||
| 707 | - goto convert_error; | ||
| 708 | - } | ||
| 709 | - } | ||
| 710 | - ulong num = Runtime.PyLong_AsUnsignedLongLong(op); | ||
| 701 | + ulong num = Runtime.PyLong_AsUnsignedLongLong(value); | ||
| 711 | 702 | if (num == ulong.MaxValue && Exceptions.ErrorOccurred()) | |
| 712 | 703 | { | |
| 713 | - goto overflow; | ||
| 704 | + goto convert_error; | ||
| 714 | 705 | } | |
| 715 | 706 | result = num; | |
| 716 | 707 | return true; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -382,7 +382,10 @@ def test_uint64_conversion(): | |||
| 382 | 382 | ob.UInt64Field = System.UInt64(0) | |
| 383 | 383 | assert ob.UInt64Field == 0 | |
| 384 | 384 | ||
| 385 | - with pytest.raises(ValueError): | ||
| 385 | + with pytest.raises(TypeError): | ||
| 386 | + ConversionTest().UInt64Field = 0.5 | ||
| 387 | + | ||
| 388 | + with pytest.raises(TypeError): | ||
| 386 | 389 | ConversionTest().UInt64Field = "spam" | |
| 387 | 390 | ||
| 388 | 391 | with pytest.raises(TypeError): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments