Skip to content

Keep caller-owned binary streams open after reading ASCII PLY - #92

Open
xixihaha-ha wants to merge 1 commit into
dranjan:masterfrom
xixihaha-ha:fix/ascii-stream-ownership
Open

xixihaha-ha wants to merge 1 commit into
dranjan:masterfrom
xixihaha-ha:fix/ascii-stream-ownership

Conversation

@xixihaha-ha

@xixihaha-ha xixihaha-ha commented Nov 3, 2026 •

Copy link
Copy Markdown

Reading ASCII PLY from a caller-supplied binary stream creates a TextIOWrapper that closes the underlying stream when destroyed. Consequently BytesIO.getvalue() or reusing the file after PlyData.read() raises ValueError. This also occurs after a parsing error, whereas text streams and binary PLY streams remain open.

Detach the internally created text wrapper in finally, leaving externally owned streams open while retaining the existing closure of files opened from paths. Add success and parse-error regression cases.

Validation: both new cases fail on unchanged code because the stream is closed. After the fix the complete test directory passes (123 passed), on Python 3.11 with NumPy 2.

AI assistance was used to investigate, implement and test this change.


📚 Documentation preview 📚: https://python-plyfile--92.org.readthedocs.build/en/92/

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.

1 participant