Skip to content

Conversation

@ilevkivskyi
Copy link
Member

This is another problem caused by #19398 and a missing part of #20254 cc @JukkaL

@hauntsaninja there is a small chance this may be related to the problems with black.

@hauntsaninja hauntsaninja merged commit b05fd63 into python:master Nov 23, 2025
14 checks passed
@ilevkivskyi ilevkivskyi deleted the mypyc-super-yield-crash branch November 23, 2025 10:14
@ilevkivskyi
Copy link
Member Author

Hm, this didn't help, but some exceptions now look different.

@ilevkivskyi
Copy link
Member Author

Anyway, after looking at the new errors, and at what black is doing I am 95% sure those problems have nothing to do with hashability nor unions. It is a real stress test for correctness of Jukka's direct call to generator helper optimization, because black's generator methods have both:

  • Full blown inheritance involving both parents calling overridden methods, and children calling parent methods via super().
  • Wild mix of fast and slow path because of this part:
          visitf = getattr(self, f"visit_{name}", None)
          if visitf:
              yield from visitf(node)
          else:
              yield from self.visit_default(node)

I will try to find a minimal repro (but TBH I don't fully understand how generators work in mypyc).

@ilevkivskyi
Copy link
Member Author

Also btw black uses custom exceptions for non-local control in generators, i.e. they have raise CannotSplit(...) and then some try/except catching it in a caller generator.

@ilevkivskyi
Copy link
Member Author

I have a gut feeling something is wrong with stop_iter_value_reg but still can't write any compact repro.

@ilevkivskyi
Copy link
Member Author

Hm, it may have been red herring, al symbol tables are messed up after b3e26e7. I will make a PR with a fix later today (unless someone else does first).

p-sawicki pushed a commit to p-sawicki/mypy that referenced this pull request Nov 25, 2025
This is another problem caused by
python#19398 and a missing part of
python#20254 cc @JukkaL

@hauntsaninja there is a small chance this may be related to the
problems with black.
@ilevkivskyi
Copy link
Member Author

Hm, this is more tricky than I thought, I will continue discussion in the release issue, since the current problem isn't really caused by generators.

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.

2 participants