Skip to content

Test pickling of InvalidChunkLength - #5247

Merged
illia-v merged 1 commit into
urllib3:mainfrom
brianhelba:pickle-invalid-chunk-length
Sep 12, 2026
Merged

illia-v merged 1 commit into
urllib3:mainfrom
brianhelba:pickle-invalid-chunk-length

Conversation

@brianhelba

@brianhelba brianhelba commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

InvalidChunkLength is not covered by the TestPickle matrix, and it is a natural candidate for it: the exception carries a whole HTTPResponse object in its args, which is exactly the kind of payload that can break pickling when an exception crosses a process boundary (e.g. multiprocessing or concurrent.futures workers).

The test builds a response that has been partially read, so that partial, expected, and length all hold non-default values, and asserts that each of them survives a pickle round trip.

@illia-v illia-v added the Skip Changelog Pull requests that don't require a changelog entry label Sep 10, 2026

@illia-v illia-v left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we assert that non-default length, partial, and expected survive pickling and unpickling?
At the moment this only checks that pickling and unpickling succeed and preserve the exception type.

@brianhelba
brianhelba force-pushed the pickle-invalid-chunk-length branch from b5f838e to 30ff558 Compare September 12, 2026 19:41
`InvalidChunkLength` is not covered by the `TestPickle` matrix, and it
is a natural candidate for it: the exception carries a whole
`HTTPResponse` object in its `args`, which is exactly the kind of
payload that can break pickling when an exception crosses a process
boundary (e.g. multiprocessing or concurrent.futures workers).

The test builds a response that has been partially read, so that
`partial`, `expected`, and `length` all hold non-default values, and
asserts that each of them survives a pickle round trip.
@brianhelba
brianhelba force-pushed the pickle-invalid-chunk-length branch from 30ff558 to 3aba839 Compare September 12, 2026 19:45
@brianhelba

Copy link
Copy Markdown
Contributor Author

@illia-v Done.

@illia-v illia-v left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@illia-v
illia-v merged commit 43c68c8 into urllib3:main Sep 12, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skip Changelog Pull requests that don't require a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants