FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix bug where converting a UInt32 doesn't raise an OverflowError · pythonnet/pythonnet@0acc47a · GitHub

Commit 0acc47a

Browse files
committed
fix bug where converting a UInt32 doesn't raise an OverflowError
1 parent bc932a3 commit 0acc47a

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎pythonnet/src/runtime/converter.cs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,14 @@ static bool ToPrimitive(IntPtr value, Type obType, out Object result,
540540
if (Exceptions.ErrorOccurred()) {
541541
goto overflow;
542542
}
543+
544+
IntPtr check = Runtime.PyLong_FromUnsignedLong(ui);
545+
int err = Runtime.PyObject_Compare(check, op);
546+
Runtime.Decref(check);
547+
if (0 != err || Exceptions.ErrorOccurred()) {
548+
goto overflow;
549+
}
550+
543551
result = ui;
544552
return true;
545553

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL