Skip to content

Commit dfc70f6

Browse files
committed
minor change in PythonEngine.With
1 parent faec7fc commit dfc70f6

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/runtime/pythonengine.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -773,9 +773,6 @@ public static void With(PyObject obj, Action<dynamic> Body)
773773
// Behavior described here:
774774
// https://docs.python.org/2/reference/datamodel.html#with-statement-context-managers
775775

776-
PyObject type = PyObject.None;
777-
PyObject val = PyObject.None;
778-
PyObject traceBack = PyObject.None;
779776
Exception ex = null;
780777
PythonException pyError = null;
781778

@@ -796,9 +793,9 @@ public static void With(PyObject obj, Action<dynamic> Body)
796793
pyError = PythonException.FetchCurrentRaw();
797794
}
798795

799-
type = pyError?.Type ?? type;
800-
val = pyError?.Value ?? val;
801-
traceBack = pyError?.Traceback ?? traceBack;
796+
PyObject type = pyError?.Type ?? PyObject.None;
797+
PyObject val = pyError?.Value ?? PyObject.None;
798+
PyObject traceBack = pyError?.Traceback ?? PyObject.None;
802799

803800
var exitResult = obj.InvokeMethod("__exit__", type, val, traceBack);
804801

0 commit comments

Comments
 (0)