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

Convert error for UInt32 · sdpython/pythonnet@97f0009 · GitHub

This repository was archived by the owner on Jul 22, 2023. It is now read-only.

Repository navigation

Commit 97f0009

Browse files
committed
Convert error for UInt32
1 parent 9845e98 commit 97f0009

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎src/runtime/converter.cs‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
using System;
22
using System.Collections;
33
using System.Collections.Generic;
4+
using System.ComponentModel;
45
using System.Globalization;
5-
using System.Reflection;
66
using System.Runtime.InteropServices;
77
using System.Security;
8-
using System.ComponentModel;
9-
using System.Linq.Expressions;
108

119
namespace Python.Runtime
1210
{
@@ -666,6 +664,10 @@ private static bool ToPrimitive(IntPtr value, Type obType, out object result, bo
666664
else
667665
{
668666
ulong num = Runtime.PyLong_AsUnsignedLong64(op);
667+
if (num == ulong.MaxValue && Exceptions.ErrorOccurred())
668+
{
669+
goto convert_error;
670+
}
669671
try
670672
{
671673
result = Convert.ToUInt32(num);
@@ -692,7 +694,7 @@ private static bool ToPrimitive(IntPtr value, Type obType, out object result, bo
692694
goto convert_error;
693695
}
694696
}
695-
ulong num = Runtime.PyLong_AsUnsignedLongLong(value);
697+
ulong num = Runtime.PyLong_AsUnsignedLongLong(op);
696698
if (num == ulong.MaxValue && Exceptions.ErrorOccurred())
697699
{
698700
goto overflow;

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL