Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-104976: Ensure trailing dedent tokens are emitted as the previous tokenizer#104980

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
pablogsal merged 1 commit intopython:mainfrompablogsal:gh-104976
May 26, 2023

Conversation

pablogsal
Copy link
Member

@pablogsalpablogsal commentedMay 26, 2023
edited by bedevere-bot
Loading

@lysnikolaou
Copy link
Member

@pablogsal Can you provide a very quick explanation of how this works and changes the location of the DEDENT token? Nothing too detailed, just a quick overview of the though process, cause I'm having difficulties understanding this.

@pablogsal
Copy link
MemberAuthor

Can you provide a very quick explanation of how this works and changes the location of the DEDENT token?

Yep: the objective is that inplicit dedents like these:

if X:  if Y:     ...

are reported in the same line as theENDMARKER. For doing this we note that trailing dedent tokens are emitted in a situation where the tokenizer has reachedEOF sotok->done isE_EOF for all of them, which is great because this allows to identify them easily. We add now a branch for these to put the line number that is expected as the previous tokenizer.

Unfortunately, this forces us to handleENDMARKER in the extension because otherwise we don't have enough information to get correctly the line for it because checking the last token may now have these "artificial" new lines.

@pablogsal
Copy link
MemberAuthor

Tell me if something else is not clear:)

@pablogsal
Copy link
MemberAuthor

@pablogsal Can you provide a very quick explanation of how this works and changes the location of the DEDENT token? Nothing too detailed, just a quick overview of the though process, cause I'm having difficulties understanding this.

Ah wait, I forgot to push some commits 😓

lysnikolaou reacted with thumbs up emoji

@lysnikolaou
Copy link
Member

lysnikolaou commentedMay 26, 2023
edited
Loading

Ah wait, I forgot to push some commits 😓

Aha! Ok, makes sense now. Thanks for the explanation though, man!

@pablogsalpablogsalforce-pushed thegh-104976 branch 2 times, most recently from8a23a18 to19a58c5CompareMay 26, 2023 15:21
@pablogsal
Copy link
MemberAuthor

Aha! Ok, makes sense now. Thanks for the explanation though, man!

Sorry for the confusion! 😅 Check again when you have time!

Copy link
Member

@lysnikolaoulysnikolaou left a comment

Choose a reason for hiding this comment

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

Yup! Looks good!

…vious tokenizerSigned-off-by: Pablo Galindo <pablogsal@gmail.com>
@pablogsalpablogsal added the needs backport to 3.12only security fixes labelMay 26, 2023
@pablogsalpablogsal merged commit46b52e6 intopython:mainMay 26, 2023
@pablogsalpablogsal deleted the gh-104976 branchMay 26, 2023 21:02
@miss-islington
Copy link
Contributor

Thanks@pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-105000 is a backport of this pull request to the3.12 branch.

@bedevere-botbedevere-bot removed the needs backport to 3.12only security fixes labelMay 26, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestMay 26, 2023
…vious tokenizer (pythonGH-104980)(cherry picked from commit46b52e6)Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
pablogsal pushed a commit that referenced this pull requestMay 26, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@lysnikolaoulysnikolaoulysnikolaou approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@pablogsal@lysnikolaou@miss-islington@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp