pythonnet 3.0.5__tar.gz → 3.1.0rc0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/AUTHORS.md +1 -0
  2. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/Directory.Build.props +6 -5
  3. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/PKG-INFO +7 -5
  4. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/pyproject.toml +4 -6
  5. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/pythonnet.egg-info/PKG-INFO +7 -5
  6. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/pythonnet.egg-info/SOURCES.txt +2 -3
  7. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/pythonnet.sln +1 -2
  8. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/AssemblyManager.cs +5 -0
  9. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/ClassManager.cs +17 -0
  10. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Codecs/IterableDecoder.cs +55 -55
  11. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Codecs/ListDecoder.cs +50 -50
  12. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Codecs/SequenceDecoder.cs +48 -48
  13. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/CollectionWrappers/ListWrapper.cs +3 -0
  14. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/CollectionWrappers/SequenceWrapper.cs +16 -7
  15. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/MethodBinder.cs +5 -0
  16. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/PyIdentifier_.cs +3 -3
  17. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/PyIdentifier_.tt +1 -1
  18. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/TypeOffset.cs +15 -0
  19. pythonnet-3.1.0rc0/src/runtime/Native/TypeOffset314.cs +153 -0
  20. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Python.Runtime.csproj +1 -4
  21. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/PythonEngine.cs +1 -1
  22. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Runtime.Delegates.cs +2 -1
  23. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Runtime.cs +19 -24
  24. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/StateSerialization/RuntimeData.cs +3 -1
  25. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/TypeManager.cs +5 -0
  26. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/ArrayObject.cs +6 -0
  27. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/ClassBase.cs +51 -12
  28. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/Indexer.cs +2 -2
  29. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/ManagedTypes.cd +1 -1
  30. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/MetaType.cs +43 -1
  31. pythonnet-3.1.0rc0/src/runtime/Util/PythonEnvironment.cs +188 -0
  32. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Util/ReflectionUtil.cs +7 -0
  33. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_indexer.py +36 -0
  34. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_mp_length.py +63 -63
  35. pythonnet-3.1.0rc0/version.txt +1 -0
  36. pythonnet-3.0.5/src/runtime/Native/TypeOffset37.cs +0 -136
  37. pythonnet-3.0.5/src/runtime/Native/TypeOffset38.cs +0 -138
  38. pythonnet-3.0.5/src/runtime/Native/TypeOffset39.cs +0 -138
  39. pythonnet-3.0.5/version.txt +0 -1
  40. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/LICENSE +0 -0
  41. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/MANIFEST.in +0 -0
  42. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/README.rst +0 -0
  43. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/clr.py +0 -0
  44. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/pythonnet/__init__.py +0 -0
  45. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/pythonnet.egg-info/dependency_links.txt +0 -0
  46. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/pythonnet.egg-info/not-zip-safe +0 -0
  47. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/pythonnet.egg-info/requires.txt +0 -0
  48. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/pythonnet.egg-info/top_level.txt +0 -0
  49. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/setup.cfg +0 -0
  50. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/setup.py +0 -0
  51. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/pythonnet.snk +0 -0
  52. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Codecs/DecoderGroup.cs +0 -0
  53. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Codecs/EncoderGroup.cs +0 -0
  54. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Codecs/EnumPyIntCodec.cs +0 -0
  55. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Codecs/IPyObjectDecoder.cs +0 -0
  56. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Codecs/IPyObjectEncoder.cs +0 -0
  57. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Codecs/PyObjectConversions.cs +0 -0
  58. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Codecs/RawProxyEncoder.cs +0 -0
  59. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Codecs/TupleCodecs.cs +0 -0
  60. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/CollectionWrappers/IterableWrapper.cs +0 -0
  61. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Converter.cs +0 -0
  62. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/DefaultBaseTypeProvider.cs +0 -0
  63. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/DelegateManager.cs +0 -0
  64. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Exceptions.cs +0 -0
  65. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Finalizer.cs +0 -0
  66. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/IPythonBaseTypeProvider.cs +0 -0
  67. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/ImportHook.cs +0 -0
  68. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Interfaces.cs +0 -0
  69. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/InternString.cs +0 -0
  70. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/InternalPythonnetException.cs +0 -0
  71. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Interop.cs +0 -0
  72. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/InteropConfiguration.cs +0 -0
  73. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Loader.cs +0 -0
  74. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Mixins/CollectionMixinsProvider.cs +0 -0
  75. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Mixins/collections.py +0 -0
  76. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/ABI.cs +0 -0
  77. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/BorrowedReference.cs +0 -0
  78. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/CustomMarshaler.cs +0 -0
  79. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/GeneratedTypeOffsets.cs +0 -0
  80. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/ITypeOffsets.cs +0 -0
  81. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/LibDL.cs +0 -0
  82. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/LibraryLoader.cs +0 -0
  83. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/NativeCall.cs +0 -0
  84. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/NativeFunc.cs +0 -0
  85. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/NativeTypeSpec.cs +0 -0
  86. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/NewReference.cs +0 -0
  87. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/PyBufferInterface.cs +0 -0
  88. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/PyCompilerFlags.cs +0 -0
  89. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/PyGILState.cs +0 -0
  90. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/PyInterpreterState.cs +0 -0
  91. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/PyMemberFlags.cs +0 -0
  92. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/PyMemberType.cs +0 -0
  93. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/PyMethodFlags.cs +0 -0
  94. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/PyThreadState.cs +0 -0
  95. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/ReferenceExtensions.cs +0 -0
  96. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/StolenReference.cs +0 -0
  97. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/StrPtr.cs +0 -0
  98. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/TypeOffset310.cs +0 -0
  99. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/TypeOffset311.cs +0 -0
  100. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/TypeOffset312.cs +0 -0
  101. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Native/TypeOffset313.cs +0 -0
  102. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Properties/AssemblyInfo.cs +0 -0
  103. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Py.cs +0 -0
  104. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/PyExportAttribute.cs +0 -0
  105. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/PythonBaseTypeProviderGroup.cs +0 -0
  106. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/PythonException.cs +0 -0
  107. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/PythonTypes/PyBuffer.cs +0 -0
  108. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/PythonTypes/PyDict.cs +0 -0
  109. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/PythonTypes/PyFloat.IComparable.cs +0 -0
  110. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/PythonTypes/PyFloat.cs +0 -0
  111. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/PythonTypes/PyInt.IComparable.cs +0 -0
  112. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/PythonTypes/PyInt.cs +0 -0
  113. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/PythonTypes/PyIter.cs +0 -0
  114. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/PythonTypes/PyIterable.cs +0 -0
  115. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/PythonTypes/PyList.cs +0 -0
  116. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/PythonTypes/PyModule.cs +0 -0
  117. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/PythonTypes/PyNumber.cs +0 -0
  118. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/PythonTypes/PyObject.IConvertible.cs +0 -0
  119. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/PythonTypes/PyObject.cs +0 -0
  120. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/PythonTypes/PySequence.cs +0 -0
  121. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/PythonTypes/PyString.cs +0 -0
  122. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/PythonTypes/PyTuple.cs +0 -0
  123. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/PythonTypes/PyType.cs +0 -0
  124. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/PythonTypes/TypeSpec.cs +0 -0
  125. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/README.md +0 -0
  126. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Resources/clr.py +0 -0
  127. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Resources/interop.py +0 -0
  128. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/RuntimeState.cs +0 -0
  129. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/StateSerialization/CLRMappedItem.cs +0 -0
  130. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/StateSerialization/CLRWrapperCollection.cs +0 -0
  131. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/StateSerialization/ClassManagerState.cs +0 -0
  132. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/StateSerialization/ICLRObjectStorer.cs +0 -0
  133. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/StateSerialization/ImportHookState.cs +0 -0
  134. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/StateSerialization/MaybeMemberInfo.cs +0 -0
  135. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/StateSerialization/MaybeMethodBase.cs +0 -0
  136. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/StateSerialization/MaybeType.cs +0 -0
  137. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/StateSerialization/MetatypeState.cs +0 -0
  138. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/StateSerialization/NoopFormatter.cs +0 -0
  139. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/StateSerialization/PythonNetState.cs +0 -0
  140. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/StateSerialization/SharedObjectsState.cs +0 -0
  141. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/StateSerialization/TypeManagerState.cs +0 -0
  142. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/StateSerialization/UnloadedClass.cs +0 -0
  143. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/ClassDerived.cs +0 -0
  144. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/ClassObject.cs +0 -0
  145. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/ClrModule.cs +0 -0
  146. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/ClrObject.cs +0 -0
  147. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/DelegateObject.cs +0 -0
  148. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/EventBinding.cs +0 -0
  149. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/EventObject.cs +0 -0
  150. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/ExceptionClassObject.cs +0 -0
  151. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/ExtensionType.cs +0 -0
  152. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/FieldObject.cs +0 -0
  153. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/GenericType.cs +0 -0
  154. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/InterfaceObject.cs +0 -0
  155. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/Iterator.cs +0 -0
  156. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/ManagedType.cs +0 -0
  157. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/MethodBinding.cs +0 -0
  158. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/MethodObject.cs +0 -0
  159. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/ModuleFunctionObject.cs +0 -0
  160. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/ModuleObject.cs +0 -0
  161. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/ModulePropertyObject.cs +0 -0
  162. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/MpLengthSlot.cs +0 -0
  163. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/OperatorMethod.cs +0 -0
  164. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/OverloadMapper.cs +0 -0
  165. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/PropertyObject.cs +0 -0
  166. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/ReflectedClrType.cs +0 -0
  167. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Types/UnsafeReferenceWithRun.cs +0 -0
  168. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Util/CodeGenerator.cs +0 -0
  169. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Util/DebugUtil.cs +0 -0
  170. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Util/Encodings.cs +0 -0
  171. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Util/EventHandlerCollection.cs +0 -0
  172. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Util/GenericUtil.cs +0 -0
  173. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Util/InitOnly.cs +0 -0
  174. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Util/NonCopyableAttribute.cs +0 -0
  175. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Util/NullOnly.cs +0 -0
  176. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Util/OpsHelper.cs +0 -0
  177. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Util/ParameterHelper.cs +0 -0
  178. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Util/PythonReferenceComparer.cs +0 -0
  179. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Util/ReflectionPolyfills.cs +0 -0
  180. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/src/runtime/Util/Util.cs +0 -0
  181. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_array.py +0 -0
  182. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_callback.py +0 -0
  183. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_class.py +0 -0
  184. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_clrmethod.py +0 -0
  185. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_codec.py +0 -0
  186. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_collection_mixins.py +0 -0
  187. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_constructors.py +0 -0
  188. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_conversion.py +0 -0
  189. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_delegate.py +0 -0
  190. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_docstring.py +0 -0
  191. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_engine.py +0 -0
  192. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_enum.py +0 -0
  193. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_event.py +0 -0
  194. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_exceptions.py +0 -0
  195. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_field.py +0 -0
  196. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_generic.py +0 -0
  197. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_import.py +0 -0
  198. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_interface.py +0 -0
  199. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_method.py +0 -0
  200. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_module.py +0 -0
  201. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_property.py +0 -0
  202. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_recursive_types.py +0 -0
  203. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_repr.py +0 -0
  204. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_subclass.py +0 -0
  205. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_sysargv.py +0 -0
  206. {pythonnet-3.0.5 → pythonnet-3.1.0rc0}/tests/test_thread.py +0 -0
