Repository navigation
Fix PPTX: tolerate unrecognized shape types instead of aborting deck - #2658
Open
Wu Shuwen (dajiaohuang) wants to merge 1 commit into
Open
Wu Shuwen (dajiaohuang) wants to merge 1 commit into
Wu Shuwen (dajiaohuang) wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_typein_is_picture,_is_table, and the group-shape check propagated that error out ofconvert(), causing one bad shape to abort the entire presentation.Add a
_shape_type_or_none()helper that returnsNonewhen 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.