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
Next Next commit
Add Version to CLR module
Ideally we would implement `__version__` as a property, but this requires
`ModuleFunctionAttribute` to work.
Since version is being implemented as a function, using `Version()`
instead since __version__ is expected to be a property.
  • Loading branch information
vmuriart committed Jan 7, 2017
commit af469a5a55c3a2247c1b27639df24e05b6ca6349
6 changes: 6 additions & 0 deletions src/runtime/moduleobject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -446,5 +446,11 @@ public static int _AtExit()
{
return Runtime.AtExit();
}

[ModuleFunctionAttribute()]
public static string Version()
{
return "2.2.0";
}
}
}
4 changes: 4 additions & 0 deletions src/tests/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ def test000importClr(self):
import clr
self.assertTrue(self.isCLRRootModule(clr))

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

def testPreloadVar(self):
import clr
self.assertTrue(clr.getPreload() is False, clr.getPreload())
Expand Down