Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix exception pickling#286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
den-run-ai merged 7 commits intopythonnet:masterfromfilmor:fix-exception-pickling
Nov 10, 2016
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletionssrc/runtime/clrobject.cs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,6 +30,9 @@ internal CLRObject(Object ob, IntPtr tp) : base()
this.pyHandle = py;
this.gcHandle = gc;
inst = ob;

// Fix the BaseException args slot if wrapping a CLR exception
Exceptions.SetArgs(py);
}


Expand Down
45 changes: 1 addition & 44 deletionssrc/runtime/converter.cs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -156,20 +156,7 @@ internal static IntPtr ToPython(Object value, Type type)
switch (tc)
{
case TypeCode.Object:
result = CLRObject.GetInstHandle(value, type);

// XXX - hack to make sure we convert new-style class based
// managed exception instances to wrappers ;(
if (Runtime.wrap_exceptions)
{
Exception e = value as Exception;
if (e != null)
{
return Exceptions.GetExceptionInstanceWrapper(result);
}
}

return result;
return CLRObject.GetInstHandle(value, type);

case TypeCode.String:
return Runtime.PyUnicode_FromString((string)value);
Expand DownExpand Up@@ -283,36 +270,6 @@ internal static bool ToManagedValue(IntPtr value, Type obType,
ManagedType mt = ManagedType.GetManagedObject(value);
result = null;

// XXX - hack to support objects wrapped in old-style classes
// (such as exception objects).
if (Runtime.wrap_exceptions)
{
if (mt == null)
{
if (Runtime.PyObject_IsInstance(
value, Exceptions.Exception
) > 0)
{
IntPtr p = Runtime.PyObject_GetAttrString(value, "_inner");
if (p != IntPtr.Zero)
{
// This is safe because we know that the __dict__ of
// value holds a reference to _inner.
value = p;
Runtime.XDecref(p);
mt = ManagedType.GetManagedObject(value);
}
}
IntPtr c = Exceptions.UnwrapExceptionClass(value);
if ((c != IntPtr.Zero) && (c != value))
{
value = c;
Runtime.XDecref(c);
mt = ManagedType.GetManagedObject(value);
}
}
}

if (mt != null)
{
if (mt is CLRObject)
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp