diff --git a/python/gen/com/jetbrains/python/console/protocol/ArrayData.java b/python/gen/com/jetbrains/python/console/protocol/ArrayData.java index 62c90f30f837..e12dd02ea451 100644 --- a/python/gen/com/jetbrains/python/console/protocol/ArrayData.java +++ b/python/gen/com/jetbrains/python/console/protocol/ArrayData.java @@ -7,7 +7,7 @@ package com.jetbrains.python.console.protocol; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-04-23") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-06-03") public class ArrayData implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ArrayData"); diff --git a/python/gen/com/jetbrains/python/console/protocol/ArrayHeaders.java b/python/gen/com/jetbrains/python/console/protocol/ArrayHeaders.java index e92b3e675bb6..cce2c344fd29 100644 --- a/python/gen/com/jetbrains/python/console/protocol/ArrayHeaders.java +++ b/python/gen/com/jetbrains/python/console/protocol/ArrayHeaders.java @@ -7,7 +7,7 @@ package com.jetbrains.python.console.protocol; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-04-23") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-06-03") public class ArrayHeaders implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ArrayHeaders"); diff --git a/python/gen/com/jetbrains/python/console/protocol/ColHeader.java b/python/gen/com/jetbrains/python/console/protocol/ColHeader.java index 79bff2461fdf..3bf7571b97b2 100644 --- a/python/gen/com/jetbrains/python/console/protocol/ColHeader.java +++ b/python/gen/com/jetbrains/python/console/protocol/ColHeader.java @@ -7,7 +7,7 @@ package com.jetbrains.python.console.protocol; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-04-23") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-06-03") public class ColHeader implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ColHeader"); diff --git a/python/gen/com/jetbrains/python/console/protocol/CompletionOption.java b/python/gen/com/jetbrains/python/console/protocol/CompletionOption.java index 708840a4cc16..416ea3859745 100644 --- a/python/gen/com/jetbrains/python/console/protocol/CompletionOption.java +++ b/python/gen/com/jetbrains/python/console/protocol/CompletionOption.java @@ -7,7 +7,7 @@ package com.jetbrains.python.console.protocol; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-04-23") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-06-03") public class CompletionOption implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CompletionOption"); diff --git a/python/gen/com/jetbrains/python/console/protocol/CompletionOptionType.java b/python/gen/com/jetbrains/python/console/protocol/CompletionOptionType.java index fc6fd9a86fcb..a2fe2aee891f 100644 --- a/python/gen/com/jetbrains/python/console/protocol/CompletionOptionType.java +++ b/python/gen/com/jetbrains/python/console/protocol/CompletionOptionType.java @@ -10,7 +10,7 @@ package com.jetbrains.python.console.protocol; /** * Corresponds to completion types declared in "_pydev_bundle/_pydev_imports_tipper.py". */ -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-04-23") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-06-03") public enum CompletionOptionType implements org.apache.thrift.TEnum { IMPORT(0), CLASS(1), diff --git a/python/gen/com/jetbrains/python/console/protocol/DebugValue.java b/python/gen/com/jetbrains/python/console/protocol/DebugValue.java index 2e4676004db6..a6cde9b142cb 100644 --- a/python/gen/com/jetbrains/python/console/protocol/DebugValue.java +++ b/python/gen/com/jetbrains/python/console/protocol/DebugValue.java @@ -10,7 +10,7 @@ package com.jetbrains.python.console.protocol; * Corresponds to `PyDebugValue`. */ @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-04-23") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-06-03") public class DebugValue implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("DebugValue"); @@ -20,10 +20,11 @@ public class DebugValue implements org.apache.thrift.TBase byName = new java.util.HashMap(); @@ -78,13 +81,15 @@ public class DebugValue implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ExceedingArrayDimensionsException"); diff --git a/python/gen/com/jetbrains/python/console/protocol/GetArrayResponse.java b/python/gen/com/jetbrains/python/console/protocol/GetArrayResponse.java index fd88d0c31da7..542e14186722 100644 --- a/python/gen/com/jetbrains/python/console/protocol/GetArrayResponse.java +++ b/python/gen/com/jetbrains/python/console/protocol/GetArrayResponse.java @@ -11,7 +11,7 @@ package com.jetbrains.python.console.protocol; * */ @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-04-23") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-06-03") public class GetArrayResponse implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("GetArrayResponse"); diff --git a/python/gen/com/jetbrains/python/console/protocol/KeyboardInterruptException.java b/python/gen/com/jetbrains/python/console/protocol/KeyboardInterruptException.java index e49807040201..c904ddd4f366 100644 --- a/python/gen/com/jetbrains/python/console/protocol/KeyboardInterruptException.java +++ b/python/gen/com/jetbrains/python/console/protocol/KeyboardInterruptException.java @@ -7,7 +7,7 @@ package com.jetbrains.python.console.protocol; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-04-23") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-06-03") public class KeyboardInterruptException extends org.apache.thrift.TException implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("KeyboardInterruptException"); diff --git a/python/gen/com/jetbrains/python/console/protocol/PythonConsoleBackendService.java b/python/gen/com/jetbrains/python/console/protocol/PythonConsoleBackendService.java index 763a8c986651..ad9d84ce6c31 100644 --- a/python/gen/com/jetbrains/python/console/protocol/PythonConsoleBackendService.java +++ b/python/gen/com/jetbrains/python/console/protocol/PythonConsoleBackendService.java @@ -6,7 +6,7 @@ */ package com.jetbrains.python.console.protocol; -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-04-23") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-06-03") @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) public class PythonConsoleBackendService { diff --git a/python/gen/com/jetbrains/python/console/protocol/PythonConsoleFrontendService.java b/python/gen/com/jetbrains/python/console/protocol/PythonConsoleFrontendService.java index 6cc2123c36f6..b5e50ca26aff 100644 --- a/python/gen/com/jetbrains/python/console/protocol/PythonConsoleFrontendService.java +++ b/python/gen/com/jetbrains/python/console/protocol/PythonConsoleFrontendService.java @@ -6,7 +6,7 @@ */ package com.jetbrains.python.console.protocol; -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-04-23") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-06-03") @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) public class PythonConsoleFrontendService { diff --git a/python/gen/com/jetbrains/python/console/protocol/PythonTableException.java b/python/gen/com/jetbrains/python/console/protocol/PythonTableException.java index 3bdf5c58e72d..168bf9d03eb6 100644 --- a/python/gen/com/jetbrains/python/console/protocol/PythonTableException.java +++ b/python/gen/com/jetbrains/python/console/protocol/PythonTableException.java @@ -7,7 +7,7 @@ package com.jetbrains.python.console.protocol; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-04-23") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-06-03") public class PythonTableException extends org.apache.thrift.TException implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PythonTableException"); diff --git a/python/gen/com/jetbrains/python/console/protocol/PythonUnhandledException.java b/python/gen/com/jetbrains/python/console/protocol/PythonUnhandledException.java index de2ff3c28a05..fbb49224c4eb 100644 --- a/python/gen/com/jetbrains/python/console/protocol/PythonUnhandledException.java +++ b/python/gen/com/jetbrains/python/console/protocol/PythonUnhandledException.java @@ -7,7 +7,7 @@ package com.jetbrains.python.console.protocol; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-04-23") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-06-03") public class PythonUnhandledException extends org.apache.thrift.TException implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PythonUnhandledException"); diff --git a/python/gen/com/jetbrains/python/console/protocol/RowHeader.java b/python/gen/com/jetbrains/python/console/protocol/RowHeader.java index ae71d33fda40..75b745df5163 100644 --- a/python/gen/com/jetbrains/python/console/protocol/RowHeader.java +++ b/python/gen/com/jetbrains/python/console/protocol/RowHeader.java @@ -7,7 +7,7 @@ package com.jetbrains.python.console.protocol; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-04-23") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-06-03") public class RowHeader implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RowHeader"); diff --git a/python/gen/com/jetbrains/python/console/protocol/UnsupportedArrayTypeException.java b/python/gen/com/jetbrains/python/console/protocol/UnsupportedArrayTypeException.java index e483ab56a46a..4cae7b147d81 100644 --- a/python/gen/com/jetbrains/python/console/protocol/UnsupportedArrayTypeException.java +++ b/python/gen/com/jetbrains/python/console/protocol/UnsupportedArrayTypeException.java @@ -7,7 +7,7 @@ package com.jetbrains.python.console.protocol; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-04-23") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.20.0)", date = "2025-06-03") public class UnsupportedArrayTypeException extends org.apache.thrift.TException implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("UnsupportedArrayTypeException"); diff --git a/python/gen/com/jetbrains/python/console/protocol/package-info.java b/python/gen/com/jetbrains/python/console/protocol/package-info.java new file mode 100644 index 000000000000..d5edecd4239e --- /dev/null +++ b/python/gen/com/jetbrains/python/console/protocol/package-info.java @@ -0,0 +1,5 @@ +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +@Internal +package com.jetbrains.python.console.protocol; + +import org.jetbrains.annotations.ApiStatus.Internal; \ No newline at end of file diff --git a/python/helpers/pydev/_pydevd_bundle/pydevd_thrift.py b/python/helpers/pydev/_pydevd_bundle/pydevd_thrift.py index 138657df3b1f..57f607012c37 100644 --- a/python/helpers/pydev/_pydevd_bundle/pydevd_thrift.py +++ b/python/helpers/pydev/_pydevd_bundle/pydevd_thrift.py @@ -341,6 +341,14 @@ def var_to_struct(val, name, format='%s', do_trim=True, evaluate_full_value=True except: pass + # data type info to xml (for arrays and tensors) + debug_value.arrayElementType = '' + try: + if hasattr(v, 'dtype') and hasattr(v.dtype, 'name'): + debug_value.arrayElementType = v.dtype.name + except: + pass + # additional info to struct if is_exception_on_eval: debug_value.isErrorOnEval = True diff --git a/python/helpers/pydev/_pydevd_bundle/pydevd_xml.py b/python/helpers/pydev/_pydevd_bundle/pydevd_xml.py index cd05a357b816..4912e46d8448 100644 --- a/python/helpers/pydev/_pydevd_bundle/pydevd_xml.py +++ b/python/helpers/pydev/_pydevd_bundle/pydevd_xml.py @@ -353,6 +353,15 @@ def var_to_xml(val, name, do_trim=True, additional_in_xml='', evaluate_full_valu except: pass + # data type info to xml (for arrays and tensors) + # we use it for view as image + xml_data_type = '' + try: + if hasattr(v, 'dtype') and hasattr(v.dtype, 'name'): + xml_data_type = ' arrayElementType="%s"' % make_valid_xml_value(v.dtype.name) + except: + pass + # additional info to xml if is_exception_on_eval: xml_container = ' isErrorOnEval="True"' @@ -362,7 +371,7 @@ def var_to_xml(val, name, do_trim=True, additional_in_xml='', evaluate_full_valu else: xml_container = '' - return ''.join((xml, xml_qualifier, xml_value, xml_container, xml_shape, xml_type_renderer_id, additional_in_xml, ' />\n')) + return ''.join((xml, xml_qualifier, xml_value, xml_container, xml_shape, xml_data_type, xml_type_renderer_id, additional_in_xml, ' />\n')) def _do_quote(elem): diff --git a/python/helpers/pydev/_pydevd_bundle/tables/images/pydevd_numpy_based_image.py b/python/helpers/pydev/_pydevd_bundle/tables/images/pydevd_numpy_based_image.py index ad5a50f192a8..bb75df8a1ae7 100644 --- a/python/helpers/pydev/_pydevd_bundle/tables/images/pydevd_numpy_based_image.py +++ b/python/helpers/pydev/_pydevd_bundle/tables/images/pydevd_numpy_based_image.py @@ -34,7 +34,7 @@ def create_image(arr): arr_to_convert = arr_to_convert.numpy() arr_to_convert = np.where(arr_to_convert == None, 0, arr_to_convert) - arr_to_convert = np.nan_to_num(arr_to_convert, nan=0) + arr_to_convert = np.nan_to_num(arr_to_convert, nan=0, posinf=255, neginf=0) if np.iscomplexobj(arr_to_convert) or np.issubdtype(arr_to_convert.dtype, np.timedelta64): raise ValueError("Only non-complex numeric array types are supported.") diff --git a/python/helpers/pydev/_pydevd_bundle/tables/images/pydevd_numpy_image.py b/python/helpers/pydev/_pydevd_bundle/tables/images/pydevd_numpy_image.py index 84190b9e38f9..f6228af842f3 100644 --- a/python/helpers/pydev/_pydevd_bundle/tables/images/pydevd_numpy_image.py +++ b/python/helpers/pydev/_pydevd_bundle/tables/images/pydevd_numpy_image.py @@ -13,7 +13,7 @@ def create_image(arr): arr_to_convert = arr arr_to_convert = np.where(arr_to_convert == None, 0, arr_to_convert) - arr_to_convert = np.nan_to_num(arr_to_convert, nan=0) + arr_to_convert = np.nan_to_num(arr_to_convert, nan=0, posinf=255, neginf=0) if np.iscomplexobj(arr_to_convert) or np.issubdtype(arr_to_convert.dtype, np.timedelta64): raise ValueError("Only non-complex numeric array types are supported.") diff --git a/python/helpers/pydev/pydev_console/console.thrift b/python/helpers/pydev/pydev_console/console.thrift index d8b9bd924f8f..2cd54ceccceb 100644 --- a/python/helpers/pydev/pydev_console/console.thrift +++ b/python/helpers/pydev/pydev_console/console.thrift @@ -18,10 +18,11 @@ struct DebugValue { 4: string value, 5: bool isContainer, 6: string shape, - 7: bool isReturnedValue, - 8: bool isIPythonHidden, - 9: bool isErrorOnEval, - 10: string typeRendererId + 7: string arrayElementType, + 8: bool isReturnedValue, + 9: bool isIPythonHidden, + 10: bool isErrorOnEval, + 11: string typeRendererId } typedef list GetFrameResponse diff --git a/python/pydevSrc/src/com/jetbrains/python/debugger/PyDebugValue.java b/python/pydevSrc/src/com/jetbrains/python/debugger/PyDebugValue.java index 49330c81ebf7..2bd41a19c83d 100644 --- a/python/pydevSrc/src/com/jetbrains/python/debugger/PyDebugValue.java +++ b/python/pydevSrc/src/com/jetbrains/python/debugger/PyDebugValue.java @@ -65,6 +65,7 @@ public class PyDebugValue extends XNamedValue { protected @Nullable String myValue; private final boolean myContainer; private final @Nullable String myShape; + private final @Nullable String myArrayElementType; private final boolean myIsReturnedVal; private final boolean myIsIPythonHidden; private @Nullable PyDebugValue myParent; @@ -129,12 +130,47 @@ public class PyDebugValue extends XNamedValue { @Nullable String typeRendererId, final @Nullable PyDebugValue parent, final @NotNull PyFrameAccessor frameAccessor) { + this(name, type, typeQualifier, value, container, shape, null, isReturnedVal, isIPythonHidden, errorOnEval, typeRendererId, parent, frameAccessor); + } + + + public PyDebugValue(final @NotNull String name, + final @Nullable String type, + @Nullable String typeQualifier, + final @Nullable String value, + final boolean container, + @Nullable String shape, + @Nullable String arrayElementType, + boolean isReturnedVal, + boolean isIPythonHidden, + boolean errorOnEval, + @Nullable String typeRendererId, + final @NotNull PyFrameAccessor frameAccessor) { + this(name, type, typeQualifier, value, container, shape, arrayElementType, isReturnedVal, isIPythonHidden, errorOnEval, typeRendererId, + null, frameAccessor); + } + + + public PyDebugValue(final @NotNull String name, + final @Nullable String type, + @Nullable String typeQualifier, + final @Nullable String value, + final boolean container, + @Nullable String shape, + @Nullable String arrayElementType, + boolean isReturnedVal, + boolean isIPythonHidden, + boolean errorOnEval, + @Nullable String typeRendererId, + final @Nullable PyDebugValue parent, + final @NotNull PyFrameAccessor frameAccessor) { super(name); myType = type; myTypeQualifier = Strings.isNullOrEmpty(typeQualifier) ? null : typeQualifier; myValue = value; myContainer = container; myShape = shape; + myArrayElementType = arrayElementType; myIsReturnedVal = isReturnedVal; myIsIPythonHidden = isIPythonHidden; myErrorOnEval = errorOnEval; @@ -149,7 +185,7 @@ public class PyDebugValue extends XNamedValue { } public PyDebugValue(@NotNull PyDebugValue value, @NotNull String newName) { - this(newName, value.getType(), value.getTypeQualifier(), value.getValue(), value.isContainer(), value.getShape(), value.isReturnedVal(), + this(newName, value.getType(), value.getTypeQualifier(), value.getValue(), value.isContainer(), value.getShape(), value.getArrayElementType(), value.isReturnedVal(), value.isIPythonHidden(), value.isErrorOnEval(), value.getTypeRendererId(), value.getParent(), value.getFrameAccessor()); myOffset = value.getOffset(); setLoadValuePolicy(value.getLoadValuePolicy()); @@ -204,6 +240,10 @@ public class PyDebugValue extends XNamedValue { return myTypeRendererId; } + public @Nullable String getArrayElementType() { + return myArrayElementType; + } + public @Nullable PyDebugValue getParent() { return myParent; } @@ -538,7 +578,10 @@ public class PyDebugValue extends XNamedValue { case NodeTypes.NDARRAY_NODE_TYPE, NodeTypes.EAGER_TENSOR_NODE_TYPE, NodeTypes.RESOURCE_VARIABLE_NODE_TYPE, NodeTypes.SPARSE_TENSOR_NODE_TYPE, NodeTypes.TENSOR_NODE_TYPE -> { int[] shape = extractShape(debugValue); - yield isValidArrayShape(shape); + String arrayElementType = debugValue.getArrayElementType(); + boolean isConvertibleDataType = arrayElementType != null && !arrayElementType.isEmpty() && + (arrayElementType.contains("float") || arrayElementType.contains("bool") || arrayElementType.contains("int")); + yield isConvertibleDataType && isConvertibleArrayShape(shape); } case NodeTypes.IMAGE_NODE_TYPE, NodeTypes.PNG_IMAGE_NODE_TYPE, NodeTypes.JPEG_IMAGE_NODE_TYPE, NodeTypes.FIGURE_NODE_TYPE -> true; default -> false; @@ -561,7 +604,7 @@ public class PyDebugValue extends XNamedValue { .toArray(); } - private static boolean isValidArrayShape(int[] shape) { + private static boolean isConvertibleArrayShape(int[] shape) { if (shape == null || shape.length == 0) { return false; } diff --git a/python/pydevSrc/src/com/jetbrains/python/debugger/pydev/ProtocolParser.java b/python/pydevSrc/src/com/jetbrains/python/debugger/pydev/ProtocolParser.java index e0c085f0084b..dc9669ec959f 100644 --- a/python/pydevSrc/src/com/jetbrains/python/debugger/pydev/ProtocolParser.java +++ b/python/pydevSrc/src/com/jetbrains/python/debugger/pydev/ProtocolParser.java @@ -273,8 +273,8 @@ public final class ProtocolParser { final String name = readString(reader, "name", null); final String isErrorOnEval = readString(reader, "isErrorOnEval", ""); if (HIDDEN_TYPES.contains(name)) { - return new PyDebugValue(name, null, "", "", false, null, false, - false, "True".equals(isErrorOnEval), null, frameAccessor); + return new PyDebugValue(name, null, "", "", false, null, null, false, + false, "True".equals(isErrorOnEval), null, null, frameAccessor); } final String type = readString(reader, "type", null); @@ -286,17 +286,19 @@ public final class ProtocolParser { final String isIPythonHidden = readString(reader, "isIPythonHidden", ""); String typeRendererId = readString(reader, "typeRendererId", ""); String shape = readString(reader, "shape", ""); + String arrayElementType = readString(reader, "arrayElementType", ""); if (value.startsWith(type + ": ")) { // drop unneeded prefix value = value.substring(type.length() + 2); } if (shape.isEmpty()) shape = null; + if (arrayElementType.isEmpty()) arrayElementType = null; if (typeRendererId.isEmpty()) typeRendererId = null; if (type.equals(DataFrameDebugValue.pyDataFrameType)) { return new DataFrameDebugValue(name, type, qualifier, value, "True".equals(isContainer), shape, "True".equals(isReturnedValue), "True".equals(isIPythonHidden), "True".equals(isErrorOnEval), typeRendererId, frameAccessor); } - return new PyDebugValue(name, type, qualifier, value, "True".equals(isContainer), shape, "True".equals(isReturnedValue), + return new PyDebugValue(name, type, qualifier, value, "True".equals(isContainer), shape, arrayElementType, "True".equals(isReturnedValue), "True".equals(isIPythonHidden), "True".equals(isErrorOnEval), typeRendererId, frameAccessor); } @@ -316,7 +318,7 @@ public final class ProtocolParser { result.setType(readString(reader, "type", null)); result.setMax(readString(reader, "max", null)); result.setMin(readString(reader, "min", null)); - result.setValue(new PyDebugValue(slice, null, null, null, false, null, false, false, false, null, frameAccessor)); + result.setValue(new PyDebugValue(slice, null, null, null, false, null, null,false, false, false, null, null, frameAccessor)); reader.moveUp(); } if ("headerdata".equals(reader.peekNextChild())) { diff --git a/python/pydevSrc/src/com/jetbrains/python/debugger/values/DataFrameDebugValue.java b/python/pydevSrc/src/com/jetbrains/python/debugger/values/DataFrameDebugValue.java index b557d8eb796b..b43876f3c6ba 100644 --- a/python/pydevSrc/src/com/jetbrains/python/debugger/values/DataFrameDebugValue.java +++ b/python/pydevSrc/src/com/jetbrains/python/debugger/values/DataFrameDebugValue.java @@ -32,7 +32,7 @@ public final class DataFrameDebugValue extends PyDebugValue { boolean errorOnEval, @Nullable String typeRendererId, @NotNull PyFrameAccessor frameAccessor) { - super(name, type, typeQualifier, value, container, shape, isReturnedVal, isIPythonHidden, errorOnEval, typeRendererId, frameAccessor); + super(name, type, typeQualifier, value, container, shape, null, isReturnedVal, isIPythonHidden, errorOnEval, typeRendererId, null, frameAccessor); } public DataFrameDebugValue(@NotNull String name, diff --git a/python/src/com/jetbrains/python/console/PydevConsoleCommunicationUtil.kt b/python/src/com/jetbrains/python/console/PydevConsoleCommunicationUtil.kt index dc806629c502..9049c153926b 100644 --- a/python/src/com/jetbrains/python/console/PydevConsoleCommunicationUtil.kt +++ b/python/src/com/jetbrains/python/console/PydevConsoleCommunicationUtil.kt @@ -39,8 +39,8 @@ fun createPyDebugValue(value: DebugValue, frameAccessor: PyFrameAccessor): PyDeb dataFrameDebugValue } else PyDebugValue(value.name, value.type, value.qualifier, value.value ?: "", - value.isContainer, value.shape, value.isReturnedValue, value.isIPythonHidden, value.isErrorOnEval, - value.typeRendererId, frameAccessor) + value.isContainer, value.shape, value.arrayElementType, value.isReturnedValue, value.isIPythonHidden, + value.isErrorOnEval, value.typeRendererId, frameAccessor) } fun createArrayChunk(response: GetArrayResponse, frameAccessor: PyFrameAccessor): ArrayChunk { diff --git a/python/src/com/jetbrains/python/debugger/PyDebuggerEvaluator.java b/python/src/com/jetbrains/python/debugger/PyDebuggerEvaluator.java index 2599849f8582..060a9eccf432 100644 --- a/python/src/com/jetbrains/python/debugger/PyDebuggerEvaluator.java +++ b/python/src/com/jetbrains/python/debugger/PyDebuggerEvaluator.java @@ -28,7 +28,7 @@ public class PyDebuggerEvaluator extends XDebuggerEvaluator { } private PyDebugValue getNone() { - return new PyDebugValue("", "NoneType", null, "None", false, null, false, false, false, null, null, myDebugProcess); + return new PyDebugValue("", "NoneType", null, "None", false, null, null, false, false, false, null, null, myDebugProcess); } private void doEvaluate(final String expr, final XEvaluationCallback callback, final boolean doTrunc) {