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

Commitd484797

Browse files
committed
Use informational version as clr's __version__ attribute
1 parent2016371 commitd484797

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

‎src/runtime/PythonEngine.cs‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ public static void Initialize(IEnumerable<string> args, bool setSysArgv = true,
228228
Assemblyassembly=Assembly.GetExecutingAssembly();
229229
// add the contents of clr.py to the module
230230
stringclr_py=assembly.ReadStringResource("clr.py");
231+
231232
Exec(clr_py,module_globals,locals.Reference);
232233

233234
LoadSubmodule(module_globals,"clr.interop","interop.py");
@@ -237,14 +238,22 @@ public static void Initialize(IEnumerable<string> args, bool setSysArgv = true,
237238
// add the imported module to the clr module, and copy the API functions
238239
// and decorators into the main clr module.
239240
Runtime.PyDict_SetItemString(clr_dict,"_extras",module);
241+
242+
// append version
243+
varversion=typeof(PythonEngine)
244+
.Assembly
245+
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
246+
.InformationalVersion;
247+
usingvarversionObj=Runtime.PyString_FromString(version);
248+
Runtime.PyDict_SetItemString(clr_dict,"__version__",versionObj.Borrow());
249+
240250
usingvarkeys=locals.Keys();
241251
foreach(PyObjectkeyinkeys)
242252
{
243-
if(!key.ToString()!.StartsWith("_")||key.ToString()!.Equals("__version__"))
253+
if(!key.ToString()!.StartsWith("_"))
244254
{
245-
PyObjectvalue=locals[key];
255+
usingPyObjectvalue=locals[key];
246256
Runtime.PyDict_SetItem(clr_dict,key.Reference,value.Reference);
247-
value.Dispose();
248257
}
249258
key.Dispose();
250259
}

‎src/runtime/Resources/clr.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
Code in this module gets loaded into the main clr module.
33
"""
44

5-
__version__="3.0.0dev"
6-
75

86
classclrproperty(object):
97
"""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp