Skip to content

Commit 2d2fe53

Browse files
author
dse
committed
Public constants replacement fixes.
1 parent 0240461 commit 2d2fe53

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/runtime/runtime.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public class Runtime
9595
/// </summary>
9696
private const string PyUnicodeEntryPoint = "PyUnicodeUCS4_";
9797
#elif UCS2
98-
public const int _UCS = 2;
98+
internal const int _UCS = 2;
9999

100100
/// <summary>
101101
/// EntryPoint to be used in DllImport to map to correct Unicode
@@ -110,33 +110,33 @@ public class Runtime
110110
// We needs to replace all public constants to static readonly fields to allow
111111
// binary substitution of different Python.Runtime.dll builds in a target application.
112112

113-
public const string pyversion = _pyversion;
114-
public const string pyver = _pyver;
113+
public readonly string pyversion = _pyversion;
114+
public readonly string pyver = _pyver;
115115

116116
#if PYTHON27
117117
internal const string _pyversion = "2.7";
118118
internal const string _pyver = "27";
119119
#elif PYTHON33
120-
public const string _pyversion = "3.3";
121-
public const string _pyver = "33";
120+
internal const string _pyversion = "3.3";
121+
internal const string _pyver = "33";
122122
#elif PYTHON34
123-
public const string _pyversion = "3.4";
124-
public const string _pyver = "34";
123+
internal const string _pyversion = "3.4";
124+
internal const string _pyver = "34";
125125
#elif PYTHON35
126-
public const string _pyversion = "3.5";
127-
public const string _pyver = "35";
126+
internal const string _pyversion = "3.5";
127+
internal const string _pyver = "35";
128128
#elif PYTHON36
129-
public const string _pyversion = "3.6";
130-
public const string _pyver = "36";
129+
internal const string _pyversion = "3.6";
130+
internal const string _pyver = "36";
131131
#elif PYTHON37 // TODO: Add `interop37.cs` after PY37 is released
132-
public const string _pyversion = "3.7";
133-
public const string _pyver = "37";
132+
internal const string _pyversion = "3.7";
133+
internal const string _pyver = "37";
134134
#else
135135
#error You must define one of PYTHON33 to PYTHON37 or PYTHON27
136136
#endif
137137

138138
#if MONO_LINUX || MONO_OSX // Linux/macOS use dotted version string
139-
internal const string dllBase = "python" + pyversion;
139+
internal const string dllBase = "python" + _pyversion;
140140
#else // Windows
141141
internal const string dllBase = "python" + _pyver;
142142
#endif
@@ -159,9 +159,9 @@ public class Runtime
159159
public static readonly string PythonDLL = _PythonDll;
160160

161161
#if PYTHON_WITHOUT_ENABLE_SHARED
162-
public const string _PythonDll = "__Internal";
162+
internal const string _PythonDll = "__Internal";
163163
#else
164-
public const string _PythonDll = dllBase + dllWithPyDebug + dllWithPyMalloc;
164+
internal const string _PythonDll = dllBase + dllWithPyDebug + dllWithPyMalloc;
165165
#endif
166166

167167
public static readonly int pyversionnumber = Convert.ToInt32(_pyver);
@@ -708,7 +708,7 @@ public static extern int Py_Main(
708708
[DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)]
709709
internal static extern IntPtr PyEval_EvalCode(IntPtr co, IntPtr globals, IntPtr locals);
710710

711-
[DllImport(PythonDll, CallingConvention = CallingConvention.Cdecl)]
711+
[DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)]
712712
internal static extern IntPtr Py_CompileString(string code, string file, IntPtr tok);
713713

714714
[DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)]
@@ -1224,7 +1224,7 @@ int size
12241224

12251225
internal static IntPtr PyUnicode_FromUnicode(string s, int size)
12261226
{
1227-
return PyUnicode_FromKindAndData(UCS, s, size);
1227+
return PyUnicode_FromKindAndData(_UCS, s, size);
12281228
}
12291229

12301230
[DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)]

0 commit comments

Comments
 (0)