Skip to content

Fix PPTX: tolerate unrecognized shape types instead of aborting deck - #2658

Open
Wu Shuwen (dajiaohuang) wants to merge 1 commit into
microsoft:mainfrom
dajiaohuang:fix/pptx-unrecognized-shape-tolerance
Open

Wu Shuwen (dajiaohuang) wants to merge 1 commit into
microsoft:mainfrom
dajiaohuang:fix/pptx-unrecognized-shape-tolerance

Conversation

@dajiaohuang

Copy link
Copy Markdown

Fixes #2569.

python-pptx raises NotImplementedError on shape types it does not recognize (e.g. shape types introduced in newer PowerPoint versions). Previously, accessing shape.shape_type in _is_picture, _is_table, and the group-shape check propagated that error out of convert(), causing one bad shape to abort the entire presentation.

Add a _shape_type_or_none() helper that returns None when the shape type cannot be determined, and use it in all three call sites. The shape falls through as 'none of the handled types' and its text frame (if any) is still recovered, matching the tolerance established by previous fixes #2059, #2194, #2408.

Fixes microsoft#2569.

python-pptx raises NotImplementedError on shape types it does not
recognize (e.g. shape types introduced in newer PowerPoint versions).
Previously, accessing shape.shape_type in _is_picture, _is_table, and
the group-shape check propagated that error out of convert(), causing
one bad shape to abort the entire presentation.

Add a _shape_type_or_none() helper that returns None when the shape
type cannot be determined, and use it in all three call sites. The
shape falls through as 'none of the handled types' and its text frame
(if any) is still recovered, matching the tolerance established by
previous fixes microsoft#2059, microsoft#2194, microsoft#2408.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PPTX: one unrecognized shape type aborts the whole presentation

1 participant