◐ Shell
clean mode source ↗

bpo-40334: refactor and cleanup for the PEG generators by pablogsal · Pull Request #19775 · python/cpython

@pablogsal

Improvements in this PR:

  • No more relying on the string names to deduce the types of local variables.
  • No more threading down the names of local variables from all functions and
    visiting: now the code has a local variable scope with a context manager.
  • Specially for @lysnikolaou: I have actually managed to do bpo-40334: Refactor peg_generator to receive a Tokens file when building c code #19745 (comment) and now we don't need all the specialized token functions. Just one for name, string and number.
  • Now we have a class to represent function calls, making the code a bit
    more explicit and carrying metadata if needed. Also helps when debugging (from experience 😉 ).
  • Fix some mypy errors (like the fact that in add_var the variable type could actually have been None as opposed to our previous declaration).

https://bugs.python.org/issue40334

@pablogsal pablogsal changed the title bpo-40334: refactor and cleanup for the PEG c_generator bpo-40334: refactor and cleanup for the PEG generators

Apr 28, 2020

@lysnikolaou

  • Specially for @lysnikolaou: I have actually managed to do #19745 (comment) and now we don't need all the specialized token functions. Just one for name, string and number.

😃 😃

lysnikolaou

Choose a reason for hiding this comment

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

This is really a great improvement! Thanks a a lot! Most of my comments are stylistic, so feel free to ignore them.

Co-Authored-By: Lysandros Nikolaou <lisandrosnik@gmail.com>

lysnikolaou

Choose a reason for hiding this comment

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

Yes! 🚀

@bedevere-bot

This comment has been minimized.

@bedevere-bot

This comment has been minimized.

@pablogsal

The buildbot failures are unrelated and they are being addressed here:

#19791

@bedevere-bot

This comment has been minimized.

@bedevere-bot

This comment has been minimized.

@gvanrossum