| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,4 @@ | |||
| 1 | + using System.Reflection.Emit; | ||
| 1 | 2 | using System; | |
| 2 | 3 | using System.Diagnostics.Contracts; | |
| 3 | 4 | using System.Runtime.InteropServices; | |
@@ -118,6 +119,12 @@ public class Runtime | |||
| 118 | 119 | { "Linux", OperatingSystemType.Linux }, | |
| 119 | 120 | }; | |
| 120 | 121 | ||
| 122 | + [Obsolete] | ||
| 123 | + public static string OperatingSystemName => OperatingSystem.ToString(); | ||
| 124 | + | ||
| 125 | + [Obsolete] | ||
| 126 | + public static string MachineName => Machine.ToString(); | ||
| 127 | + | ||
| 121 | 128 | /// <summary> | |
| 122 | 129 | /// Gets the operating system as reported by python's platform.system(). | |
| 123 | 130 | /// </summary> | |
@@ -1990,10 +1997,10 @@ internal static IntPtr PyMem_Realloc(IntPtr ptr, long size) | |||
| 1990 | 1997 | //==================================================================== | |
| 1991 | 1998 | ||
| 1992 | 1999 | [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] | |
| 1993 | - internal static extern NewReference PyCell_Get(IntPtr cell); | ||
| 2000 | + internal static extern NewReference PyCell_Get(BorrowedReference cell); | ||
| 1994 | 2001 | ||
| 1995 | 2002 | [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] | |
| 1996 | - internal static extern int PyCell_Set(IntPtr cell, IntPtr value); | ||
| 2003 | + internal static extern int PyCell_Set(BorrowedReference cell, IntPtr value); | ||
| 1997 | 2004 | ||
| 1998 | 2005 | //==================================================================== | |
| 1999 | 2006 | // Miscellaneous | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -281,8 +281,8 @@ internal static IntPtr CreateSubType(IntPtr py_name, IntPtr py_base_type, IntPtr | |||
| 281 | 281 | Runtime.PyDict_Update(cls_dict, py_dict); | |
| 282 | 282 | ||
| 283 | 283 | // Update the __classcell__ if it exists | |
| 284 | - IntPtr cell = Runtime.PyDict_GetItemString(cls_dict, "__classcell__"); | ||
| 285 | - if (cell != IntPtr.Zero) | ||
| 284 | + var cell = new BorrowedReference(Runtime.PyDict_GetItemString(cls_dict, "__classcell__")); | ||
| 285 | + if (!cell.IsNull) | ||
| 286 | 286 | { | |
| 287 | 287 | Runtime.PyCell_Set(cell, py_type); | |
| 288 | 288 | Runtime.PyDict_DelItemString(cls_dict, "__classcell__"); | |
@@ -625,7 +625,9 @@ int MAP_ANONYMOUS | |||
| 625 | 625 | case OperatingSystemType.Linux: | |
| 626 | 626 | return 0x20; | |
| 627 | 627 | default: | |
| 628 | - throw new NotImplementedException($"mmap is not supported on this operating system"); | ||
| 628 | + throw new NotImplementedException( | ||
| 629 | + $"mmap is not supported on {Runtime.OperatingSystem}" | ||
| 630 | + ); | ||
| 629 | 631 | } | |
| 630 | 632 | } | |
| 631 | 633 | } | |
@@ -659,7 +661,9 @@ internal static IMemoryMapper CreateMemoryMapper() | |||
| 659 | 661 | case OperatingSystemType.Windows: | |
| 660 | 662 | return new WindowsMemoryMapper(); | |
| 661 | 663 | default: | |
| 662 | - throw new NotImplementedException($"No support for this operating system"); | ||
| 664 | + throw new NotImplementedException( | ||
| 665 | + $"No support for {Runtime.OperatingSystem}" | ||
| 666 | + ); | ||
| 663 | 667 | } | |
| 664 | 668 | } | |
| 665 | 669 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments