-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
gh-132661: Implement PEP 750 #132662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
gh-132661: Implement PEP 750 #132662
Conversation
Still buggy
* Rename expr to expression, conv to conversion * Move templatelib under string lib * Add strings lib to LIBSUBDIRS * Update type of Template/TemplateIter/Interpolation
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
No, there aren't. Good idea to add some |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me overall!
I'm happy to help review/contribute to the documentation for t-strings in a follow-up, let me know what would be most helpful.
A
|
Please also run the buildbots before merge. They're currently a bit too red, but let's not make them more red: https://buildbot.python.org/#/release_status |
This comment was marked as resolved.
This comment was marked as resolved.
|
@lysnikolaou I think it would be good enough to test something like: user = 'test'
for template in (
t'',
t"No values",
t'With inter {user}',
t'With ! {user!r}',
t'With format {1 / 0.3:.2f}',
):
for proto in range(pickle.HIGHEST_PROTOCOL + 1):
with self.subTest(proto=proto, template=template):
pickled = pickle.dumps(template, protocol=proto)
unpickled = pickle.loads(pickled)
self.assertEqual(unpickled.values, template.values)
# ... |
|
I created #132831 for the buildbot failure. |
@sobolevn Where would you put this test? |
|
I would also add tests for pickling instantiated classes (in |
Sure, working on it :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few last-minute comments about the object code.
|
I've also noticed that |
This is expected, no? |
|
@lysnikolaou here's my PR: lysnikolaou#75 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parser and grammar LGTM, will do another pass later this week if the PR is still open.
Fantastic work @lysnikolaou π€
|
@markshannon @brandtbucher If you could take another look at the bytecode/compiler changes after the first round of feedback, that'd be great! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C code for the objects look good to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also don't have any other objections :)
|
π€ New build scheduled with the buildbot fleet by @lysnikolaou for commit 8468e10 π€ Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F132662%2Fmerge If you want to schedule another build, you need to add the π¨ test-with-buildbots label again. |
PEP 750 implementation! π
Let's make sure as many people as possible take a look at this, since it's touching many areas that I've not worked on before.
π Documentation preview π: https://cpython-previews--132662.org.readthedocs.build/