Skip to content

Commit abb5eff

Browse files
authored
Merge branch 'master' into assemblymanager_thread_safety
2 parents f3f7151 + db9478f commit abb5eff

File tree

11 files changed

+69
-422
lines changed

11 files changed

+69
-422
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Python for .NET is a package that gives Python programmers nearly seamless integ
55

66
[![Build Status](https://travis-ci.org/pythonnet/pythonnet.png?branch=master)](https://travis-ci.org/pythonnet/pythonnet)
77

8-
[![Build status](https://ci.appveyor.com/api/projects/status/c8k0miljb3n1c7be/branch/master)](https://ci.appveyor.com/project/TonyRoberts/pythonnet-480xs)
8+
[![Build status](https://ci.appveyor.com/api/projects/status/g4flfwq46g2adv6a/branch/master?svg=true)](https://ci.appveyor.com/project/pythonnet/pythonnet-0kq5d/branch/master)
99

1010
**Calling .NET code from Python**
1111

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def _get_interop_filename():
327327

328328
setup(
329329
name="pythonnet",
330-
version="2.2.0-dev1",
330+
version="2.2.0",
331331
description=".Net and Mono integration for Python",
332332
url='http://pythonnet.github.io/',
333333
author="Python for .Net developers",

src/runtime/clrobject.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ internal CLRObject(Object ob, IntPtr tp) : base()
3030
this.pyHandle = py;
3131
this.gcHandle = gc;
3232
inst = ob;
33+
34+
// Fix the BaseException args slot if wrapping a CLR exception
35+
Exceptions.SetArgs(py);
3336
}
3437

3538

src/runtime/converter.cs

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -156,20 +156,7 @@ internal static IntPtr ToPython(Object value, Type type)
156156
switch (tc)
157157
{
158158
case TypeCode.Object:
159-
result = CLRObject.GetInstHandle(value, type);
160-
161-
// XXX - hack to make sure we convert new-style class based
162-
// managed exception instances to wrappers ;(
163-
if (Runtime.wrap_exceptions)
164-
{
165-
Exception e = value as Exception;
166-
if (e != null)
167-
{
168-
return Exceptions.GetExceptionInstanceWrapper(result);
169-
}
170-
}
171-
172-
return result;
159+
return CLRObject.GetInstHandle(value, type);
173160

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

286-
// XXX - hack to support objects wrapped in old-style classes
287-
// (such as exception objects).
288-
if (Runtime.wrap_exceptions)
289-
{
290-
if (mt == null)
291-
{
292-
if (Runtime.PyObject_IsInstance(
293-
value, Exceptions.Exception
294-
) > 0)
295-
{
296-
IntPtr p = Runtime.PyObject_GetAttrString(value, "_inner");
297-
if (p != IntPtr.Zero)
298-
{
299-
// This is safe because we know that the __dict__ of
300-
// value holds a reference to _inner.
301-
value = p;
302-
Runtime.XDecref(p);
303-
mt = ManagedType.GetManagedObject(value);
304-
}
305-
}
306-
IntPtr c = Exceptions.UnwrapExceptionClass(value);
307-
if ((c != IntPtr.Zero) && (c != value))
308-
{
309-
value = c;
310-
Runtime.XDecref(c);
311-
mt = ManagedType.GetManagedObject(value);
312-
}
313-
}
314-
}
315-
316273
if (mt != null)
317274
{
318275
if (mt is CLRObject)

0 commit comments

Comments
 (0)