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

Commit61536f3

Browse files
committed
Use explicit accessors
1 parentd1241f8 commit61536f3

26 files changed

+87
-85
lines changed

‎src/console/pythonconsole.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
usingSystem;
22
usingSystem.Collections.Generic;
3+
usingSystem.IO;
34
usingSystem.Reflection;
45
usingPython.Runtime;
56

@@ -40,7 +41,7 @@ public static int Main(string[] args)
4041
// (Python.Runtime.dll is included as a resource)
4142
privatesealedclassAssemblyLoader
4243
{
43-
Dictionary<string,Assembly>loadedAssemblies;
44+
privateDictionary<string,Assembly>loadedAssemblies;
4445

4546
publicAssemblyLoader()
4647
{
@@ -57,7 +58,7 @@ public AssemblyLoader()
5758
}
5859

5960
// looks for the assembly from the resources and load it
60-
using(varstream=Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
61+
using(Streamstream=Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
6162
{
6263
if(stream!=null)
6364
{

‎src/embed_tests/pylong.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public void TearDown()
2727
publicvoidTestToInt64()
2828
{
2929
longlargeNumber=8L*1024L*1024L*1024L;// 8 GB
30-
PyLongpyLargeNumber=newPyLong(largeNumber);
30+
varpyLargeNumber=newPyLong(largeNumber);
3131
Assert.AreEqual(largeNumber,pyLargeNumber.ToInt64());
3232
}
3333
}

‎src/runtime/assemblymanager.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ internal class AssemblyManager
1717
{
1818
// modified from event handlers below, potentially triggered from different .NET threads
1919
// therefore this should be a ConcurrentDictionary
20-
staticConcurrentDictionary<string,ConcurrentDictionary<Assembly,string>>namespaces;
21-
//static Dictionary<string, Dictionary<string, string>> generics;
22-
staticAssemblyLoadEventHandlerlhandler;
23-
staticResolveEventHandlerrhandler;
20+
privatestaticConcurrentDictionary<string,ConcurrentDictionary<Assembly,string>>namespaces;
21+
//privatestatic Dictionary<string, Dictionary<string, string>> generics;
22+
privatestaticAssemblyLoadEventHandlerlhandler;
23+
privatestaticResolveEventHandlerrhandler;
2424

2525
// updated only under GIL?
26-
staticDictionary<string,int>probed;
26+
privatestaticDictionary<string,int>probed;
2727

2828
// modified from event handlers below, potentially triggered from different .NET threads
29-
staticAssemblyListassemblies;
29+
privatestaticAssemblyListassemblies;
3030
internalstaticList<string>pypath;
3131

3232
privateAssemblyManager()

‎src/runtime/classmanager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ namespace Python.Runtime
1717
/// </summary>
1818
internalclassClassManager
1919
{
20-
staticDictionary<Type,ClassBase>cache;
21-
staticTypedtype;
20+
privatestaticDictionary<Type,ClassBase>cache;
21+
privatestaticTypedtype;
2222

2323
privateClassManager()
2424
{

‎src/runtime/codegenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ namespace Python.Runtime
1313
/// </summary>
1414
internalclassCodeGenerator
1515
{
16-
AssemblyBuilderaBuilder;
17-
ModuleBuildermBuilder;
16+
privateAssemblyBuilderaBuilder;
17+
privateModuleBuildermBuilder;
1818

1919
internalCodeGenerator()
2020
{

‎src/runtime/constructorbinding.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ namespace Python.Runtime
2121
/// </remarks>
2222
internalclassConstructorBinding:ExtensionType
2323
{
24-
Typetype;// The managed Type being wrapped in a ClassObject
25-
IntPtrpyTypeHndl;// The python type tells GetInstHandle which Type to create.
26-
ConstructorBinderctorBinder;
27-
IntPtrrepr;
24+
privateTypetype;// The managed Type being wrapped in a ClassObject
25+
privateIntPtrpyTypeHndl;// The python type tells GetInstHandle which Type to create.
26+
privateConstructorBinderctorBinder;
27+
privateIntPtrrepr;
2828

2929
publicConstructorBinding(Typetype,IntPtrpyTypeHndl,ConstructorBinderctorBinder)
3030
{
@@ -165,11 +165,11 @@ public static IntPtr tp_repr(IntPtr ob)
165165
/// </remarks>
166166
internalclassBoundContructor:ExtensionType
167167
{
168-
Typetype;// The managed Type being wrapped in a ClassObject
169-
IntPtrpyTypeHndl;// The python type tells GetInstHandle which Type to create.
170-
ConstructorBinderctorBinder;
171-
ConstructorInfoctorInfo;
172-
IntPtrrepr;
168+
privateTypetype;// The managed Type being wrapped in a ClassObject
169+
privateIntPtrpyTypeHndl;// The python type tells GetInstHandle which Type to create.
170+
privateConstructorBinderctorBinder;
171+
privateConstructorInfoctorInfo;
172+
privateIntPtrrepr;
173173

174174
publicBoundContructor(Typetype,IntPtrpyTypeHndl,ConstructorBinderctorBinder,ConstructorInfoci)
175175
{

‎src/runtime/converter.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ private Converter()
1717
{
1818
}
1919

20-
staticNumberFormatInfonfi;
21-
staticTypeobjectType;
22-
staticTypestringType;
23-
staticTypesingleType;
24-
staticTypedoubleType;
25-
staticTypedecimalType;
26-
staticTypeint16Type;
27-
staticTypeint32Type;
28-
staticTypeint64Type;
29-
staticTypeflagsType;
30-
staticTypeboolType;
31-
staticTypetypeType;
20+
privatestaticNumberFormatInfonfi;
21+
privatestaticTypeobjectType;
22+
privatestaticTypestringType;
23+
privatestaticTypesingleType;
24+
privatestaticTypedoubleType;
25+
privatestaticTypedecimalType;
26+
privatestaticTypeint16Type;
27+
privatestaticTypeint32Type;
28+
privatestaticTypeint64Type;
29+
privatestaticTypeflagsType;
30+
privatestaticTypeboolType;
31+
privatestaticTypetypeType;
3232

3333
staticConverter()
3434
{
@@ -415,7 +415,7 @@ internal static bool ToManagedValue(IntPtr value, Type obType,
415415
/// <summary>
416416
/// Convert a Python value to an instance of a primitive managed type.
417417
/// </summary>
418-
staticboolToPrimitive(IntPtrvalue,TypeobType,outObjectresult,boolsetError)
418+
privatestaticboolToPrimitive(IntPtrvalue,TypeobType,outobjectresult,boolsetError)
419419
{
420420
IntPtroverflow=Exceptions.OverflowError;
421421
TypeCodetc=Type.GetTypeCode(obType);
@@ -826,7 +826,7 @@ static void SetConversionError(IntPtr value, Type target)
826826
/// The Python value must support the Python sequence protocol and the
827827
/// items in the sequence must be convertible to the target array type.
828828
/// </summary>
829-
staticboolToArray(IntPtrvalue,TypeobType,outObjectresult,boolsetError)
829+
privatestaticboolToArray(IntPtrvalue,TypeobType,outobjectresult,boolsetError)
830830
{
831831
TypeelementType=obType.GetElementType();
832832
intsize=Runtime.PySequence_Size(value);
@@ -875,7 +875,7 @@ static bool ToArray(IntPtr value, Type obType, out Object result, bool setError)
875875
/// <summary>
876876
/// Convert a Python value to a correctly typed managed enum instance.
877877
/// </summary>
878-
staticboolToEnum(IntPtrvalue,TypeobType,outObjectresult,boolsetError)
878+
privatestaticboolToEnum(IntPtrvalue,TypeobType,outobjectresult,boolsetError)
879879
{
880880
Typeetype=Enum.GetUnderlyingType(obType);
881881
result=null;

‎src/runtime/delegatemanager.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ namespace Python.Runtime
1111
/// </summary>
1212
internalclassDelegateManager
1313
{
14-
Hashtablecache;
15-
Typebasetype;
16-
Typelisttype;
17-
Typevoidtype;
18-
Typetypetype;
19-
Typeptrtype;
20-
CodeGeneratorcodeGenerator;
14+
privateHashtablecache;
15+
privateTypebasetype;
16+
privateTypelisttype;
17+
privateTypevoidtype;
18+
privateTypetypetype;
19+
privateTypeptrtype;
20+
privateCodeGeneratorcodeGenerator;
2121

2222
publicDelegateManager()
2323
{
@@ -180,6 +180,7 @@ A possible alternate strategy would be to create custom subclasses
180180
This would be slightly cleaner, but I'm not sure if delegates are
181181
too "special" for this to work. It would be more work, so for now
182182
the 80/20 rule applies :) */
183+
183184
publicclassDispatcher
184185
{
185186
publicIntPtrtarget;

‎src/runtime/delegateobject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Python.Runtime
1010
/// </summary>
1111
internalclassDelegateObject:ClassBase
1212
{
13-
MethodBinderbinder;
13+
privateMethodBinderbinder;
1414

1515
internalDelegateObject(Typetp):base(tp)
1616
{

‎src/runtime/eventbinding.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ namespace Python.Runtime
77
/// </summary>
88
internalclassEventBinding:ExtensionType
99
{
10-
EventObjecte;
11-
IntPtrtarget;
10+
privateEventObjecte;
11+
privateIntPtrtarget;
1212

1313
publicEventBinding(EventObjecte,IntPtrtarget)
1414
{

‎src/runtime/exceptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ internal static void SetArgsAndCause(IntPtr ob)
171171
/// Shortcut for (pointer == NULL) -&gt; throw PythonException
172172
/// </summary>
173173
/// <param name="pointer">Pointer to a Python object</param>
174-
internalunsafestaticvoidErrorCheck(IntPtrpointer)
174+
internalstaticunsafevoidErrorCheck(IntPtrpointer)
175175
{
176176
if(pointer==IntPtr.Zero)
177177
{
@@ -182,7 +182,7 @@ internal unsafe static void ErrorCheck(IntPtr pointer)
182182
/// <summary>
183183
/// Shortcut for (pointer == NULL or ErrorOccurred()) -&gt; throw PythonException
184184
/// </summary>
185-
internalunsafestaticvoidErrorOccurredCheck(IntPtrpointer)
185+
internalstaticunsafevoidErrorOccurredCheck(IntPtrpointer)
186186
{
187187
if(pointer==IntPtr.Zero||ErrorOccurred())
188188
{

‎src/runtime/fieldobject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Python.Runtime
88
/// </summary>
99
internalclassFieldObject:ExtensionType
1010
{
11-
FieldInfoinfo;
11+
privateFieldInfoinfo;
1212

1313
publicFieldObject(FieldInfoinfo)
1414
{

‎src/runtime/genericutil.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Python.Runtime
99
/// </summary>
1010
internalclassGenericUtil
1111
{
12-
staticDictionary<string,Dictionary<string,List<string>>>mapping;
12+
privatestaticDictionary<string,Dictionary<string,List<string>>>mapping;
1313

1414
privateGenericUtil()
1515
{

‎src/runtime/importhook.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ namespace Python.Runtime
88
/// </summary>
99
internalclassImportHook
1010
{
11-
staticIntPtrpy_import;
12-
staticCLRModuleroot;
13-
staticMethodWrapperhook;
14-
staticIntPtrpy_clr_module;
11+
privatestaticIntPtrpy_import;
12+
privatestaticCLRModuleroot;
13+
privatestaticMethodWrapperhook;
14+
privatestaticIntPtrpy_clr_module;
1515

1616
#ifPYTHON3
17-
staticIntPtrmodule_def=IntPtr.Zero;
17+
privatestaticIntPtrmodule_def=IntPtr.Zero;
1818

1919
internalstaticvoidInitializeModuleDef()
2020
{
@@ -36,8 +36,8 @@ internal static void Initialize()
3636
// modules (Python doesn't provide a way to emulate packages).
3737
IntPtrdict=Runtime.PyImport_GetModuleDict();
3838

39-
IntPtrmod=Runtime.IsPython3
40-
?Runtime.PyImport_ImportModule("builtins")
39+
IntPtrmod=Runtime.IsPython3
40+
?Runtime.PyImport_ImportModule("builtins")
4141
:Runtime.PyDict_GetItemString(dict,"__builtin__");
4242

4343
py_import=Runtime.PyObject_GetAttrString(mod,"__import__");

‎src/runtime/interfaceobject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ internal InterfaceObject(Type tp) : base(tp)
2323
}
2424
}
2525

26-
staticTypecc_attr;
26+
privatestaticTypecc_attr;
2727

2828
staticInterfaceObject()
2929
{

‎src/runtime/interop.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,8 @@ internal class TypeFlags
334334

335335
internalclassInterop
336336
{
337-
staticArrayListkeepAlive;
338-
staticHashtablepmap;
337+
privatestaticArrayListkeepAlive;
338+
privatestaticHashtablepmap;
339339

340340
staticInterop()
341341
{

‎src/runtime/iterator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Python.Runtime
99
/// </summary>
1010
internalclassIterator:ExtensionType
1111
{
12-
IEnumeratoriter;
12+
privateIEnumeratoriter;
1313

1414
publicIterator(IEnumeratore)
1515
{

‎src/runtime/metatype.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Python.Runtime
1010
/// </summary>
1111
internalclassMetaType:ManagedType
1212
{
13-
staticIntPtrPyCLRMetaType;
13+
privatestaticIntPtrPyCLRMetaType;
1414

1515

1616
/// <summary>
@@ -266,7 +266,7 @@ public static void tp_dealloc(IntPtr tp)
266266
NativeCall.Void_Call_1(op,tp);
267267
}
268268

269-
staticIntPtrDoInstanceCheck(IntPtrtp,IntPtrargs,boolcheckType)
269+
privatestaticIntPtrDoInstanceCheck(IntPtrtp,IntPtrargs,boolcheckType)
270270
{
271271
varcb=GetManagedObject(tp)asClassBase;
272272

‎src/runtime/moduleobject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Python.Runtime
1111
/// </summary>
1212
internalclassModuleObject:ExtensionType
1313
{
14-
Dictionary<string,ManagedType>cache;
14+
privateDictionary<string,ManagedType>cache;
1515
internalstringmoduleName;
1616
internalIntPtrdict;
1717
protectedstring_namespace;

‎src/runtime/nativecall.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ namespace Python.Runtime
2323
/// </summary>
2424
internalclassNativeCall
2525
{
26-
staticAssemblyBuilderaBuilder;
27-
staticModuleBuildermBuilder;
26+
privatestaticAssemblyBuilderaBuilder;
27+
privatestaticModuleBuildermBuilder;
2828

2929
publicstaticINativeCallImpl;
3030

‎src/runtime/overload.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ namespace Python.Runtime
99
/// </summary>
1010
internalclassOverloadMapper:ExtensionType
1111
{
12-
MethodObjectm;
13-
IntPtrtarget;
12+
privateMethodObjectm;
13+
privateIntPtrtarget;
1414

1515
publicOverloadMapper(MethodObjectm,IntPtrtarget)
1616
{

‎src/runtime/propertyobject.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ namespace Python.Runtime
99
/// </summary>
1010
internalclassPropertyObject:ExtensionType
1111
{
12-
PropertyInfoinfo;
13-
MethodInfogetter;
14-
MethodInfosetter;
12+
privatePropertyInfoinfo;
13+
privateMethodInfogetter;
14+
privateMethodInfosetter;
1515

1616
[StrongNameIdentityPermission(SecurityAction.Assert)]
1717
publicPropertyObject(PropertyInfomd)

‎src/runtime/runtime.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespacePython.Runtime
77
{
88
[SuppressUnmanagedCodeSecurity]
9-
staticclassNativeMethods
9+
internalstaticclassNativeMethods
1010
{
1111
#ifMONO_LINUX||MONO_OSX
1212
privatestaticintRTLD_NOW=0x2;

‎src/runtime/typemanager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ namespace Python.Runtime
1212
/// </summary>
1313
internalclassTypeManager
1414
{
15-
staticBindingFlagstbFlags;
16-
staticDictionary<Type,IntPtr>cache;
15+
privatestaticBindingFlagstbFlags;
16+
privatestaticDictionary<Type,IntPtr>cache;
1717

1818
staticTypeManager()
1919
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp