| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
The tests are marked as expected failures for now.
Even though it tests nothing.
| string[] types = new string[p.Length]; | ||
| for (int i = 0; i < p.Length; i++) | ||
| { | ||
| types[i] = p[i].ParameterType.AssemblyQualifiedName; |
There was a problem hiding this comment.
Does this work correctly for out and ref parameters? There might be more edge cases.
Potentially in parameters also.
Sorry, something went wrong.
There was a problem hiding this comment.
I'll have to test
Sorry, something went wrong.
There was a problem hiding this comment.
Did a quick check and out and ref parameters both reflect to void function (SomeType ByRef) with the type argument being of type (SomeType&, ...). Haven't been able to test with in (couldn't get to set the language version high enough in TestRunner.cs), but it looks like it's doing the correct thing. Will add a test case for it.
Sorry, something went wrong.
There was a problem hiding this comment.
Ah, found an edge case where changing ref to out will still "resolve" the function even though the semantics are now different
Sorry, something went wrong.
| // Trying to remove a key that's not in the dictionary may | ||
| // raise an error. We don't care about it. | ||
| Runtime.PyErr_Clear(); |
There was a problem hiding this comment.
You must check for the specific error type after each call. See PyObject.GetAttrOrDefault for example.
Sorry, something went wrong.
| var _cache = new Dictionary<MaybeType, IntPtr>(); | ||
| storage.GetValue("cache", out _cache); |
There was a problem hiding this comment.
the value you put into _cache here will always be overwritten.
You can (and should) use out var _cache.
Sorry, something went wrong.
| catch | ||
| { | ||
| Runtime.XDecref(entry.Value); | ||
| continue; | ||
| } |
There was a problem hiding this comment.
Is there a specific exception we could handle?
Can the exception be avoided in the first place by adding a precheck?
Sorry, something went wrong.
There was a problem hiding this comment.
... adding a precheck?
Yes
Sorry, something went wrong.
Serialization of System.Type, MemberInfo and MethodBase is now string based. At deserialization, use reflection to attempt to recreate the object, which may fail safely instead of throwing a SerializaitonException during the deserialization of the whoie data stream. Appropriate Exceptions will now be raised when the Maybe*'s Value property. ClasseBase objects are now de-initialized and re-initialized in Reload mode so that it's tp_dict picks up newly added members and removed members no longer linger. ModuleObject clears it's cache and remove cached members from it's tp_dict. Minor refactoring and modernization of MethodObject and MethodBinder
Changing a type's attribute causes problem with it's cache. Force the type to refresh itself when modifying it.
* Revert line endings change in Python.Runtime.csproj * Split maybe serialize into respective class files * Name changes for consistency
Codecov Report
@@ Coverage Diff @@
## master #1287 +/- ##
=======================================
Coverage 74.04% 74.04%
=======================================
Files 1 1
Lines 289 289
=======================================
Hits 214 214
Misses 75 75
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
Sorry, something went wrong.
So that we can use that same logic when deserializing Maybe* types
| // based on it's setter/getter (which is a method | ||
| // info) visibility and events based on their | ||
| // AddMethod visibility. | ||
| static bool ShouldBindMember(MemberInfo mi) |
There was a problem hiding this comment.
I'm not totally satisfied with this solution, but it's the best I could find. If anyone has a better idea..
Sorry, something went wrong.
There was a problem hiding this comment.
You could also leave this abstract and have class MaybePropertyInfo : MaybeMemberInfo<PropertyInfo> and so on, enforcing that if the type of member changed then it doesn't count as a match.
Sorry, something went wrong.
There was a problem hiding this comment.
But maybe that's not critical.
Sorry, something went wrong.
Serialization of System.Type, MemberInfo and MethodBase is now string based. At deserialization, use reflection to attempt to recreate the object, which may fail safely instead of throwing a SerializaitonException during the deserialization of the whoie data stream. Appropriate Exceptions will now be raised when the Maybe*'s Value property. ClasseBase objects are now de-initialized and re-initialized in Reload mode so that it's tp_dict picks up newly added members and removed members no longer linger. ModuleObject clears it's cache and remove cached members from it's tp_dict. Minor refactoring and modernization of MethodObject and MethodBinder
Changing a type's attribute causes problem with it's cache. Force the type to refresh itself when modifying it.
* Revert line endings change in Python.Runtime.csproj * Split maybe serialize into respective class files * Name changes for consistency
So that we can use that same logic when deserializing Maybe* types
Because it can't find the python library
Because tp_clear sets tpHandle to NULL, it can't be used. Fortunately, we can simply read object's type from pyHandle.
… engine shutdown (pythonnet#1260) pythonnet#1256 pythonnet#1256 During engine shutdown all links from Python to .NET instances are severed. If an instance of CLR class defined in Python survives the shutdown (for example, a reference is stored in static field) and later gets finalized, it will attempt to severe link again, which is an invalid operation. The fix is to check if the link has already been severed and skip that step during finalization.
|
Build failures are due to NuGet hiccups /usr/share/dotnet/sdk/5.0.101/NuGet.targets(131,5): error : Failed to retrieve information about 'System.Security.Permissions' from remote source 'https://api.nuget.org/v3-flatcontainer/system.security.permissions/index.json'. [/tmp/pip-req-build-49umrav0/src/runtime/Python.Runtime.csproj] /usr/share/dotnet/sdk/5.0.101/NuGet.targets(131,5): error : Response status code does not indicate success: 503 (Service Not Available). [/tmp/pip-req-build-49umrav0/src/runtime/Python.Runtime.csproj] |
Sorry, something went wrong.
| }} | ||
| }} | ||
| "; | ||
| readonly static string PythonDllLocation = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Python.Runtime.dll"); |
There was a problem hiding this comment.
NIT: I might be more reliable to do typeof(Py).Assembly.Location.
Sorry, something went wrong.
| File.Delete(tempFolderPython); | ||
| } | ||
|
|
||
| File.Copy(PythonDllLocation, tempFolderPython); |
There was a problem hiding this comment.
IMHO, the test should also delete the DLL.
I would also create a new folder (and delete after) for every run instead of always putting DLL directly in %TEMP%, because this might affect tests running in parallel.
Sorry, something went wrong.
There was a problem hiding this comment.
I totally agree with this
Sorry, something went wrong.
| CompilerParameters parameters = new CompilerParameters(); | ||
| parameters.GenerateExecutable = exe; | ||
| var assemblyName = name; | ||
| var assemblyFullPath = Path.Combine(Path.GetTempPath(), assemblyName); |
There was a problem hiding this comment.
Same: better have a run-specific folder.
Sorry, something went wrong.
| if (mi == null) | ||
| { | ||
| return -1; | ||
| } | ||
|
|
There was a problem hiding this comment.
I think int.Max would be more appropriate. Higher the number - lower the priority.
UPD. can this even be null?
Sorry, something went wrong.
There was a problem hiding this comment.
it could be null if we change the return type to int? but it's not useful. int.Max it is
Sorry, something went wrong.
| } | ||
|
|
||
| private void _MethodObject(Type type, string name, MethodInfo[] info) | ||
| // `allow_threads = true`: True being the default value of MethodBinder.allow_threads |
There was a problem hiding this comment.
Better use a constant.
Sorry, something went wrong.
|
I'll be on holidays for two weeks, I'll fix that when back in office |
Sorry, something went wrong.
|
|
||
| static void SetupTestFolder(string testCaseName) | ||
| { | ||
| TestPath = Path.Combine(Path.GetTempPath(), $"Python.TestRunner.{testCaseName}"); |
There was a problem hiding this comment.
I think some random number should also be added to indicate the overall run, so that different runs would not clash.
Sorry, something went wrong.
There was a problem hiding this comment.
They wouldn't, if the folder exists when setting up the test, it gets deleted first. Also, the executable can only run one test per invocation. One could run all the tests in parallel, and there'd be no clashing. If a test fails, the folder is not deleted and the contents cans be examined.
Sorry, something went wrong.
There was a problem hiding this comment.
I still see a problem with running tests for multiple Python versions on the same machine in parallel.
Sorry, something went wrong.
There was a problem hiding this comment.
Ah, I hadn't thought about that one. I'll add the python version and architecture to the folder name.
Sorry, something went wrong.
There was a problem hiding this comment.
I'll add the PID instead
Sorry, something went wrong.
To the test folder name
| Back | FazBrowse Home | New Git URL |
What does this implement/fix? Explain your changes.
This PR adds the fixes for the xfail tests in #1275 .
Serialization of System.Type, MemberInfo and MethodBase is now string based. At de-serialization, use reflection to attempt to recreate the object, which now fails safely instead of throwing a SerializationException during the de-serialization of the whole data stream. Appropriate Exceptions will now be raised when the Maybe*'s Value property is accessed.
Does this close any currently open issues?
This addresses #957 and #1250 and offers an answer to #1268 .
Any other comments?
TODO: add changelog entries once the fixes are approved. Also, add docs on best practices with domain reloads.
Checklist
Check all those that are applicable and complete.