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

Removed support for tkinter before Python 1.5.2 #6549

Merged
merged 1 commit into from Aug 30, 2022

Conversation

radarhere
Copy link
Member

Pillow/src/_imagingtk.c

Lines 26 to 28 in ad7be55

/* copied from _tkinter.c (this isn't as bad as it may seem: for new
versions, we use _tkinter's interpaddr hook instead, and all older
versions use this structure layout) */

I saw "for new versions", and wondered how long this message has been there. It turns out, it has been there since the fork from PIL.

The code is used when ImageTk catches an AttributeError, which has also been present since the fork.

try:
if hasattr(tk, "interp"):
# Required for PyPy, which always has CFFI installed
from cffi import FFI
ffi = FFI()
# PyPy is using an FFI CDATA element
# (Pdb) self.tk.interp
# <cdata 'Tcl_Interp *' 0x3061b50>
_imagingtk.tkinit(int(ffi.cast("uintptr_t", tk.interp)), 1)
else:
_imagingtk.tkinit(tk.interpaddr(), 1)
except AttributeError:
_imagingtk.tkinit(id(tk), 0)

interpaddr() added in Python 1.5.2. The last version of PIL supported Python 1.5.2, so it seems likely that the AttributeError catch was there for Python versions < 1.5.2.

We no longer support such early versions of Python, so this code can be removed.

@hugovk hugovk added the Cleanup label Aug 30, 2022
@hugovk
Copy link
Member

hugovk commented Aug 30, 2022

Wow! Here "new versions" means since April 1999, 23 years ago!

Here's where interpaddr() was committed to CPython on 29 Apr 1998:

And added to the 1.5.2 NEWS file on 11 Aug 1998:

And 1.5.2 was released on 13 April 1999:

I think we can safely drop this without a deprecation warning :)

@hugovk hugovk merged commit 9c72a6d into python-pillow:main Aug 30, 2022
@radarhere radarhere deleted the interp branch August 30, 2022 08:15
@radarhere radarhere changed the title Removed support for Python versions before interpaddr() Removed support for tkinter in Python < 1.5.2 Aug 30, 2022
@radarhere radarhere changed the title Removed support for tkinter in Python < 1.5.2 Removed support for tkinter before Python 1.5.2 Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants