Skip to content

Commit a27ef3a

Browse files
committed
Revert "Suggest similar member names on AttributeError for .NET objects (#124)"
This reverts commit e9a2338.
1 parent e9a2338 commit a27ef3a

10 files changed

Lines changed: 6 additions & 413 deletions

File tree

src/embed_tests/TestPropertyAccess.cs

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,44 +1129,6 @@ def GetValue(self, fixture):
11291129
}
11301130
}
11311131

1132-
[Test]
1133-
public void TestGetMisspelledDynamicObjectPropertySuggestsSimilarMembers()
1134-
{
1135-
dynamic model = PyModule.FromString("module", @"
1136-
from clr import AddReference
1137-
AddReference(""Python.EmbeddingTest"")
1138-
AddReference(""System"")
1139-
1140-
from Python.EmbeddingTest import *
1141-
1142-
class TestGetMisspelledDynamicObjectPropertySuggestsSimilarMembers:
1143-
def GetValue(self, fixture):
1144-
try:
1145-
# 'non_dynamic_propertyy' is a near miss of the snake_case alias of the
1146-
# real 'NonDynamicProperty' member.
1147-
prop = fixture.non_dynamic_propertyy
1148-
except AttributeError as e:
1149-
return e
1150-
1151-
return None
1152-
").GetAttr("TestGetMisspelledDynamicObjectPropertySuggestsSimilarMembers").Invoke();
1153-
1154-
dynamic fixture = new DynamicFixture();
1155-
1156-
using (Py.GIL())
1157-
{
1158-
var result = model.GetValue(fixture) as PyObject;
1159-
Assert.IsFalse(result.IsNone());
1160-
Assert.AreEqual(result.PyType, Exceptions.AttributeError);
1161-
1162-
// Suggestions are emitted in snake_case, matching the fork's PEP8-style API.
1163-
var message = result.ToString();
1164-
Assert.That(message, Does.Contain("non_dynamic_propertyy"));
1165-
Assert.That(message, Does.Contain("Did you mean"));
1166-
Assert.That(message, Does.Contain("non_dynamic_property"));
1167-
}
1168-
}
1169-
11701132
public class CSharpTestClass
11711133
{
11721134
public string CSharpProperty { get; set; }

src/perf_tests/Python.PerformanceTests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1414
</PackageReference>
1515
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.*" />
16-
<PackageReference Include="quantconnect.pythonnet" Version="2.0.55" GeneratePathProperty="true">
16+
<PackageReference Include="quantconnect.pythonnet" Version="2.0.54" GeneratePathProperty="true">
1717
<IncludeAssets>compile</IncludeAssets>
1818
</PackageReference>
1919
</ItemGroup>
@@ -25,7 +25,7 @@
2525
</Target>
2626

2727
<Target Name="CopyBaseline" AfterTargets="Build">
28-
<Copy SourceFiles="$(NuGetPackageRoot)quantconnect.pythonnet\2.0.55\lib\net10.0\Python.Runtime.dll" DestinationFolder="$(OutDir)baseline" />
28+
<Copy SourceFiles="$(NuGetPackageRoot)quantconnect.pythonnet\2.0.54\lib\net10.0\Python.Runtime.dll" DestinationFolder="$(OutDir)baseline" />
2929
</Target>
3030

3131
<Target Name="CopyNewBuild" AfterTargets="Build">

src/runtime/AttributeErrorHint.cs

Lines changed: 0 additions & 109 deletions
This file was deleted.

src/runtime/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
[assembly: InternalsVisibleTo("Python.EmbeddingTest, PublicKey=00240000048000009400000006020000002400005253413100040000110000005ffd8f49fb44ab0641b3fd8d55e749f716e6dd901032295db641eb98ee46063cbe0d4a1d121ef0bc2af95f8a7438d7a80a3531316e6b75c2dae92fb05a99f03bf7e0c03980e1c3cfb74ba690aca2f3339ef329313bcc5dccced125a4ffdc4531dcef914602cd5878dc5fbb4d4c73ddfbc133f840231343e013762884d6143189")]
55
[assembly: InternalsVisibleTo("Python.Test, PublicKey=00240000048000009400000006020000002400005253413100040000110000005ffd8f49fb44ab0641b3fd8d55e749f716e6dd901032295db641eb98ee46063cbe0d4a1d121ef0bc2af95f8a7438d7a80a3531316e6b75c2dae92fb05a99f03bf7e0c03980e1c3cfb74ba690aca2f3339ef329313bcc5dccced125a4ffdc4531dcef914602cd5878dc5fbb4d4c73ddfbc133f840231343e013762884d6143189")]
66

7-
[assembly: AssemblyVersion("2.0.55")]
8-
[assembly: AssemblyFileVersion("2.0.55")]
7+
[assembly: AssemblyVersion("2.0.54")]
8+
[assembly: AssemblyFileVersion("2.0.54")]

src/runtime/Python.Runtime.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<RootNamespace>Python.Runtime</RootNamespace>
66
<AssemblyName>Python.Runtime</AssemblyName>
77
<PackageId>QuantConnect.pythonnet</PackageId>
8-
<Version>2.0.55</Version>
8+
<Version>2.0.54</Version>
99
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
1010
<PackageLicenseFile>LICENSE</PackageLicenseFile>
1111
<RepositoryUrl>https://github.com/pythonnet/pythonnet</RepositoryUrl>

src/runtime/PythonEngine.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,6 @@ public static void Initialize(IEnumerable<string> args, bool setSysArgv = true,
263263
}
264264

265265
ImportHook.UpdateCLRModuleDict();
266-
267-
// Set up the miss-only __getattr__ hook used to enrich AttributeError
268-
// messages on reflected .NET types with member-name suggestions.
269-
AttributeErrorHint.Initialize();
270266
}
271267

272268
static BorrowedReference DefineModule(string name)
@@ -373,9 +369,6 @@ public static void Shutdown()
373369
AppDomain.CurrentDomain.ProcessExit -= OnProcessExit;
374370

375371
ExecuteShutdownHandlers();
376-
377-
AttributeErrorHint.Shutdown();
378-
379372
// Remember to shut down the runtime.
380373
Runtime.Shutdown();
381374

src/runtime/TypeManager.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,6 @@ internal static void InitializeClass(PyType type, ClassBase impl, Type clrType)
303303

304304
Runtime.PyType_Modified(type.Reference);
305305

306-
// Enrich AttributeError messages for missing attributes with member-name
307-
// suggestions, via a miss-only __getattr__ hook (no hot-path cost).
308-
AttributeErrorHint.Install(type.Reference);
309-
310306
//DebugUtil.DumpType(type);
311307
}
312308

0 commit comments

Comments
 (0)