Skip to content

gh-73126: Don't fail early when __length_hint__() is too big for preallocation.#8635

Open
sir-sigurd wants to merge 1 commit intopython:mainfrom
sir-sigurd:length-hint
Open

gh-73126: Don't fail early when __length_hint__() is too big for preallocation.#8635
sir-sigurd wants to merge 1 commit intopython:mainfrom
sir-sigurd:length-hint

Conversation

@sir-sigurd
Copy link
Contributor

@sir-sigurd sir-sigurd commented Aug 2, 2018

if (result == NULL) {
/* bpo-28940 - LengthHint could lie and asked for too much,
* try again without preallocation. */
PyErr_Clear();
Copy link
Contributor

Choose a reason for hiding this comment

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

This will silence any possible exception raised in PyTuple_New() (same for PyByteArray_FromStringAndSize(), _PyBytesWriter_Alloc(), etc.). I don't think that's the right approach.

@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Dec 15, 2024
@picnixz picnixz changed the title bpo-28940: Don't fail early when __length_hint__() is too big for preallocation. gh-73126: Don't fail early when __length_hint__() is too big for preallocation. Dec 15, 2024
@github-actions github-actions bot removed the stale Stale PR or inactive for long period of time. label Feb 27, 2025
@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Apr 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review stale Stale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants