Skip to content

Commit

Permalink
fix stackoverflow when dump (#1023)
Browse files Browse the repository at this point in the history
  • Loading branch information
codeskyblue authored Aug 9, 2024
1 parent 5f3f142 commit 2267dbf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion uiautomator2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def screenshot(self, filename: Optional[str] = None, format="pillow", display_id
return
return image_convert(pil_img, format)

def dump_hierarchy(self, compressed=False, pretty=False, max_depth: int = None) -> str:
def dump_hierarchy(self, compressed=False, pretty=False, max_depth: Optional[int] = None) -> str:
"""
Dump window hierarchy
Expand All @@ -275,6 +275,8 @@ def dump_hierarchy(self, compressed=False, pretty=False, max_depth: int = None)
xml content
"""
try:
if max_depth is None:
max_depth = self.settings['max_depth']
content = self._do_dump_hierarchy(compressed, max_depth)
except HierarchyEmptyError: # pragma: no cover
logger.warning("dump empty, return empty xml")
Expand Down
2 changes: 1 addition & 1 deletion uiautomator2/assets/sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e

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

cd "$(dirname $0)"

Expand Down
1 change: 1 addition & 0 deletions uiautomator2/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def __init__(self, d):
"operation_delay": (0, 0),
"operation_delay_methods": ["click", "swipe"],
"fallback_to_blank_screenshot": False,
"max_depth": 50,
}

self._deprecated_props = {
Expand Down

0 comments on commit 2267dbf

Please sign in to comment.