Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Implement __version__ on clr module
  • Loading branch information
vmuriart committed Jan 7, 2017
commit f74898c598e57470c6ce94131cabecc7fd5683f1
6 changes: 0 additions & 6 deletions src/runtime/moduleobject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -446,11 +446,5 @@ public static int _AtExit()
{
return Runtime.AtExit();
}

[ModuleFunctionAttribute()]
public static string Version()
{
return "2.2.0";
}
}
}
2 changes: 1 addition & 1 deletion src/runtime/pythonengine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public static void Initialize()
Runtime.PyDict_SetItemString(clr_dict, "_extras", module);
foreach (PyObject key in locals.Keys())
{
if (!key.ToString().StartsWith("_"))
if (!key.ToString().StartsWith("_") || key.ToString().Equals("__version__"))
{
PyObject value = locals[key];
Runtime.PyDict_SetItem(clr_dict, key.Handle, value.Handle);
Expand Down
4 changes: 3 additions & 1 deletion src/runtime/resources/clr.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"""
"""
Code in this module gets loaded into the main clr module.
"""

__version__ = "2.2.0"


class clrproperty(object):
"""
Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test000importClr(self):

def testVersionClr(self):
import clr
self.assertTrue(clr.Version() >= "2.2.0")
self.assertTrue(clr.__version__ >= "2.2.0")

def testPreloadVar(self):
import clr
Expand Down