Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1408, #1477 #1484

Merged
merged 2 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/debugpy/_vendored/pydevd/pydevd_plugins/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
77 changes: 77 additions & 0 deletions tests/debugpy/test_numpy.py
Original file line number Diff line number Diff line change
@@ -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()
5 changes: 3 additions & 2 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ psutil
## Used in Python code that is run/debugged by the tests:

django
requests
gevent
flask
gevent
numpy
requests