@@ -59,6 +59,7 @@
59
59
  - Peter Kese ([@pkese](https://github.com/pkese))
60
60
  - Raphael Nestler ([@rnestler](https://github.com/rnestler))
61
61
  - Rickard Holmberg ([@rickardraysearch](https://github.com/rickardraysearch))
62
+ - Roberto Pastor Muela ([@RobPasMue](https://github.com/RobPasMue))
62
63
  - Sam Winstanley ([@swinstanley](https://github.com/swinstanley))
63
64
  - Sean Freitag ([@cowboygneox](https://github.com/cowboygneox))
64
65
  - Serge Weinstock ([@sweinst](https://github.com/sweinst))
@@ -1,24 +1,25 @@
1
1
  <?xml version="1.0"?>
2
2
  <Project>
3
3
  <PropertyGroup>
4
- <AssemblyCopyright>Copyright (c) 2006-2022 The Contributors of the Python.NET Project</AssemblyCopyright>
4
+ <AssemblyCopyright>Copyright (c) 2006-2025 The Contributors of the Python.NET Project</AssemblyCopyright>
5
5
  <AssemblyCompany>pythonnet</AssemblyCompany>
6
6
  <AssemblyProduct>Python.NET</AssemblyProduct>
7
- <LangVersion>10.0</LangVersion>
7
+ <LangVersion>12.0</LangVersion>
8
8
  <IsPackable>false</IsPackable>
9
9
  <FullVersion>$([System.IO.File]::ReadAllText("$(MSBuildThisFileDirectory)version.txt").Trim())</FullVersion>
10
10
  <VersionPrefix>$(FullVersion.Split('-', 2)[0])</VersionPrefix>
11
11
  <VersionSuffix Condition="$(FullVersion.Contains('-'))">$(FullVersion.Split('-', 2)[1])</VersionSuffix>
12
+ <RepositoryRoot>$(MSBuildThisFileDirectory)</RepositoryRoot>
12
13
  </PropertyGroup>
13
14
  <ItemGroup>
14
15
  <PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
15
- <PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="4.0.1">
16
+ <PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="4.12.0">
16
17
  <PrivateAssets>all</PrivateAssets>
17
18
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
18
19
  </PackageReference>
19
- <PackageReference Include="NonCopyableAnalyzer" Version="0.7.0">
20
+ <!-- PackageReference Include="NonCopyableAnalyzer" Version="0.7.0">
20
21
  <PrivateAssets>all</PrivateAssets>
21
22
  <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
22
- </PackageReference>
23
+ </PackageReference -->
23
24
  </ItemGroup>
24
25
  </Project>
@@ -1,14 +1,13 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: pythonnet
3
- Version: 3.0.5
3
+ Version: 3.1.0rc0
4
4
  Summary: .NET and Mono integration for Python
5
5
  Author-email: "The Contributors of the Python.NET Project" <pythonnet@python.org>
6
- License: MIT
6
+ License-Expression: MIT
7
7
  Project-URL: Homepage, https://pythonnet.github.io/
8
8
  Project-URL: Sources, https://github.com/pythonnet/pythonnet
9
9
  Classifier: Development Status :: 5 - Production/Stable
10
10
  Classifier: Intended Audience :: Developers
11
- Classifier: License :: OSI Approved :: MIT License
12
11
  Classifier: Programming Language :: C#
13
12
  Classifier: Programming Language :: Python :: 3
14
13
  Classifier: Programming Language :: Python :: 3.7
@@ -21,9 +20,12 @@ Classifier: Programming Language :: Python :: 3.13
21
20
  Classifier: Operating System :: Microsoft :: Windows
22
21
  Classifier: Operating System :: POSIX :: Linux
23
22
  Classifier: Operating System :: MacOS :: MacOS X
24
- Requires-Python: <3.14,>=3.7
23
+ Requires-Python: <3.15,>=3.10
25
24
  Description-Content-Type: text/x-rst
25
+ License-File: LICENSE
26
+ License-File: AUTHORS.md
26
27
  Requires-Dist: clr_loader<0.3.0,>=0.2.7
28
+ Dynamic: license-file
27
29
 
28
30
  pythonnet - Python.NET
29
31
  ===========================
@@ -1,11 +1,11 @@
1
1
  [build-system]
2
- requires = ["setuptools>=61", "wheel"]
2
+ requires = ["setuptools>=80"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pythonnet"
7
7
  description = ".NET and Mono integration for Python"
8
- license = {text = "MIT"}
8
+ license = "MIT"
9
9
 
10
10
  readme = "README.rst"
11
11
 
@@ -13,12 +13,11 @@ dependencies = [
13
13
  "clr_loader>=0.2.7,<0.3.0"
14
14
  ]
15
15
 
16
- requires-python = ">=3.7, <3.14"
16
+ requires-python = ">=3.10, <3.15"
17
17
 
18
18
  classifiers = [
19
19
  "Development Status :: 5 - Production/Stable",
20
20
  "Intended Audience :: Developers",
21
- "License :: OSI Approved :: MIT License",
22
21
  "Programming Language :: C#",
23
22
  "Programming Language :: Python :: 3",
24
23
  "Programming Language :: Python :: 3.7",
@@ -38,7 +37,7 @@ dynamic = ["version"]
38
37
  [dependency-groups]
39
38
  dev = [
40
39
  "pytest >= 6",
41
- "find_libpython >= 0.3.0",
40
+ "find_libpython >= 0.3",
42
41
  "numpy >=2 ; python_version >= '3.10'",
43
42
  "numpy <2 ; python_version < '3.10'",
44
43
  "psutil"
@@ -55,7 +54,6 @@ Sources = "https://github.com/pythonnet/pythonnet"
55
54
  [tool.setuptools]
56
55
  zip-safe = false
57
56
  py-modules = ["clr"]
58
- license-files = []
59
57
 
60
58
  [tool.setuptools.dynamic.version]
61
59
  file = "version.txt"
@@ -1,14 +1,13 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: pythonnet
3
- Version: 3.0.5
3
+ Version: 3.1.0rc0
4
4
  Summary: .NET and Mono integration for Python
5
5
  Author-email: "The Contributors of the Python.NET Project" <pythonnet@python.org>
6
- License: MIT
6
+ License-Expression: MIT
7
7
  Project-URL: Homepage, https://pythonnet.github.io/
8
8
  Project-URL: Sources, https://github.com/pythonnet/pythonnet
9
9
  Classifier: Development Status :: 5 - Production/Stable
10
10
  Classifier: Intended Audience :: Developers
11
- Classifier: License :: OSI Approved :: MIT License
12
11
  Classifier: Programming Language :: C#
13
12
  Classifier: Programming Language :: Python :: 3
14
13
  Classifier: Programming Language :: Python :: 3.7
@@ -21,9 +20,12 @@ Classifier: Programming Language :: Python :: 3.13
21
20
  Classifier: Operating System :: Microsoft :: Windows
22
21
  Classifier: Operating System :: POSIX :: Linux
23
22
  Classifier: Operating System :: MacOS :: MacOS X
24
- Requires-Python: <3.14,>=3.7
23
+ Requires-Python: <3.15,>=3.10
25
24
  Description-Content-Type: text/x-rst
25
+ License-File: LICENSE
26
+ License-File: AUTHORS.md
26
27
  Requires-Dist: clr_loader<0.3.0,>=0.2.7
28
+ Dynamic: license-file
27
29
 
28
30
  pythonnet - Python.NET
29
31
  ===========================
@@ -88,9 +88,7 @@ src/runtime/Native/TypeOffset310.cs
88
88
  src/runtime/Native/TypeOffset311.cs
89
89
  src/runtime/Native/TypeOffset312.cs
90
90
  src/runtime/Native/TypeOffset313.cs
91
- src/runtime/Native/TypeOffset37.cs
92
- src/runtime/Native/TypeOffset38.cs
93
- src/runtime/Native/TypeOffset39.cs
91
+ src/runtime/Native/TypeOffset314.cs
94
92
  src/runtime/Properties/AssemblyInfo.cs
95
93
  src/runtime/PythonTypes/PyBuffer.cs
96
94
  src/runtime/PythonTypes/PyDict.cs
@@ -167,6 +165,7 @@ src/runtime/Util/NonCopyableAttribute.cs
167
165
  src/runtime/Util/NullOnly.cs
168
166
  src/runtime/Util/OpsHelper.cs
169
167
  src/runtime/Util/ParameterHelper.cs
168
+ src/runtime/Util/PythonEnvironment.cs
170
169
  src/runtime/Util/PythonReferenceComparer.cs
171
170
  src/runtime/Util/ReflectionPolyfills.cs
172
171
  src/runtime/Util/ReflectionUtil.cs
@@ -8,8 +8,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.EmbeddingTest", "src
8
8
  EndProject
9
9
  Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.Test", "src\testing\Python.Test.csproj", "{14EF9518-5BB7-4F83-8686-015BD2CC788E}"
10
10
  EndProject
11
- Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.PerformanceTests", "src\perf_tests\Python.PerformanceTests.csproj", "{4F2EA4A1-7ECA-48B5-8077-7A3C366F9931}"
12
- EndProject
13
11
  Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.DomainReloadTests", "tests\domain_tests\Python.DomainReloadTests.csproj", "{F2FB6DA3-318E-4F30-9A1F-932C667E38C5}"
14
12
  EndProject
15
13
  Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Repo", "Repo", "{441A0123-F4C6-4EE4-9AEE-315FD79BE2D5}"
@@ -20,6 +18,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Repo", "Repo", "{441A0123-F
20
18
  LICENSE = LICENSE
21
19
  README.rst = README.rst
22
20
  version.txt = version.txt
21
+ shell.nix = shell.nix
23
22
  EndProjectSection
24
23
  EndProject
25
24
  Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CI", "CI", "{D301657F-5EAF-4534-B280-B858D651B2E5}"
@@ -123,6 +123,11 @@ namespace Python.Runtime
123
123
 
124
124
  internal static AssemblyName? TryParseAssemblyName(string name)
125
125
  {
126
+ // workaround for https://github.com/dotnet/runtime/issues/123951
127
+ if (name.IndexOfAny(new[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }) >= 0)
128
+ {
129
+ return null;
130
+ }
126
131
  try
127
132
  {
128
133
  return new AssemblyName(name);
@@ -213,6 +213,7 @@ namespace Python.Runtime
213
213
  ClassInfo info = GetClassInfo(type, impl);
214
214
 
215
215
  impl.indexer = info.indexer;
216
+ impl.del = info.del;
216
217
  impl.richcompare.Clear();
217
218
 
218
219
 
@@ -538,6 +539,21 @@ namespace Python.Runtime
538
539
 
539
540
  ob = new MethodObject(type, name, mlist);
540
541
  ci.members[name] = ob.AllocObject();
542
+ if (name == nameof(IDictionary<int, int>.Remove)
543
+ && mlist.Any(m => m.DeclaringType?.GetInterfaces()
544
+ .Any(i => i.TryGetGenericDefinition() == typeof(IDictionary<,>)) is true))
545
+ {
546
+ ci.del = new();
547
+ ci.del.AddRange(mlist.Where(m => !m.IsStatic));
548
+ }
549
+ else if (name == nameof(IList<int>.RemoveAt)
550
+ && mlist.Any(m => m.DeclaringType?.GetInterfaces()
551
+ .Any(i => i.TryGetGenericDefinition() == typeof(IList<>)) is true))
552
+ {
553
+ ci.del = new();
554
+ ci.del.AddRange(mlist.Where(m => !m.IsStatic));
555
+ }
556
+
541
557
  if (mlist.Any(OperatorMethod.IsOperatorMethod))
542
558
  {
543
559
  string pyName = OperatorMethod.GetPyMethodName(name);
@@ -581,6 +597,7 @@ namespace Python.Runtime
581
597
  private class ClassInfo
582
598
  {
583
599
  public Indexer? indexer;
600
+ public MethodBinder? del;
584
601
  public readonly Dictionary<string, PyObject> members = new();
585
602
 
586
603
  internal ClassInfo()
@@ -1,55 +1,55 @@
1
- using System;
2
- using System.Collections.Generic;
3
-
4
- namespace Python.Runtime.Codecs
5
- {
6
- public class IterableDecoder : IPyObjectDecoder
7
- {
8
- internal static bool IsIterable(Type targetType)
9
- {
10
- //if it is a plain IEnumerable, we can decode it using sequence protocol.
11
- if (targetType == typeof(System.Collections.IEnumerable))
12
- return true;
13
-
14
- if (!targetType.IsGenericType)
15
- return false;
16
-
17
- return targetType.GetGenericTypeDefinition() == typeof(IEnumerable<>);
18
- }
19
-
20
- internal static bool IsIterable(PyType objectType)
21
- {
22
- return objectType.HasAttr("__iter__");
23
- }
24
-
25
- public bool CanDecode(PyType objectType, Type targetType)
26
- {
27
- return IsIterable(objectType) && IsIterable(targetType);
28
- }
29
-
30
- public bool TryDecode<T>(PyObject pyObj, out T value)
31
- {
32
- //first see if T is a plan IEnumerable
33
- if (typeof(T) == typeof(System.Collections.IEnumerable))
34
- {
35
- object enumerable = new CollectionWrappers.IterableWrapper<object>(pyObj);
36
- value = (T)enumerable;
37
- return true;
38
- }
39
-
40
- var elementType = typeof(T).GetGenericArguments()[0];
41
- var collectionType = typeof(CollectionWrappers.IterableWrapper<>).MakeGenericType(elementType);
42
-
43
- var instance = Activator.CreateInstance(collectionType, new[] { pyObj });
44
- value = (T)instance;
45
- return true;
46
- }
47
-
48
- public static IterableDecoder Instance { get; } = new IterableDecoder();
49
-
50
- public static void Register()
51
- {
52
- PyObjectConversions.RegisterDecoder(Instance);
53
- }
54
- }
55
- }
1
+ using System;
2
+ using System.Collections.Generic;
3
+
4
+ namespace Python.Runtime.Codecs
5
+ {
6
+ public class IterableDecoder : IPyObjectDecoder
7
+ {
8
+ internal static bool IsIterable(Type targetType)
9
+ {
10
+ //if it is a plain IEnumerable, we can decode it using sequence protocol.
11
+ if (targetType == typeof(System.Collections.IEnumerable))
12
+ return true;
13
+
14
+ if (!targetType.IsGenericType)
15
+ return false;
16
+
17
+ return targetType.GetGenericTypeDefinition() == typeof(IEnumerable<>);
18
+ }
19
+
20
+ internal static bool IsIterable(PyType objectType)
21
+ {
22
+ return objectType.HasAttr("__iter__");
23
+ }
24
+
25
+ public bool CanDecode(PyType objectType, Type targetType)
26
+ {
27
+ return IsIterable(objectType) && IsIterable(targetType);
28
+ }
29
+
30
+ public bool TryDecode<T>(PyObject pyObj, out T value)
31
+ {
32
+ //first see if T is a plan IEnumerable
33
+ if (typeof(T) == typeof(System.Collections.IEnumerable))
34
+ {
35
+ object enumerable = new CollectionWrappers.IterableWrapper<object>(pyObj);
36
+ value = (T)enumerable;
37
+ return true;
38
+ }
39
+
40
+ var elementType = typeof(T).GetGenericArguments()[0];
41
+ var collectionType = typeof(CollectionWrappers.IterableWrapper<>).MakeGenericType(elementType);
42
+
43
+ var instance = Activator.CreateInstance(collectionType, new[] { pyObj });
44
+ value = (T)instance;
45
+ return true;
46
+ }
47
+
48
+ public static IterableDecoder Instance { get; } = new IterableDecoder();
49
+
50
+ public static void Register()
51
+ {
52
+ PyObjectConversions.RegisterDecoder(Instance);
53
+ }
54
+ }
55
+ }
@@ -1,50 +1,50 @@
1
- using System;
2
- using System.Collections.Generic;
3
-
4
- namespace Python.Runtime.Codecs
5
- {
6
- public class ListDecoder : IPyObjectDecoder
7
- {
8
- private static bool IsList(Type targetType)
9
- {
10
- if (!targetType.IsGenericType)
11
- return false;
12
-
13
- return targetType.GetGenericTypeDefinition() == typeof(IList<>);
14
- }
15
-
16
- private static bool IsList(PyType objectType)
17
- {
18
- //TODO accept any python object that implements the sequence and list protocols
19
- //must implement sequence protocol to fully implement list protocol
20
- //if (!SequenceDecoder.IsSequence(objectType)) return false;
21
-
22
- //returns wheter the type is a list.
23
- return PythonReferenceComparer.Instance.Equals(objectType, Runtime.PyListType);
24
- }
25
-
26
- public bool CanDecode(PyType objectType, Type targetType)
27
- {
28
- return IsList(objectType) && IsList(targetType);
29
- }
30
-
31
- public bool TryDecode<T>(PyObject pyObj, out T value)
32
- {
33
- if (pyObj == null) throw new ArgumentNullException(nameof(pyObj));
34
-
35
- var elementType = typeof(T).GetGenericArguments()[0];
36
- Type collectionType = typeof(CollectionWrappers.ListWrapper<>).MakeGenericType(elementType);
37
-
38
- var instance = Activator.CreateInstance(collectionType, new[] { pyObj });
39
- value = (T)instance;
40
- return true;
41
- }
42
-
43
- public static ListDecoder Instance { get; } = new ListDecoder();
44
-
45
- public static void Register()
46
- {
47
- PyObjectConversions.RegisterDecoder(Instance);
48
- }
49
- }
50
- }
1
+ using System;
2
+ using System.Collections.Generic;
3
+
4
+ namespace Python.Runtime.Codecs
5
+ {
6
+ public class ListDecoder : IPyObjectDecoder
7
+ {
8
+ private static bool IsList(Type targetType)
9
+ {
10
+ if (!targetType.IsGenericType)
11
+ return false;
12
+
13
+ return targetType.GetGenericTypeDefinition() == typeof(IList<>);
14
+ }
15
+
16
+ private static bool IsList(PyType objectType)
17
+ {
18
+ //TODO accept any python object that implements the sequence and list protocols
19
+ //must implement sequence protocol to fully implement list protocol
20
+ //if (!SequenceDecoder.IsSequence(objectType)) return false;
21
+
22
+ //returns wheter the type is a list.
23
+ return PythonReferenceComparer.Instance.Equals(objectType, Runtime.PyListType);
24
+ }
25
+
26
+ public bool CanDecode(PyType objectType, Type targetType)
27
+ {
28
+ return IsList(objectType) && IsList(targetType);
29
+ }
30
+
31
+ public bool TryDecode<T>(PyObject pyObj, out T value)
32
+ {
33
+ if (pyObj == null) throw new ArgumentNullException(nameof(pyObj));
34
+
35
+ var elementType = typeof(T).GetGenericArguments()[0];
36
+ Type collectionType = typeof(CollectionWrappers.ListWrapper<>).MakeGenericType(elementType);
37
+
38
+ var instance = Activator.CreateInstance(collectionType, new[] { pyObj });
39
+ value = (T)instance;
40
+ return true;
41
+ }
42
+
43
+ public static ListDecoder Instance { get; } = new ListDecoder();
44
+
45
+ public static void Register()
46
+ {
47
+ PyObjectConversions.RegisterDecoder(Instance);
48
+ }
49
+ }
50
+ }
@@ -1,52 +1,52 @@
1
- using System;
2
- using System.Collections.Generic;
3
-
4
- namespace Python.Runtime.Codecs
5
- {
6
- public class SequenceDecoder : IPyObjectDecoder
7
- {
8
- internal static bool IsSequence(Type targetType)
9
- {
10
- if (!targetType.IsGenericType)
11
- return false;
12
-
13
- return targetType.GetGenericTypeDefinition() == typeof(ICollection<>);
14
- }
15
-
16
- internal static bool IsSequence(PyType objectType)
17
- {
18
- //must implement iterable protocol to fully implement sequence protocol
19
- if (!IterableDecoder.IsIterable(objectType)) return false;
20
-
1
+ using System;
2
+ using System.Collections.Generic;
3
+
4
+ namespace Python.Runtime.Codecs
5
+ {
6
+ public class SequenceDecoder : IPyObjectDecoder
7
+ {
8
+ internal static bool IsSequence(Type targetType)
9
+ {
10
+ if (!targetType.IsGenericType)
11
+ return false;
12
+
13
+ return targetType.GetGenericTypeDefinition() == typeof(ICollection<>);
14
+ }
15
+
16
+ internal static bool IsSequence(PyType objectType)
17
+ {
18
+ //must implement iterable protocol to fully implement sequence protocol
19
+ if (!IterableDecoder.IsIterable(objectType)) return false;
20
+
21
21
  //returns wheter it implements the sequence protocol
22
22
  //according to python doc this needs to exclude dict subclasses
23
23
  //but I don't know how to look for that given the objectType
24
24
  //rather than the instance.
25
- return objectType.HasAttr("__getitem__");
26
- }
27
-
28
- public bool CanDecode(PyType objectType, Type targetType)
29
- {
30
- return IsSequence(objectType) && IsSequence(targetType);
31
- }
32
-
33
- public bool TryDecode<T>(PyObject pyObj, out T value)
34
- {
35
- if (pyObj == null) throw new ArgumentNullException(nameof(pyObj));
36
-
37
- var elementType = typeof(T).GetGenericArguments()[0];
38
- Type collectionType = typeof(CollectionWrappers.SequenceWrapper<>).MakeGenericType(elementType);
39
-
40
- var instance = Activator.CreateInstance(collectionType, new[] { pyObj });
41
- value = (T)instance;
42
- return true;
43
- }
44
-
45
- public static SequenceDecoder Instance { get; } = new SequenceDecoder();
46
-
47
- public static void Register()
48
- {
49
- PyObjectConversions.RegisterDecoder(Instance);
50
- }
51
- }
52
- }
25
+ return objectType.HasAttr("__getitem__");
26
+ }
27
+
28
+ public bool CanDecode(PyType objectType, Type targetType)
29
+ {
30
+ return IsSequence(objectType) && IsSequence(targetType);
31
+ }
32
+
33
+ public bool TryDecode<T>(PyObject pyObj, out T value)
34
+ {
35
+ if (pyObj == null) throw new ArgumentNullException(nameof(pyObj));
36
+
37
+ var elementType = typeof(T).GetGenericArguments()[0];
38
+ Type collectionType = typeof(CollectionWrappers.SequenceWrapper<>).MakeGenericType(elementType);
39
+
40
+ var instance = Activator.CreateInstance(collectionType, new[] { pyObj });
41
+ value = (T)instance;
42
+ return true;
43
+ }
44
+
45
+ public static SequenceDecoder Instance { get; } = new SequenceDecoder();
46
+
47
+ public static void Register()
48
+ {
49
+ PyObjectConversions.RegisterDecoder(Instance);
50
+ }
51
+ }
52
+ }
@@ -14,12 +14,14 @@ namespace Python.Runtime.CollectionWrappers
14
14
  {
15
15
  get
16
16
  {
17
+ using var _ = Py.GIL();
17
18
  var item = Runtime.PyList_GetItem(pyObject, index);
18
19
  var pyItem = new PyObject(item);
19
20
  return pyItem.As<T>()!;
20
21
  }
21
22
  set
22
23
  {
24
+ using var _ = Py.GIL();
23
25
  var pyItem = value.ToPython();
24
26
  var result = Runtime.PyList_SetItem(pyObject, index, new NewReference(pyItem).Steal());
25
27
  if (result == -1)
@@ -37,6 +39,7 @@ namespace Python.Runtime.CollectionWrappers
37
39
  if (IsReadOnly)
38
40
  throw new InvalidOperationException("Collection is read-only");
39
41
 
42
+ using var _ = Py.GIL();
40
43
  var pyItem = item.ToPython();
41
44
 
42
45
  int result = Runtime.PyList_Insert(pyObject, index, pyItem);
@@ -14,10 +14,14 @@ namespace Python.Runtime.CollectionWrappers
14
14
  {
15
15
  get
16
16
  {
17
- var size = Runtime.PySequence_Size(pyObject.Reference);
18
- if (size == -1)
17
+ nint size = -1;
19
18
  {
20
- Runtime.CheckExceptionOccurred();
19
+ using var _ = Py.GIL();
20
+ size = Runtime.PySequence_Size(pyObject.Reference);
21
+ if (size == -1)
22
+ {
23
+ Runtime.CheckExceptionOccurred();
24
+ }
21
25
  }
22
26
 
23
27
  return checked((int)size);
@@ -38,6 +42,7 @@ namespace Python.Runtime.CollectionWrappers
38
42
  {
39
43
  if (IsReadOnly)
40
44
  throw new NotImplementedException();
45
+ using var _ = Py.GIL();
41
46
  int result = Runtime.PySequence_DelSlice(pyObject, 0, Count);
42
47
  if (result == -1)
43
48
  {
@@ -77,12 +82,16 @@ namespace Python.Runtime.CollectionWrappers
77
82
  if (index >= Count || index < 0)
78
83
  return false;
79
84
 
80
- int result = Runtime.PySequence_DelItem(pyObject, index);
81
85
 
82
- if (result == 0)
83
- return true;
86
+ {
87
+ using var _ = Py.GIL();
88
+ int result = Runtime.PySequence_DelItem(pyObject, index);
89
+
90
+ if (result == 0)
91
+ return true;
84
92
 
85
- Runtime.CheckExceptionOccurred();
93
+ Runtime.CheckExceptionOccurred();
94
+ }
86
95
  return false;
87
96
  }
88
97
 
@@ -54,6 +54,11 @@ namespace Python.Runtime
54
54
  list.Add(m);
55
55
  }
56
56
 
57
+ internal void AddRange(IEnumerable<MethodBase> methods)
58
+ {
59
+ list.AddRange(methods.Select(m => new MaybeMethodBase(m)));
60
+ }
61
+
57
62
  /// <summary>
58
63
  /// Given a sequence of MethodInfo and a sequence of types, return the
59
64
  /// MethodInfo that matches the signature represented by those types.