diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b1e73d961..b85df99ff 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -4,7 +4,4 @@ # in the repository, i.e. bar/baz will match /bar/baz and /foo/bar/baz. # The default owners for everything that is not overridden by specific patterns below. -* @int19h @karthiknadig @AdamYoblick - -# Order is important: the last matching pattern overrides all the preceding ones. -/src/ptvsd/_vendored/pydevd/ @fabioz +* @int19h @AdamYoblick diff --git a/azure-pipelines/pipelines.yaml b/azure-pipelines/pipelines.yaml index 4a28e2a18..13e9f70ae 100644 --- a/azure-pipelines/pipelines.yaml +++ b/azure-pipelines/pipelines.yaml @@ -39,7 +39,7 @@ jobs: - script: "python3 -m pip install -U ruff" displayName: "Install ruff" - - script: "python3 -m ruff check --format=junit --output-file=$(Build.ArtifactStagingDirectory)/lint-ruff.xml ." + - script: "python3 -m ruff check --output-format=junit --output-file=$(Build.ArtifactStagingDirectory)/lint-ruff.xml ." displayName: "Run ruff" - task: "PublishTestResults@2" diff --git a/setup.py b/setup.py index 0bb4f00ca..15e48f4d5 100644 --- a/setup.py +++ b/setup.py @@ -176,7 +176,14 @@ def tail_is(*suffixes): "License :: OSI Approved :: MIT License", ], package_dir={"": "src"}, - packages=setuptools.find_namespace_packages(where="src", include=["debugpy*"]), + packages=[ + "debugpy", + "debugpy.adapter", + "debugpy.common", + "debugpy.launcher", + "debugpy.server", + "debugpy._vendored", + ], package_data={ "debugpy": ["ThirdPartyNotices.txt"], "debugpy._vendored": [ diff --git a/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_safe_repr.py b/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_safe_repr.py index f1b64b753..db14fc355 100644 --- a/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_safe_repr.py +++ b/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_safe_repr.py @@ -20,7 +20,7 @@ class SafeRepr(object): # most level, and truncated to maxstring_inner characters inside # collections. maxstring_outer = 2 ** 16 - maxstring_inner = 30 + maxstring_inner = 128 string_types = (str, bytes) bytes = bytes set_info = (set, '{', '}', False) @@ -31,7 +31,7 @@ class SafeRepr(object): # Collection types are recursively iterated for each limit in # maxcollection. - maxcollection = (15, 10) + maxcollection = (60, 20) # Specifies type, prefix string, suffix string, and whether to include a # comma if there is only one element. (Using a sequence rather than a @@ -60,7 +60,7 @@ class SafeRepr(object): # All other types are treated identically to strings, but using # different limits. maxother_outer = 2 ** 16 - maxother_inner = 30 + maxother_inner = 128 convert_to_hex = False raw_value = False diff --git a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_amd64.dll b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_amd64.dll index 8bdea356b..da4dd60e2 100644 Binary files a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_amd64.dll and b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_amd64.dll differ diff --git a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_amd64.pdb b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_amd64.pdb index 407dfa5ea..74c127600 100644 Binary files a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_amd64.pdb and b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_amd64.pdb differ diff --git a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_x86.dll b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_x86.dll index b2a06d928..10ba717bc 100644 Binary files a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_x86.dll and b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_x86.dll differ diff --git a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_x86.pdb b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_x86.pdb index e479763b5..fa5362567 100644 Binary files a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_x86.pdb and b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_x86.pdb differ diff --git a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_amd64.exe b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_amd64.exe index 04e6db551..56fbc7d40 100644 Binary files a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_amd64.exe and b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_amd64.exe differ diff --git a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_amd64.pdb b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_amd64.pdb index 9ff784ba1..f37cddfae 100644 Binary files a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_amd64.pdb and b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_amd64.pdb differ diff --git a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_x86.exe b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_x86.exe index 233d8c2a7..15a0d8682 100644 Binary files a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_x86.exe and b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_x86.exe differ diff --git a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_x86.pdb b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_x86.pdb index d4eba5415..ac6b11386 100644 Binary files a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_x86.pdb and b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_x86.pdb differ diff --git a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_amd64.dll b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_amd64.dll index 11735130b..299f1b6bc 100644 Binary files a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_amd64.dll and b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_amd64.dll differ diff --git a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_amd64.pdb b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_amd64.pdb index c550282f8..ca2ea985c 100644 Binary files a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_amd64.pdb and b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_amd64.pdb differ diff --git a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_x86.dll b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_x86.dll index 3a714f7ba..7fc9d8eef 100644 Binary files a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_x86.dll and b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_x86.dll differ diff --git a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_x86.pdb b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_x86.pdb index 6dd20bf8e..826e82ed0 100644 Binary files a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_x86.pdb and b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_x86.pdb differ diff --git a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/compile_windows.bat b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/compile_windows.bat index 1fb8a2274..a7f313531 100644 --- a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/compile_windows.bat +++ b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/compile_windows.bat @@ -8,29 +8,29 @@ setlocal call "%VSDIR%\VC\Auxiliary\Build\vcvarsall.bat" x86 -vcvars_spectre_libs=spectre -cl -DUNICODE -D_UNICODE /EHsc /Zi /O1 /W3 /LD /MD /Qspectre attach.cpp /link /DEBUG /OPT:REF /OPT:ICF /GUARD:CF /out:attach_x86.dll +cl -DUNICODE -D_UNICODE /EHsc /Zi /O1 /W3 /LD /MD /Qspectre attach.cpp /link /PROFILE /GUARD:CF /out:attach_x86.dll copy attach_x86.dll ..\attach_x86.dll /Y copy attach_x86.pdb ..\attach_x86.pdb /Y -cl -DUNICODE -D_UNICODE /EHsc /Zi /O1 /W3 /LD /MD /D BITS_32 /Qspectre run_code_on_dllmain.cpp /link /DEBUG /OPT:REF /OPT:ICF /GUARD:CF /out:run_code_on_dllmain_x86.dll +cl -DUNICODE -D_UNICODE /EHsc /Zi /O1 /W3 /LD /MD /D BITS_32 /Qspectre run_code_on_dllmain.cpp /link /PROFILE /GUARD:CF /out:run_code_on_dllmain_x86.dll copy run_code_on_dllmain_x86.dll ..\run_code_on_dllmain_x86.dll /Y copy run_code_on_dllmain_x86.pdb ..\run_code_on_dllmain_x86.pdb /Y -cl /EHsc /Zi /O1 /W3 /Qspectre inject_dll.cpp /link /DEBUG /OPT:REF /OPT:ICF /GUARD:CF /out:inject_dll_x86.exe +cl /EHsc /Zi /O1 /W3 /Qspectre inject_dll.cpp /link /DEBUG /OPT:REF /OPT:ICF /GUARD:CF /out:inject_dll_x86.exe copy inject_dll_x86.exe ..\inject_dll_x86.exe /Y copy inject_dll_x86.pdb ..\inject_dll_x86.pdb /Y call "%VSDIR%\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64 -vcvars_spectre_libs=spectre -cl -DUNICODE -D_UNICODE /EHsc /Zi /O1 /W3 /LD /MD /Qspectre attach.cpp /link /DEBUG /OPT:REF /OPT:ICF /GUARD:CF /out:attach_amd64.dll +cl -DUNICODE -D_UNICODE /EHsc /Zi /O1 /W3 /LD /MD /Qspectre attach.cpp /link /PROFILE /GUARD:CF /out:attach_amd64.dll copy attach_amd64.dll ..\attach_amd64.dll /Y copy attach_amd64.pdb ..\attach_amd64.pdb /Y -cl -DUNICODE -D_UNICODE /EHsc /Zi /O1 /W3 /LD /MD /D BITS_64 /Qspectre run_code_on_dllmain.cpp /link /DEBUG /OPT:REF /OPT:ICF /GUARD:CF /out:run_code_on_dllmain_amd64.dll +cl -DUNICODE -D_UNICODE /EHsc /Zi /O1 /W3 /LD /MD /D BITS_64 /Qspectre run_code_on_dllmain.cpp /link /PROFILE /GUARD:CF /out:run_code_on_dllmain_amd64.dll copy run_code_on_dllmain_amd64.dll ..\run_code_on_dllmain_amd64.dll /Y copy run_code_on_dllmain_amd64.pdb ..\run_code_on_dllmain_amd64.pdb /Y -cl /EHsc /Zi /O1 /W3 /Qspectre inject_dll.cpp /link /DEBUG /OPT:REF /OPT:ICF /GUARD:CF /out:inject_dll_amd64.exe +cl /EHsc /Zi /O1 /W3 /Qspectre inject_dll.cpp /link /DEBUG /OPT:REF /OPT:ICF /GUARD:CF /out:inject_dll_amd64.exe copy inject_dll_amd64.exe ..\inject_dll_amd64.exe /Y copy inject_dll_amd64.pdb ..\inject_dll_amd64.pdb /Y diff --git a/src/debugpy/_vendored/pydevd/pydevd_plugins/__init__.py b/src/debugpy/_vendored/pydevd/pydevd_plugins/__init__.py new file mode 100644 index 000000000..bb61062c9 --- /dev/null +++ b/src/debugpy/_vendored/pydevd/pydevd_plugins/__init__.py @@ -0,0 +1,2 @@ +import pkgutil +__path__ = pkgutil.extend_path(__path__, __name__) diff --git a/src/debugpy/_vendored/pydevd/pydevd_plugins/extensions/__init__.py b/src/debugpy/_vendored/pydevd/pydevd_plugins/extensions/__init__.py new file mode 100644 index 000000000..bb61062c9 --- /dev/null +++ b/src/debugpy/_vendored/pydevd/pydevd_plugins/extensions/__init__.py @@ -0,0 +1,2 @@ +import pkgutil +__path__ = pkgutil.extend_path(__path__, __name__) diff --git a/src/debugpy/_vendored/pydevd/pydevd_plugins/extensions/types/__init__.py b/src/debugpy/_vendored/pydevd/pydevd_plugins/extensions/types/__init__.py new file mode 100644 index 000000000..bb61062c9 --- /dev/null +++ b/src/debugpy/_vendored/pydevd/pydevd_plugins/extensions/types/__init__.py @@ -0,0 +1,2 @@ +import pkgutil +__path__ = pkgutil.extend_path(__path__, __name__) diff --git a/tests/debugpy/test_numpy.py b/tests/debugpy/test_numpy.py new file mode 100644 index 000000000..aa70a19e3 --- /dev/null +++ b/tests/debugpy/test_numpy.py @@ -0,0 +1,77 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See LICENSE in the project root +# for license information. + +from tests import debug +from tests.patterns import some + + +def test_ndarray(pyfile, target, run): + @pyfile + def code_to_debug(): + import numpy + import debuggee + + debuggee.setup() + a = numpy.array([123, 456], numpy.int32) + print(a) # @bp + + with debug.Session() as session: + session.config["variablePresentation"] = {"all": "hide", "protected": "inline"} + with run(session, target(code_to_debug)): + session.set_breakpoints(code_to_debug, all) + + stop = session.wait_for_stop() + scopes = session.request("scopes", {"frameId": stop.frame_id})["scopes"] + globals_ref = scopes[0]["variablesReference"] + vars = session.request( + "variables", + {"variablesReference": globals_ref}, + )["variables"] + print(vars) + + # Fetch children variables of the array. + (a,) = (v for v in vars if v["name"] == "a") + a_vars = session.request( + "variables", + {"variablesReference": a["variablesReference"]}, + )["variables"] + print(a_vars) + + # Fetch the actual array items + (items,) = (v for v in a_vars if v["name"] == "[0:2] ") + a_items = session.request( + "variables", + {"variablesReference": items["variablesReference"]}, + )["variables"] + print(a_items) + + assert a_items == [ + some.dict.containing( + { + "type": "int32", + "name": "0", + "value": "123", + "variablesReference": some.int, + } + ), + some.dict.containing( + { + "type": "int32", + "name": "1", + "value": "456", + "variablesReference": some.int, + } + ), + some.dict.containing( + { + "type": "int", + "name": "len()", + "value": "2", + "presentationHint": {"attributes": ["readOnly"]}, + "variablesReference": 0, + } + ), + ] + + session.request_continue() diff --git a/tests/requirements.txt b/tests/requirements.txt index f6678ce61..12784fe35 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -13,6 +13,7 @@ psutil ## Used in Python code that is run/debugged by the tests: django -requests -gevent flask +gevent +numpy +requests