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

Appearance settings
Merged
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
34 changes: 34 additions & 0 deletions 34 src/embed_tests/Inspect.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;

using NUnit.Framework;

using Python.Runtime;

namespace Python.EmbeddingTest
{
public class Inspect
{
[OneTimeSetUp]
public void SetUp()
{
PythonEngine.Initialize();
}

[OneTimeTearDown]
public void Dispose()
{
PythonEngine.Shutdown();
}

[Test]
public void InstancePropertiesVisibleOnClass()
{
var uri = new Uri("http://example.org").ToPython();
var uriClass = uri.GetPythonType();
var property = uriClass.GetAttr(nameof(Uri.AbsoluteUri));
var pyProp = (PropertyObject)ManagedType.GetManagedObject(property.Reference);
Assert.AreEqual(nameof(Uri.AbsoluteUri), pyProp.info.Value.Name);
}
}
}
8 changes: 4 additions & 4 deletions 8 src/runtime/propertyobject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Python.Runtime
[Serializable]
internal class PropertyObject : ExtensionType
{
private MaybeMemberInfo<PropertyInfo> info;
internal MaybeMemberInfo<PropertyInfo> info;
private MaybeMethodInfo getter;
private MaybeMethodInfo setter;

Expand Down Expand Up @@ -50,9 +50,9 @@ public static IntPtr tp_descr_get(IntPtr ds, IntPtr ob, IntPtr tp)
{
if (!getter.IsStatic)
{
Exceptions.SetError(Exceptions.TypeError,
"instance property must be accessed through a class instance");
return IntPtr.Zero;
Runtime.XIncref(ds);
// unbound property
return ds;
}

try
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.