Skip to content

Conversation

ZeroIntensity
Copy link
Member

@ZeroIntensity ZeroIntensity commented Nov 3, 2024

@corona10
Copy link
Member

corona10 commented Nov 3, 2024

cc @colesbury

@corona10
Copy link
Member

corona10 commented Nov 3, 2024

I will try to take a look at today :)

@ZeroIntensity ZeroIntensity changed the title gh-126366: Lock generic iterables in list.__init__ gh-126366: Make native generators thread safe Nov 4, 2024
@ZeroIntensity
Copy link
Member Author

Closing in favor of #120327

@Fidget-Spinner
Copy link
Member

Wait I closed my PR in favour of yours... 😆 @ZeroIntensity

@ZeroIntensity
Copy link
Member Author

Ah! I'll reopen this and list you as a co-author if yours has merge conflicts.

@ZeroIntensity ZeroIntensity reopened this Nov 6, 2024
@ZeroIntensity ZeroIntensity removed the needs backport to 3.13 bugs and security fixes label Dec 24, 2024
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

There is a warning:

Check warning on line 129 in Python/ceval_macros.h
‘gen_frame’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

The overall approach LGTM. I'm feeling more confortable with more critical sections :-)

@colesbury
Copy link
Contributor

  • Let's avoid critical sections in bytecodes.c. It's too easy to make these kinds of mistakes where you exit out of a critical section without ending it.
  • I don't think the generator running thread safety should use critical sections. We should use something like an atomic-compare-exchange to mark it as running

@ZeroIntensity ZeroIntensity marked this pull request as draft January 2, 2025 17:55
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.

5 participants