Skip to content

Commit

Permalink
enum object cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
eirannejad committed Mar 28, 2024
1 parent a997f7f commit 4feb745
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions src/runtime/Types/EnumObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,34 +131,13 @@ public static int nb_bool(BorrowedReference ob)
}
}

//public static NewReference tp_str(BorrowedReference ob)
//{
// var co = GetManagedObject(ob) as CLRObject;
// if (co == null)
// {
// return Exceptions.RaiseTypeError("invalid enum object");
// }
// try
// {
// return Runtime.PyString_FromString(co.inst.ToString());
// }
// catch (Exception e)
// {
// if (e.InnerException != null)
// {
// e = e.InnerException;
// }
// Exceptions.SetError(e);
// return default;
// }
//}

public new static NewReference tp_repr(BorrowedReference ob)
{
if (GetManagedObject(ob) is not CLRObject co)
{
return Exceptions.RaiseTypeError("invalid object");
return Exceptions.RaiseTypeError("invalid enum object");
}

if (co.inst.GetType().IsEnum)
{
return Runtime.PyString_FromString(GetEnumReprString((Enum)co.inst));
Expand Down

0 comments on commit 4feb745

Please sign in to comment.