REF: route object-dtype parser fallbacks through _string_convert#65933
Open
jbrockmendel wants to merge 2 commits into
Open
REF: route object-dtype parser fallbacks through _string_convert#65933jbrockmendel wants to merge 2 commits into
jbrockmendel wants to merge 2 commits into
Conversation
In TextReader._convert_tokens, the object-dtype fallbacks went through
_convert_with_dtype(np.dtype("object"), ...), which simply delegates to
_string_convert (ignoring na_fset / user_dtype / raise_on_invalid). Call
_string_convert directly instead, and break out of the cast loop early
when the cast order reaches object. Behavior-neutral; removes a layer of
indirection ahead of GH#65283.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
In
TextReader._convert_tokens, the object-dtype fallbacks went through_convert_with_dtype(np.dtype("object"), ...), whoseobjectbranch just delegates to_string_convert(thena_fset/user_dtype/raise_on_invalidargs are ignored there). This calls_string_convertdirectly instead, and breaks out of the cast-order loop early oncedtreachesobject(the last entry), skipping the_convert_with_dtypedispatch chain.Behavior-neutral cleanup that removes a layer of indirection. It's a prelim split off from GH-65283 (read_csv emitting pyarrow-backed string arrays from the C parser), where these call sites grow an
allow_pyarrowargument — landing the neutral refactor separately keeps that PR focused on the new fast path.pandas/tests/io/parser/suite passes (4480 passed, 174 skipped, 192 xfailed)pre-commit runclean🤖 Generated with Claude Code