GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — gh-105069: Add a readline-like callable to the tokenizer to consume input iteratively by pablogsal · Pull Request #105070 · python/cpython Conversation
|
| def get_tokens(string): | ||
| return list(_generate_tokens_from_c_tokenizer(string)) | ||
|
|
||
| self.assertRaises(SyntaxError, get_tokens, "(1+2]") |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This was bothering me 😅
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| This has the same API as tokenize(), except that it expects the *readline* | ||
| callable to return str objects instead of bytes. | ||
| """ | ||
| def _gen(): |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Now that we are taking callables all of these can go :)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…sume input iteratively Signed-off-by: Pablo Galindo <[email protected]>
… to consume input iteratively
…kenizer to consume input iteratively
… the tokenizer to consume input iteratively
| add(string) | ||
| if (string == ','): | ||
| add(' ') | ||
| clean_signature = ''.join(text).strip() |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This change is because for some reason the inspect module is relying on the fact that if lines yielded by the generator do not end in \n then they are concatenated together, which is wrong because the contract says "should yield one line at a time" so if the line doesn't end in newline we add one always.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Great job! 💯
A couple of comments and it's good to go!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
…able to the tokenizer to consume input iteratively
…ke callable to the tokenizer to consume input iteratively
|
Fixed the problems and added another test. @lysnikolaou ready for another review! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
CC: @mgmacias95 wanna make a review? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…line-like callable to the tokenizer to consume input iteratively
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry @pablogsal, I had trouble checking out the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…sume input iteratively (pythonGH-105070) (cherry picked from commit 9216e69) Co-authored-by: Pablo Galindo Salgado <[email protected]>
|
GH-105119 is a backport of this pull request to the 3.12 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.