GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-104719: Restore Tokenize module constants by mgmacias95 · Pull Request #104722 · python/cpython

Conversation

@mgmacias95

@mgmacias95 mgmacias95 commented May 21, 2023 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
  • Issue: IDLE is unable to open any .py files #104719

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mgmacias95
Restore Tokenize module constants
e0c99ff
@bedevere-bot bedevere-bot added the awaiting review label May 21, 2023
@bedevere-bot bedevere-bot mentioned this pull request May 21, 2023
IDLE is unable to open any .py files #104719
Closed
@AlexWaygood

AlexWaygood commented May 21, 2023

Copy link
Copy Markdown
Member

I was wondering if you could do something like this:

_deprecated_objects = {
    "group": lambda *choices: '(' + '|'.join(choices) + ')',
    "any": lambda *choices: group(*choices) + '*',
    "maybe": lambda *choices: group(*choices) + '?',
    "Whitespace": r'[ \f\t]*',
    # etc.
}

And then at the end of the file have:

def __getattr__(name):
    if name in _deprecated_objects:
        import warnings
        warnings._deprecated(
            f"tokenize.{name}",
            message=(
                "{name} is untested, undocumented, and deprecated. "
                "It will be removed in Python {remove}."
            ),
            remove=(3, 14)
        )
        obj = globals()[name] = _deprecated_objects[name]
        return obj
    raise AttributeError(f"module 'tokenize' has no attribute '{name}'")

But I will defer to you and @pablogsal as to whether that's a good idea or not.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AlexWaygood

AlexWaygood commented May 21, 2023

Copy link
Copy Markdown
Member

Looks like this does fix the immediate issue, though -- IDLE is once again able to open .py files 🎉

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pablogsal pablogsal added the skip news label May 21, 2023
@pablogsal

pablogsal commented May 21, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

But I will defer to you and @pablogsal as to whether that's a good idea or not.

For the time being, let's just scope this PR to restoring the constants and let's keep the discussion open in the main issue. Also, let's wait until @Yhg1s mentions what he would prefer. Among other things I can imagine an outcome when we promote these to public interface.

AlexWaygood reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

pablogsal
pablogsal approved these changes May 21, 2023
View reviewed changes
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting review labels May 21, 2023
@pablogsal
pablogsal merged commit ffe47cb into python:main May 21, 2023
@bedevere-bot bedevere-bot removed the awaiting merge label May 21, 2023
@AlexWaygood

AlexWaygood commented May 21, 2023

Copy link
Copy Markdown
Member

For the time being, let's just scope this PR to restoring the constants and let's keep the discussion open in the main issue. Also, let's wait until @Yhg1s mentions what he would prefer. Among other things I can imagine an outcome when we promote these to public interface.

SGTM.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mgmacias95
mgmacias95 deleted the restore_tokenize branch May 21, 2023 16:11
@johnslavik johnslavik mentioned this pull request Dec 20, 2025
Deprecate the unused tokenize._compile function #143009
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@pablogsal pablogsal pablogsal approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@mgmacias95 @AlexWaygood @pablogsal @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.