| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,7 +25,7 @@ | |||
| 25 | 25 | ||
| 26 | 26 | # Allow config/verbosity to be set from cli | |
| 27 | 27 | # http://stackoverflow.com/a/4792601/5208670 | |
| 28 | - CONFIG = "Release" # Release or Debug | ||
| 28 | + CONFIG = "Debug" # Release or Debug | ||
| 29 | 29 | VERBOSITY = "normal" # quiet, minimal, normal, detailed, diagnostic | |
| 30 | 30 | ||
| 31 | 31 | is_64bits = sys.maxsize > 2 ** 32 | |
@@ -356,16 +356,6 @@ def build_extension(self, ext): | |||
| 356 | 356 | ), | |
| 357 | 357 | shell=use_shell, | |
| 358 | 358 | ) | |
| 359 | - subprocess.check_call( | ||
| 360 | - " ".join( | ||
| 361 | - cmd | ||
| 362 | - + [ | ||
| 363 | - '"/t:Python_PerformanceTests:publish"', | ||
| 364 | - "/p:TargetFramework=net461", | ||
| 365 | - ] | ||
| 366 | - ), | ||
| 367 | - shell=use_shell, | ||
| 368 | - ) | ||
| 369 | 359 | if DEVTOOLS == "Mono" or DEVTOOLS == "dotnet": | |
| 370 | 360 | self._build_monoclr() | |
| 371 | 361 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,7 +12,7 @@ internal CLRObject(object ob, IntPtr tp) | |||
| 12 | 12 | IntPtr py = Runtime.PyType_GenericAlloc(tp, 0); | |
| 13 | 13 | ||
| 14 | 14 | long flags = Util.ReadCLong(tp, TypeOffset.tp_flags); | |
| 15 | - if ((flags & TypeFlags.Subclass) != 0) | ||
| 15 | + if ((flags & (int)TypeFlags.Subclass) != 0) | ||
| 16 | 16 | { | |
| 17 | 17 | IntPtr dict = Marshal.ReadIntPtr(py, ObjectOffset.TypeDictOffset(tp)); | |
| 18 | 18 | if (dict == IntPtr.Zero) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -118,16 +118,11 @@ static ManagedDataOffsets() | |||
| 118 | 118 | size = fields.Length * IntPtr.Size; | |
| 119 | 119 | } | |
| 120 | 120 | ||
| 121 | - public static int GetSlotOffset(string name) | ||
| 122 | - { | ||
| 123 | - return NameMapping[name]; | ||
| 124 | - } | ||
| 125 | - | ||
| 126 | 121 | private static int BaseOffset(IntPtr type) | |
| 127 | 122 | { | |
| 128 | 123 | Debug.Assert(type != IntPtr.Zero); | |
| 129 | 124 | int typeSize = Marshal.ReadInt32(type, TypeOffset.tp_basicsize); | |
| 130 | - Debug.Assert(typeSize > 0); | ||
| 125 | + Debug.Assert(typeSize > 0 && typeSize <= ExceptionOffset.Size()); | ||
| 131 | 126 | return typeSize; | |
| 132 | 127 | } | |
| 133 | 128 | public static int DataOffset(IntPtr type) | |
@@ -358,38 +353,39 @@ public static void FreeModuleDef(IntPtr ptr) | |||
| 358 | 353 | /// Note that the two values reserved for stackless have been put | |
| 359 | 354 | /// to good use as PythonNet specific flags (Managed and Subclass) | |
| 360 | 355 | /// </summary> | |
| 361 | - internal class TypeFlags | ||
| 356 | + [Flags] | ||
| 357 | + internal enum TypeFlags | ||
| 362 | 358 | { | |
| 363 | - public const int HeapType = (1 << 9); | ||
| 364 | - public const int BaseType = (1 << 10); | ||
| 365 | - public const int Ready = (1 << 12); | ||
| 366 | - public const int Readying = (1 << 13); | ||
| 367 | - public const int HaveGC = (1 << 14); | ||
| 359 | + HeapType = (1 << 9), | ||
| 360 | + BaseType = (1 << 10), | ||
| 361 | + Ready = (1 << 12), | ||
| 362 | + Readying = (1 << 13), | ||
| 363 | + HaveGC = (1 << 14), | ||
| 368 | 364 | // 15 and 16 are reserved for stackless | |
| 369 | - public const int HaveStacklessExtension = 0; | ||
| 365 | + HaveStacklessExtension = 0, | ||
| 370 | 366 | /* XXX Reusing reserved constants */ | |
| 371 | - public const int Managed = (1 << 15); // PythonNet specific | ||
| 372 | - public const int Subclass = (1 << 16); // PythonNet specific | ||
| 373 | - public const int HaveIndex = (1 << 17); | ||
| 367 | + Managed = (1 << 15), // PythonNet specific | ||
| 368 | + Subclass = (1 << 16), // PythonNet specific | ||
| 369 | + HaveIndex = (1 << 17), | ||
| 374 | 370 | /* Objects support nb_index in PyNumberMethods */ | |
| 375 | - public const int HaveVersionTag = (1 << 18); | ||
| 376 | - public const int ValidVersionTag = (1 << 19); | ||
| 377 | - public const int IsAbstract = (1 << 20); | ||
| 378 | - public const int HaveNewBuffer = (1 << 21); | ||
| 371 | + HaveVersionTag = (1 << 18), | ||
| 372 | + ValidVersionTag = (1 << 19), | ||
| 373 | + IsAbstract = (1 << 20), | ||
| 374 | + HaveNewBuffer = (1 << 21), | ||
| 379 | 375 | // TODO: Implement FastSubclass functions | |
| 380 | - public const int IntSubclass = (1 << 23); | ||
| 381 | - public const int LongSubclass = (1 << 24); | ||
| 382 | - public const int ListSubclass = (1 << 25); | ||
| 383 | - public const int TupleSubclass = (1 << 26); | ||
| 384 | - public const int StringSubclass = (1 << 27); | ||
| 385 | - public const int UnicodeSubclass = (1 << 28); | ||
| 386 | - public const int DictSubclass = (1 << 29); | ||
| 387 | - public const int BaseExceptionSubclass = (1 << 30); | ||
| 388 | - public const int TypeSubclass = (1 << 31); | ||
| 389 | - | ||
| 390 | - public const int Default = ( | ||
| 376 | + IntSubclass = (1 << 23), | ||
| 377 | + LongSubclass = (1 << 24), | ||
| 378 | + ListSubclass = (1 << 25), | ||
| 379 | + TupleSubclass = (1 << 26), | ||
| 380 | + StringSubclass = (1 << 27), | ||
| 381 | + UnicodeSubclass = (1 << 28), | ||
| 382 | + DictSubclass = (1 << 29), | ||
| 383 | + BaseExceptionSubclass = (1 << 30), | ||
| 384 | + TypeSubclass = (1 << 31), | ||
| 385 | + | ||
| 386 | + Default = ( | ||
| 391 | 387 | HaveStacklessExtension | | |
| 392 | - HaveVersionTag); | ||
| 388 | + HaveVersionTag) | ||
| 393 | 389 | } | |
| 394 | 390 | ||
| 395 | 391 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,7 +29,7 @@ internal static ManagedType GetManagedObject(IntPtr ob) | |||
| 29 | 29 | } | |
| 30 | 30 | ||
| 31 | 31 | var flags = Util.ReadCLong(tp, TypeOffset.tp_flags); | |
| 32 | - if ((flags & TypeFlags.Managed) != 0) | ||
| 32 | + if ((flags & (int)TypeFlags.Managed) != 0) | ||
| 33 | 33 | { | |
| 34 | 34 | IntPtr op = tp == ob | |
| 35 | 35 | ? Marshal.ReadIntPtr(tp, TypeOffset.magic()) | |
@@ -68,7 +68,7 @@ internal static bool IsManagedType(IntPtr ob) | |||
| 68 | 68 | } | |
| 69 | 69 | ||
| 70 | 70 | var flags = Util.ReadCLong(tp, TypeOffset.tp_flags); | |
| 71 | - if ((flags & TypeFlags.Managed) != 0) | ||
| 71 | + if ((flags & (int)TypeFlags.Managed) != 0) | ||
| 72 | 72 | { | |
| 73 | 73 | return true; | |
| 74 | 74 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -99,13 +99,13 @@ public static IntPtr tp_new(IntPtr tp, IntPtr args, IntPtr kw) | |||
| 99 | 99 | return IntPtr.Zero; | |
| 100 | 100 | } | |
| 101 | 101 | ||
| 102 | - int flags = TypeFlags.Default; | ||
| 102 | + TypeFlags flags = TypeFlags.Default; | ||
| 103 | 103 | flags |= TypeFlags.Managed; | |
| 104 | 104 | flags |= TypeFlags.HeapType; | |
| 105 | 105 | flags |= TypeFlags.BaseType; | |
| 106 | 106 | flags |= TypeFlags.Subclass; | |
| 107 | 107 | flags |= TypeFlags.HaveGC; | |
| 108 | - Util.WriteCLong(type, TypeOffset.tp_flags, flags); | ||
| 108 | + Util.WriteCLong(type, TypeOffset.tp_flags, (int)flags); | ||
| 109 | 109 | ||
| 110 | 110 | TypeManager.CopySlot(base_type, type, TypeOffset.tp_dealloc); | |
| 111 | 111 | ||
@@ -238,7 +238,7 @@ public static void tp_dealloc(IntPtr tp) | |||
| 238 | 238 | // Fix this when we dont cheat on the handle for subclasses! | |
| 239 | 239 | ||
| 240 | 240 | var flags = Util.ReadCLong(tp, TypeOffset.tp_flags); | |
| 241 | - if ((flags & TypeFlags.Subclass) == 0) | ||
| 241 | + if ((flags & (int)TypeFlags.Subclass) == 0) | ||
| 242 | 242 | { | |
| 243 | 243 | IntPtr gc = Marshal.ReadIntPtr(tp, TypeOffset.magic()); | |
| 244 | 244 | ((GCHandle)gc).Free(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -92,9 +92,9 @@ internal static IntPtr CreateType(Type impl) | |||
| 92 | 92 | ||
| 93 | 93 | InitializeSlots(type, impl); | |
| 94 | 94 | ||
| 95 | - int flags = TypeFlags.Default | TypeFlags.Managed | | ||
| 95 | + TypeFlags flags = TypeFlags.Default | TypeFlags.Managed | | ||
| 96 | 96 | TypeFlags.HeapType | TypeFlags.HaveGC; | |
| 97 | - Util.WriteCLong(type, TypeOffset.tp_flags, flags); | ||
| 97 | + Util.WriteCLong(type, TypeOffset.tp_flags, (int)flags); | ||
| 98 | 98 | ||
| 99 | 99 | Runtime.PyType_Ready(type); | |
| 100 | 100 | ||
@@ -170,12 +170,12 @@ internal static IntPtr CreateType(ManagedType impl, Type clrType) | |||
| 170 | 170 | Runtime.XIncref(base_); | |
| 171 | 171 | } | |
| 172 | 172 | ||
| 173 | - int flags = TypeFlags.Default; | ||
| 173 | + TypeFlags flags = TypeFlags.Default; | ||
| 174 | 174 | flags |= TypeFlags.Managed; | |
| 175 | 175 | flags |= TypeFlags.HeapType; | |
| 176 | 176 | flags |= TypeFlags.BaseType; | |
| 177 | 177 | flags |= TypeFlags.HaveGC; | |
| 178 | - Util.WriteCLong(type, TypeOffset.tp_flags, flags); | ||
| 178 | + Util.WriteCLong(type, TypeOffset.tp_flags, (int)flags); | ||
| 179 | 179 | ||
| 180 | 180 | // Leverage followup initialization from the Python runtime. Note | |
| 181 | 181 | // that the type of the new type must PyType_Type at the time we | |
@@ -342,11 +342,11 @@ internal static IntPtr CreateMetaType(Type impl) | |||
| 342 | 342 | ||
| 343 | 343 | InitializeSlots(type, impl); | |
| 344 | 344 | ||
| 345 | - int flags = TypeFlags.Default; | ||
| 345 | + TypeFlags flags = TypeFlags.Default; | ||
| 346 | 346 | flags |= TypeFlags.Managed; | |
| 347 | 347 | flags |= TypeFlags.HeapType; | |
| 348 | 348 | flags |= TypeFlags.HaveGC; | |
| 349 | - Util.WriteCLong(type, TypeOffset.tp_flags, flags); | ||
| 349 | + Util.WriteCLong(type, TypeOffset.tp_flags, (int)flags); | ||
| 350 | 350 | ||
| 351 | 351 | // We need space for 3 PyMethodDef structs, each of them | |
| 352 | 352 | // 4 int-ptrs in size. | |
@@ -401,11 +401,11 @@ internal static IntPtr BasicSubType(string name, IntPtr base_, Type impl) | |||
| 401 | 401 | Marshal.WriteIntPtr(type, TypeOffset.tp_base, base_); | |
| 402 | 402 | Runtime.XIncref(base_); | |
| 403 | 403 | ||
| 404 | - int flags = TypeFlags.Default; | ||
| 404 | + TypeFlags flags = TypeFlags.Default; | ||
| 405 | 405 | flags |= TypeFlags.Managed; | |
| 406 | 406 | flags |= TypeFlags.HeapType; | |
| 407 | 407 | flags |= TypeFlags.HaveGC; | |
| 408 | - Util.WriteCLong(type, TypeOffset.tp_flags, flags); | ||
| 408 | + Util.WriteCLong(type, TypeOffset.tp_flags, (int)flags); | ||
| 409 | 409 | ||
| 410 | 410 | CopySlot(base_, type, TypeOffset.tp_traverse); | |
| 411 | 411 | CopySlot(base_, type, TypeOffset.tp_clear); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments