Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfc8cdb7

Browse files
committed
fixes
1 parent87c05b8 commitfc8cdb7

File tree

7 files changed

+390
-455
lines changed

7 files changed

+390
-455
lines changed

‎pythonnet.15.sln

Lines changed: 347 additions & 398 deletions
Large diffs are not rendered by default.

‎setup.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
# Allow config/verbosity to be set from cli
2727
# http://stackoverflow.com/a/4792601/5208670
28-
CONFIG="Release"# Release or Debug
28+
CONFIG="Debug"# Release or Debug
2929
VERBOSITY="normal"# quiet, minimal, normal, detailed, diagnostic
3030

3131
is_64bits=sys.maxsize>2**32
@@ -356,16 +356,6 @@ def build_extension(self, ext):
356356
),
357357
shell=use_shell,
358358
)
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-
)
369359
ifDEVTOOLS=="Mono"orDEVTOOLS=="dotnet":
370360
self._build_monoclr()
371361

‎src/runtime/clrobject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ internal CLRObject(object ob, IntPtr tp)
1212
IntPtrpy=Runtime.PyType_GenericAlloc(tp,0);
1313

1414
longflags=Util.ReadCLong(tp,TypeOffset.tp_flags);
15-
if((flags&TypeFlags.Subclass)!=0)
15+
if((flags&(int)TypeFlags.Subclass)!=0)
1616
{
1717
IntPtrdict=Marshal.ReadIntPtr(py,ObjectOffset.TypeDictOffset(tp));
1818
if(dict==IntPtr.Zero)

‎src/runtime/interop.cs

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,11 @@ static ManagedDataOffsets()
118118
size=fields.Length*IntPtr.Size;
119119
}
120120

121-
publicstaticintGetSlotOffset(stringname)
122-
{
123-
returnNameMapping[name];
124-
}
125-
126121
privatestaticintBaseOffset(IntPtrtype)
127122
{
128123
Debug.Assert(type!=IntPtr.Zero);
129124
inttypeSize=Marshal.ReadInt32(type,TypeOffset.tp_basicsize);
130-
Debug.Assert(typeSize>0);
125+
Debug.Assert(typeSize>0&&typeSize<=ExceptionOffset.Size());
131126
returntypeSize;
132127
}
133128
publicstaticintDataOffset(IntPtrtype)
@@ -358,38 +353,39 @@ public static void FreeModuleDef(IntPtr ptr)
358353
/// Note that the two values reserved for stackless have been put
359354
/// to good use as PythonNet specific flags (Managed and Subclass)
360355
/// </summary>
361-
internalclassTypeFlags
356+
[Flags]
357+
internalenumTypeFlags
362358
{
363-
publicconstintHeapType=(1<<9);
364-
publicconstintBaseType=(1<<10);
365-
publicconstintReady=(1<<12);
366-
publicconstintReadying=(1<<13);
367-
publicconstintHaveGC=(1<<14);
359+
HeapType=(1<<9),
360+
BaseType=(1<<10),
361+
Ready=(1<<12),
362+
Readying=(1<<13),
363+
HaveGC=(1<<14),
368364
// 15 and 16 are reserved for stackless
369-
publicconstintHaveStacklessExtension=0;
365+
HaveStacklessExtension=0,
370366
/* XXX Reusing reserved constants */
371-
publicconstintManaged=(1<<15);// PythonNet specific
372-
publicconstintSubclass=(1<<16);// PythonNet specific
373-
publicconstintHaveIndex=(1<<17);
367+
Managed=(1<<15),// PythonNet specific
368+
Subclass=(1<<16),// PythonNet specific
369+
HaveIndex=(1<<17),
374370
/* Objects support nb_index in PyNumberMethods */
375-
publicconstintHaveVersionTag=(1<<18);
376-
publicconstintValidVersionTag=(1<<19);
377-
publicconstintIsAbstract=(1<<20);
378-
publicconstintHaveNewBuffer=(1<<21);
371+
HaveVersionTag=(1<<18),
372+
ValidVersionTag=(1<<19),
373+
IsAbstract=(1<<20),
374+
HaveNewBuffer=(1<<21),
379375
// TODO: Implement FastSubclass functions
380-
publicconstintIntSubclass=(1<<23);
381-
publicconstintLongSubclass=(1<<24);
382-
publicconstintListSubclass=(1<<25);
383-
publicconstintTupleSubclass=(1<<26);
384-
publicconstintStringSubclass=(1<<27);
385-
publicconstintUnicodeSubclass=(1<<28);
386-
publicconstintDictSubclass=(1<<29);
387-
publicconstintBaseExceptionSubclass=(1<<30);
388-
publicconstintTypeSubclass=(1<<31);
389-
390-
publicconstintDefault=(
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=(
391387
HaveStacklessExtension|
392-
HaveVersionTag);
388+
HaveVersionTag)
393389
}
394390

395391

‎src/runtime/managedtype.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ internal static ManagedType GetManagedObject(IntPtr ob)
2929
}
3030

3131
varflags=Util.ReadCLong(tp,TypeOffset.tp_flags);
32-
if((flags&TypeFlags.Managed)!=0)
32+
if((flags&(int)TypeFlags.Managed)!=0)
3333
{
3434
IntPtrop=tp==ob
3535
?Marshal.ReadIntPtr(tp,TypeOffset.magic())
@@ -68,7 +68,7 @@ internal static bool IsManagedType(IntPtr ob)
6868
}
6969

7070
varflags=Util.ReadCLong(tp,TypeOffset.tp_flags);
71-
if((flags&TypeFlags.Managed)!=0)
71+
if((flags&(int)TypeFlags.Managed)!=0)
7272
{
7373
returntrue;
7474
}

‎src/runtime/metatype.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ public static IntPtr tp_new(IntPtr tp, IntPtr args, IntPtr kw)
9999
returnIntPtr.Zero;
100100
}
101101

102-
intflags=TypeFlags.Default;
102+
TypeFlagsflags=TypeFlags.Default;
103103
flags|=TypeFlags.Managed;
104104
flags|=TypeFlags.HeapType;
105105
flags|=TypeFlags.BaseType;
106106
flags|=TypeFlags.Subclass;
107107
flags|=TypeFlags.HaveGC;
108-
Util.WriteCLong(type,TypeOffset.tp_flags,flags);
108+
Util.WriteCLong(type,TypeOffset.tp_flags,(int)flags);
109109

110110
TypeManager.CopySlot(base_type,type,TypeOffset.tp_dealloc);
111111

@@ -238,7 +238,7 @@ public static void tp_dealloc(IntPtr tp)
238238
// Fix this when we dont cheat on the handle for subclasses!
239239

240240
varflags=Util.ReadCLong(tp,TypeOffset.tp_flags);
241-
if((flags&TypeFlags.Subclass)==0)
241+
if((flags&(int)TypeFlags.Subclass)==0)
242242
{
243243
IntPtrgc=Marshal.ReadIntPtr(tp,TypeOffset.magic());
244244
((GCHandle)gc).Free();

‎src/runtime/typemanager.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ internal static IntPtr CreateType(Type impl)
9292

9393
InitializeSlots(type,impl);
9494

95-
intflags=TypeFlags.Default|TypeFlags.Managed|
95+
TypeFlagsflags=TypeFlags.Default|TypeFlags.Managed|
9696
TypeFlags.HeapType|TypeFlags.HaveGC;
97-
Util.WriteCLong(type,TypeOffset.tp_flags,flags);
97+
Util.WriteCLong(type,TypeOffset.tp_flags,(int)flags);
9898

9999
Runtime.PyType_Ready(type);
100100

@@ -170,12 +170,12 @@ internal static IntPtr CreateType(ManagedType impl, Type clrType)
170170
Runtime.XIncref(base_);
171171
}
172172

173-
intflags=TypeFlags.Default;
173+
TypeFlagsflags=TypeFlags.Default;
174174
flags|=TypeFlags.Managed;
175175
flags|=TypeFlags.HeapType;
176176
flags|=TypeFlags.BaseType;
177177
flags|=TypeFlags.HaveGC;
178-
Util.WriteCLong(type,TypeOffset.tp_flags,flags);
178+
Util.WriteCLong(type,TypeOffset.tp_flags,(int)flags);
179179

180180
// Leverage followup initialization from the Python runtime. Note
181181
// that the type of the new type must PyType_Type at the time we
@@ -342,11 +342,11 @@ internal static IntPtr CreateMetaType(Type impl)
342342

343343
InitializeSlots(type,impl);
344344

345-
intflags=TypeFlags.Default;
345+
TypeFlagsflags=TypeFlags.Default;
346346
flags|=TypeFlags.Managed;
347347
flags|=TypeFlags.HeapType;
348348
flags|=TypeFlags.HaveGC;
349-
Util.WriteCLong(type,TypeOffset.tp_flags,flags);
349+
Util.WriteCLong(type,TypeOffset.tp_flags,(int)flags);
350350

351351
// We need space for 3 PyMethodDef structs, each of them
352352
// 4 int-ptrs in size.
@@ -401,11 +401,11 @@ internal static IntPtr BasicSubType(string name, IntPtr base_, Type impl)
401401
Marshal.WriteIntPtr(type,TypeOffset.tp_base,base_);
402402
Runtime.XIncref(base_);
403403

404-
intflags=TypeFlags.Default;
404+
TypeFlagsflags=TypeFlags.Default;
405405
flags|=TypeFlags.Managed;
406406
flags|=TypeFlags.HeapType;
407407
flags|=TypeFlags.HaveGC;
408-
Util.WriteCLong(type,TypeOffset.tp_flags,flags);
408+
Util.WriteCLong(type,TypeOffset.tp_flags,(int)flags);
409409

410410
CopySlot(base_,type,TypeOffset.tp_traverse);
411411
CopySlot(base_,type,TypeOffset.tp_clear);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp