Skip to content

Commit 2267dbf

Browse files
authored
fix stackoverflow when dump (#1023)
1 parent 5f3f142 commit 2267dbf

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

uiautomator2/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def screenshot(self, filename: Optional[str] = None, format="pillow", display_id
262262
return
263263
return image_convert(pil_img, format)
264264

265-
def dump_hierarchy(self, compressed=False, pretty=False, max_depth: int = None) -> str:
265+
def dump_hierarchy(self, compressed=False, pretty=False, max_depth: Optional[int] = None) -> str:
266266
"""
267267
Dump window hierarchy
268268
@@ -275,6 +275,8 @@ def dump_hierarchy(self, compressed=False, pretty=False, max_depth: int = None)
275275
xml content
276276
"""
277277
try:
278+
if max_depth is None:
279+
max_depth = self.settings['max_depth']
278280
content = self._do_dump_hierarchy(compressed, max_depth)
279281
except HierarchyEmptyError: # pragma: no cover
280282
logger.warning("dump empty, return empty xml")

uiautomator2/assets/sync.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -e
55

66
APK_VERSION=$(cat ../version.py| grep apk_version | awk '{print $NF}')
77
APK_VERSION=${APK_VERSION//[\"\']}
8-
JAR_VERSION="0.1.0"
8+
JAR_VERSION="0.1.2"
99

1010
cd "$(dirname $0)"
1111

uiautomator2/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def __init__(self, d):
1818
"operation_delay": (0, 0),
1919
"operation_delay_methods": ["click", "swipe"],
2020
"fallback_to_blank_screenshot": False,
21+
"max_depth": 50,
2122
}
2223

2324
self._deprecated_props = {

0 commit comments

Comments
 (0)