Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<TargetFramework>netstandard2.0</TargetFramework>
<NeutralLanguage>en</NeutralLanguage>
<OpenTapVersion>9.18.4</OpenTapVersion>
<OpenTapVersion>9.19.3</OpenTapVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<IsDebug>true</IsDebug>
Expand Down
4 changes: 2 additions & 2 deletions Documentation/Release_Notes/ReleaseNotes_3_0.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Version 3.0 is a breaking release. This means that what was previously supported

## New Features

- Python future compatibility. This version will support Python 3.7 and all newer / future versions.
- Improved Python compatibility. This version will support Python 3.7 - 3.11.
- It is no longer necessary to 'build' the python modules before using them.
- Every .NET type can be inherited from and every plugin type can be created.
- Added support for Mac OS.
Expand All @@ -18,6 +18,6 @@ Version 3.0 is a breaking release. This means that what was previously supported
- Python 2.X is no longer supported.
- Python versions less or equal to 3.6 are also not supported.

That means, at the time of writing Python 3.7, 3.8, 3.9, 3.10 and 3.11 are supported, but the new Python Plugin is future compatible, so 3.12 and onwards are expected to be supported as well.
That means, at the time of writing Python 3.7, 3.8, 3.9, 3.10 and 3.11 are supported.

- It is no longer possible to build a C# DLL containing a C# API for the Python code.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="OpenTAP" Version="9.19.1" />
<OpenTapPackageReference Include="Python" Version="3.0.0-rc.2" />
<AdditionalOpenTapPackage Include="PythonExamples" Version="3.0.0-rc.2" />
<PackageReference Include="OpenTAP" Version="9.19.3" />
<OpenTapPackageReference Include="Python" Version="3.0.0-rc.3" />
<AdditionalOpenTapPackage Include="PythonExamples" Version="3.0.0-rc.3" />

<!-- Uncomment one of these lines to get a test plan editor installed when you build. -->
<!-- <OpenTapPackageReference Include="Editor"/> -->
Expand Down
57 changes: 57 additions & 0 deletions OpenTap.Python/DebugServer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using System;
using System.Net.Sockets;
using Python.Runtime;

namespace OpenTap.Python;

/// <summary> A custom debug server emulating what pydebug can do. </summary>
class DebugServer
{
public static DebugServer Instance { get; } = new ();

public int Port { get; set; }

TcpListener listener;
TapThread thread;
DebugServerClientHandler handler;

private DebugServer(){}

public void Start()
{
listener = new TcpListener(Port);
listener.Start();
thread = TapThread.Start(AcceptClient);
}

void AcceptClient()
{
while (TapThread.Current.AbortToken.IsCancellationRequested == false)
{
var cli = listener.AcceptTcpClient();
if (handler != null)
{
throw new Exception("Only one debug client can be attached at a time");
}
handler = new DebugServerClientHandler(cli);
}
}

public int TraceCallback(PyObject arg1, Runtime.PyFrameObject arg2, Runtime.TraceWhat arg3, PyObject arg4)
{
// the active threads always needs to be updated.
if(arg3 == Runtime.TraceWhat.Call)
DebugServerClientHandler.GetThreadId(TapThread.Current);
handler?.TraceCallback(arg1, arg2, arg3, arg4);
return 0;
}

public void Stop()
{
listener.Stop();
thread.Abort();
thread = null;
listener = null;
handler = null;
}
}
Loading