Skip to content
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

gh-128846: Add check_tk_version function to test.support #128880

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

smontanaro
Copy link
Contributor

@smontanaro smontanaro commented Jan 15, 2025

I've been burned more than once I think about mysterious test failures when my local version of Tk is newer than what's supported in Python code. This PR is an attempt to make it clearer for dummies like me why.

A couple things:

  1. I'm not sure this version check would necessarily be required for test_ttk_textonly. Belt and suspenders, I suppose.
  2. The max version number is encoded in the check_tk_version() function. That's maybe not the best place for it. Perhaps it should be a global in test/support/__init__.py instead? I didn't want to replicate it in various places.

@smontanaro
Copy link
Contributor Author

I should mention that credit for the version extraction code snippet goes to @zanieb.

@zanieb
Copy link
Contributor

zanieb commented Jan 15, 2025

Thanks :) as a note... you can use the simpler tkinter.TkVersion attribute if you don't need the patch version.

@smontanaro
Copy link
Contributor Author

... you can use the simpler tkinter.TkVersion attribute if you don't need the patch version.

I have a vague recollection of Tk changing in an incompatible (for Python, at least) when the patch/micro version was incremented. Though I might well be misremembering, I think it's probably better to be explicit in this case.

@smontanaro
Copy link
Contributor Author

Also, it occurs to me that a check like this might actually be more useful for previously released versions of Python, as support for a particular max version of Tcl/Tk is likely to freeze after release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants