Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
28a78ed
Bump version to 3.0.0-rc1
filmor Jun 27, 2022
e84731f
implemented dynamic equality and inequality for PyObject instances
lostmsu Jun 30, 2022
2edd800
Fix broken prefix and debug leftover
filmor Jun 28, 2022
4b6ac12
Bump release candidate version
filmor Jul 5, 2022
2016371
Make MANIFEST.in more explicit
filmor Jul 6, 2022
d484797
Use informational version as clr's __version__ attribute
filmor Jul 8, 2022
25f21f9
Drop obsolete packages.config
filmor Jul 11, 2022
332f8e7
Fix (U)IntPtr construction (#1861)
filmor Jul 11, 2022
60a719c
Implement non-simple String constructors explicitly (#1862)
filmor Jul 11, 2022
b79ae2f
Fix missing docstring for types with custom constructors (#1865)
filmor Jul 11, 2022
863397a
Bump release candidate version
filmor Jul 11, 2022
59b1c51
Finalizer.Instance.Collect() and Runtime.TryCollectingGarbage(...) ar…
lostmsu Jul 14, 2022
469ec67
fixed leak in NewReference.Move
lostmsu Jul 14, 2022
9bb8fe6
Merge pull request #1873 from losttech/bugs/ctor-leak
filmor Jul 14, 2022
93631af
Bump release candidate version
filmor Jul 16, 2022
a5e9b55
Generate XML documentation on build and add to it NuGet package (#1878)
lostmsu Jul 16, 2022
85d0ca6
mention the need for PythonEngine.Initialize and BeginAllowThreads in…
lostmsu Aug 4, 2022
5f63c67
BREAKING: disabled implicit conversion from Python objects implementi…
lostmsu Aug 8, 2022
0909021
Explicit float and int conversion for builtin types (#1904)
filmor Aug 12, 2022
bd48dc1
Fill nb_index slot for integer types (#1907)
filmor Aug 13, 2022
4241493
fixed use of the process handle after Process instance goes out of sc…
lostmsu Sep 16, 2022
bdf671e
fixed new line character at the end of informational version (#1941)
lostmsu Sep 16, 2022
3f12469
Bump clr-loader dependency to 0.2.3 and adjust interface
filmor Sep 16, 2022
db52dde
Improve error message if the runtime fails to load
filmor Sep 16, 2022
fd8fd3b
Fix manifest so we can build with python -m build
filmor Sep 17, 2022
91d3e55
reenabled test for https://github.com/pythonnet/pythonnet/issues/1256…
lostmsu Sep 17, 2022
43769f5
Merge pull request #1942 from filmor/configless-coreclr
filmor Sep 17, 2022
f1ef11d
Bump release candidate version
filmor Sep 18, 2022
a02799d
Fix implicit float conversion for classes that derive from float
filmor Sep 19, 2022
2194d6c
Drop PyLong_Check (which checked for exact type) in favour of PyInt_C…
filmor Sep 19, 2022
52cf03c
Merge pull request #1908 from filmor/implicit-float-int
filmor Sep 20, 2022
15a8b26
Bump release candidate version
filmor Sep 20, 2022
08fd638
Add initial documentation setup
filmor May 26, 2022
64ea044
Ensure build props always read the correct version file
filmor Sep 19, 2022
13f2a9c
Convert back to RST, add section on runtime loading
filmor Sep 26, 2022
42b122d
Publish documentation from the release branch for now
filmor Sep 26, 2022
cc2fdac
Adjust installation documentation
filmor Sep 26, 2022
80adda9
Merge pull request #1863 from filmor/docs
filmor Sep 26, 2022
3c4dd16
Update README
filmor Sep 26, 2022
33b107c
Move clr module to separate file
filmor Sep 26, 2022
6ec635d
Drop unused param doc
filmor Sep 26, 2022
aae9d56
Bump version to 3.0.0
filmor Sep 29, 2022
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
Fix missing docstring for types with custom constructors (#1865)
  • Loading branch information
filmor authored Jul 11, 2022
commit b79ae2f405ddb457c7449f81bb350209cc84d522
15 changes: 12 additions & 3 deletions src/runtime/ClassManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ internal static ClassManagerState SaveRuntimeData()
if ((Runtime.PyDict_DelItemString(dict.Borrow(), member) == -1) &&
(Exceptions.ExceptionMatches(Exceptions.KeyError)))
{
// Trying to remove a key that's not in the dictionary
// Trying to remove a key that's not in the dictionary
// raises an error. We don't care about it.
Runtime.PyErr_Clear();
}
Expand Down Expand Up @@ -215,7 +215,7 @@ internal static void InitClassBase(Type type, ClassBase impl, ReflectedClrType p
impl.indexer = info.indexer;
impl.richcompare.Clear();


// Finally, initialize the class __dict__ and return the object.
using var newDict = Runtime.PyObject_GenericGetDict(pyType.Reference);
BorrowedReference dict = newDict.Borrow();
Expand Down Expand Up @@ -271,6 +271,15 @@ internal static void InitClassBase(Type type, ClassBase impl, ReflectedClrType p
Runtime.PyDict_SetItem(dict, PyIdentifier.__doc__, doc.Borrow());
}
}

if (Runtime.PySequence_Contains(dict, PyIdentifier.__doc__) != 1)
{
// Ensure that at least some doc string is set
using var fallbackDoc = Runtime.PyString_FromString(
$"Python wrapper for .NET type {type}"
);
Runtime.PyDict_SetItem(dict, PyIdentifier.__doc__, fallbackDoc.Borrow());
}
}
doc.Dispose();

Expand Down Expand Up @@ -562,7 +571,7 @@ private static ClassInfo GetClassInfo(Type type, ClassBase impl)

return ci;
}

/// <summary>
/// This class owns references to PyObjects in the `members` member.
/// The caller has responsibility to DECREF them.
Expand Down
7 changes: 7 additions & 0 deletions tests/test_docstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,10 @@ def test_doc_without_ctor():
assert DocWithoutCtorTest.__doc__ == 'DocWithoutCtorTest Class'
assert DocWithoutCtorTest.TestMethod.__doc__ == 'DocWithoutCtorTest TestMethod'
assert DocWithoutCtorTest.StaticTestMethod.__doc__ == 'DocWithoutCtorTest StaticTestMethod'


def test_doc_primitve():
from System import Int64, String

assert Int64.__doc__ is not None
assert String.__doc__ is not None
5 changes: 2 additions & 3 deletions tests/test_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def test_enum_standard_attrs():
assert DayOfWeek.__name__ == 'DayOfWeek'
assert DayOfWeek.__module__ == 'System'
assert isinstance(DayOfWeek.__dict__, DictProxyType)
assert DayOfWeek.__doc__ is None


def test_enum_get_member():
Expand Down Expand Up @@ -139,7 +138,7 @@ def test_enum_undefined_value():
# This should fail because our test enum doesn't have it.
with pytest.raises(ValueError):
Test.FieldTest().EnumField = Test.ShortEnum(20)

# explicitly permit undefined values
Test.FieldTest().EnumField = Test.ShortEnum(20, True)

Expand All @@ -157,6 +156,6 @@ def test_enum_conversion():

with pytest.raises(TypeError):
Test.FieldTest().EnumField = "str"

with pytest.raises(TypeError):
Test.FieldTest().EnumField = 1