Skip to content

ABI.Initialize gives a helpful message when the TypeOffset interop class is not configured correctly #1340

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jan 4, 2021
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
LoadNativeTypeOffsetClass checks for sys.abiflags
  • Loading branch information
tminka committed Jan 3, 2021
commit 48c63e779734a2b84fdd441dfba4e9b4c6dddbbe
28 changes: 23 additions & 5 deletions src/embed_tests/TestNativeTypeOffset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,39 @@

using NUnit.Framework;

using Python.Runtime;

namespace Python.EmbeddingPythonTest
{
public class TestNativeTypeOffset
{
#if WINDOWS
// The code for NativeTypeOffset is not generated under Windows because sys.abiflags does not exist (see setup.py)
#else
private Py.GILState _gs;

[SetUp]
public void SetUp()
{
_gs = Py.GIL();
}

[TearDown]
public void Dispose()
{
_gs.Dispose();
}

/// <summary>
/// Tests that installation has generated code for NativeTypeOffset and that it can be loaded.
/// </summary>
[Test]
public void LoadNativeTypeOffsetClass()
{
new Python.Runtime.NativeTypeOffset();
PyObject sys = Py.Import("sys");
string attributeName = "abiflags";
if (sys.HasAttr(attributeName) && !string.IsNullOrEmpty(sys.GetAttr(attributeName).ToString()))
{
string typeName = "Python.Runtime.NativeTypeOffset";
Assert.NotNull(Type.GetType(typeName), $"{typeName} does not exist and sys.{attributeName} is not empty");
}
}
#endif
}
}
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy