Skip to content

Preserve comments supplied as iterators - #93

Open
fbirds5230 wants to merge 1 commit into
dranjan:masterfrom
fbirds5230:fix/preserve-comment-iterators
Open

fbirds5230 wants to merge 1 commit into
dranjan:masterfrom
fbirds5230:fix/preserve-comment-iterators

Conversation

@fbirds5230

@fbirds5230 fbirds5230 commented Nov 24, 2026 •

Copy link
Copy Markdown

The comments and obj_info parameters accept iterables, but their setters validate the input before converting it to a list. For a generator or iterator, validation consumes the input, so the stored metadata is empty. Element comments have the same problem.

Materialize each input once, then validate and store that list. Validation still happens before assignment, so invalid input leaves existing metadata intact.

The tests cover construction, PlyElement.describe, direct assignment, ASCII and binary round trips, preserved whitespace, and rejected comments that must keep the previous value. Three regression cases fail before the fix; six controls already pass.

Validation on Python 3.12.14 with NumPy 2.4.6:

  • All 127 tests pass, with 98% coverage.
  • Flake8 passes.
  • The documentation build passes without warnings.

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

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