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

Commitae3477d

Browse files
committed
disabled ability to register encoders forSystem.Type
Without this restriction encoders created in Python cause stack overflow due to repeated attempts to pass `System.Type` instance to `CanDecode`, which requires encoding the instance of `System.Type`, et. ceterafixes#1427
1 parentaedcb88 commitae3477d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

‎CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ One must now either use enum members (e.g. `MyEnum.Option`), or use enum constru
4444
- Sign Runtime DLL with a strong name
4545
- Implement loading through`clr_loader` instead of the included`ClrModule`, enables
4646
support for .NET Core
47+
- BREAKING: custom encoders are no longer called for instances of`System.Type`
4748

4849
###Fixed
4950

‎src/runtime/converter.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,11 @@ internal static IntPtr ToPython(object value, Type type)
146146
returnresult;
147147
}
148148

149-
if(Type.GetTypeCode(type)==TypeCode.Object&&value.GetType()!=typeof(object)
150-
||type.IsEnum){
149+
if(Type.GetTypeCode(type)==TypeCode.Object
150+
&&value.GetType()!=typeof(object)
151+
&&valueis notType
152+
||type.IsEnum
153+
){
151154
varencoded=PyObjectConversions.TryEncode(value,type);
152155
if(encoded!=null){
153156
result=encoded.Handle;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp