mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-25 00:34:14 +03:00
Remove support for Tk/Tcl <= 8.4, deprecated in 8.2.0
This commit is contained in:
parent
59c9d87f8a
commit
070e770469
|
@ -12,14 +12,6 @@ Deprecated features
|
|||
Below are features which are considered deprecated. Where appropriate,
|
||||
a ``DeprecationWarning`` is issued.
|
||||
|
||||
Tk/Tcl 8.4
|
||||
~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 8.2.0
|
||||
|
||||
Support for Tk/Tcl 8.4 is deprecated and will be removed in Pillow 10.0.0 (2023-07-01),
|
||||
when Tk/Tcl 8.5 will be the minimum supported.
|
||||
|
||||
Categories
|
||||
~~~~~~~~~~
|
||||
|
||||
|
@ -210,6 +202,14 @@ Removed features
|
|||
Deprecated features are only removed in major releases after an appropriate
|
||||
period of deprecation has passed.
|
||||
|
||||
Tk/Tcl 8.4
|
||||
~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 8.2.0
|
||||
.. versionremoved:: 10.0.0
|
||||
|
||||
Support for Tk/Tcl 8.4 was removed in Pillow 10.0.0 (2023-07-01).
|
||||
|
||||
PyQt5 and PySide2
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@ import sys
|
|||
import tkinter
|
||||
from tkinter import _tkinter as tk
|
||||
|
||||
from ._deprecate import deprecate
|
||||
|
||||
try:
|
||||
if hasattr(sys, "pypy_find_executable"):
|
||||
TKINTER_LIB = tk.tklib_cffi.__file__
|
||||
|
@ -17,7 +15,3 @@ except AttributeError:
|
|||
TKINTER_LIB = None
|
||||
|
||||
tk_version = str(tkinter.TkVersion)
|
||||
if tk_version == "8.4":
|
||||
deprecate(
|
||||
"Support for Tk/Tcl 8.4", 10, action="Please upgrade to Tk/Tcl 8.5 or newer"
|
||||
)
|
||||
|
|
|
@ -119,17 +119,7 @@ typedef struct Tk_PhotoImageBlock {
|
|||
} Tk_PhotoImageBlock;
|
||||
|
||||
/* Typedefs derived from function signatures in Tk header */
|
||||
/* Tk_PhotoPutBlock for Tk <= 8.4 */
|
||||
typedef void (*Tk_PhotoPutBlock_84_t)(
|
||||
Tk_PhotoHandle handle,
|
||||
Tk_PhotoImageBlock *blockPtr,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
int compRule);
|
||||
/* Tk_PhotoPutBlock for Tk >= 8.5 */
|
||||
typedef int (*Tk_PhotoPutBlock_85_t)(
|
||||
typedef int (*Tk_PhotoPutBlock_t)(
|
||||
Tcl_Interp *interp,
|
||||
Tk_PhotoHandle handle,
|
||||
Tk_PhotoImageBlock *blockPtr,
|
||||
|
@ -138,8 +128,6 @@ typedef int (*Tk_PhotoPutBlock_85_t)(
|
|||
int width,
|
||||
int height,
|
||||
int compRule);
|
||||
/* Tk_PhotoSetSize for Tk <= 8.4 */
|
||||
typedef void (*Tk_PhotoSetSize_84_t)(Tk_PhotoHandle handle, int width, int height);
|
||||
/* Tk_FindPhoto */
|
||||
typedef Tk_PhotoHandle (*Tk_FindPhoto_t)(Tcl_Interp *interp, const char *imageName);
|
||||
/* Tk_PhotoGetImage */
|
||||
|
|
|
@ -48,14 +48,11 @@
|
|||
* Global vars for Tcl / Tk functions. We load these symbols from the tkinter
|
||||
* extension module or loaded Tcl / Tk libraries at run-time.
|
||||
*/
|
||||
static int TK_LT_85 = 0;
|
||||
static Tcl_CreateCommand_t TCL_CREATE_COMMAND;
|
||||
static Tcl_AppendResult_t TCL_APPEND_RESULT;
|
||||
static Tk_FindPhoto_t TK_FIND_PHOTO;
|
||||
static Tk_PhotoGetImage_t TK_PHOTO_GET_IMAGE;
|
||||
static Tk_PhotoPutBlock_84_t TK_PHOTO_PUT_BLOCK_84;
|
||||
static Tk_PhotoSetSize_84_t TK_PHOTO_SET_SIZE_84;
|
||||
static Tk_PhotoPutBlock_85_t TK_PHOTO_PUT_BLOCK_85;
|
||||
static Tk_PhotoPutBlock_t TK_PHOTO_PUT_BLOCK;
|
||||
|
||||
static Imaging
|
||||
ImagingFind(const char *name) {
|
||||
|
@ -130,26 +127,15 @@ PyImagingPhotoPut(
|
|||
block.pitch = im->linesize;
|
||||
block.pixelPtr = (unsigned char *)im->block;
|
||||
|
||||
if (TK_LT_85) { /* Tk 8.4 */
|
||||
TK_PHOTO_PUT_BLOCK_84(
|
||||
photo, &block, 0, 0, block.width, block.height, TK_PHOTO_COMPOSITE_SET);
|
||||
if (strcmp(im->mode, "RGBA") == 0) {
|
||||
/* Tk workaround: we need apply ToggleComplexAlphaIfNeeded */
|
||||
/* (fixed in Tk 8.5a3) */
|
||||
TK_PHOTO_SET_SIZE_84(photo, block.width, block.height);
|
||||
}
|
||||
} else {
|
||||
/* Tk >=8.5 */
|
||||
TK_PHOTO_PUT_BLOCK_85(
|
||||
interp,
|
||||
photo,
|
||||
&block,
|
||||
0,
|
||||
0,
|
||||
block.width,
|
||||
block.height,
|
||||
TK_PHOTO_COMPOSITE_SET);
|
||||
}
|
||||
TK_PHOTO_PUT_BLOCK(
|
||||
interp,
|
||||
photo,
|
||||
&block,
|
||||
0,
|
||||
0,
|
||||
block.width,
|
||||
block.height,
|
||||
TK_PHOTO_COMPOSITE_SET);
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
@ -290,16 +276,7 @@ get_tk(HMODULE hMod) {
|
|||
if ((TK_FIND_PHOTO = (Tk_FindPhoto_t)_dfunc(hMod, "Tk_FindPhoto")) == NULL) {
|
||||
return -1;
|
||||
};
|
||||
TK_LT_85 = GetProcAddress(hMod, "Tk_PhotoPutBlock_Panic") == NULL;
|
||||
/* Tk_PhotoPutBlock_Panic defined as of 8.5.0 */
|
||||
if (TK_LT_85) {
|
||||
TK_PHOTO_PUT_BLOCK_84 = (Tk_PhotoPutBlock_84_t)func;
|
||||
return ((TK_PHOTO_SET_SIZE_84 =
|
||||
(Tk_PhotoSetSize_84_t)_dfunc(hMod, "Tk_PhotoSetSize")) == NULL)
|
||||
? -1
|
||||
: 1;
|
||||
}
|
||||
TK_PHOTO_PUT_BLOCK_85 = (Tk_PhotoPutBlock_85_t)func;
|
||||
TK_PHOTO_PUT_BLOCK = (Tk_PhotoPutBlock_t)func;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -422,18 +399,9 @@ _func_loader(void *lib) {
|
|||
if ((TK_FIND_PHOTO = (Tk_FindPhoto_t)_dfunc(lib, "Tk_FindPhoto")) == NULL) {
|
||||
return 1;
|
||||
}
|
||||
/* Tk_PhotoPutBlock_Panic defined as of 8.5.0 */
|
||||
TK_LT_85 = (dlsym(lib, "Tk_PhotoPutBlock_Panic") == NULL);
|
||||
if (TK_LT_85) {
|
||||
return (
|
||||
((TK_PHOTO_PUT_BLOCK_84 =
|
||||
(Tk_PhotoPutBlock_84_t)_dfunc(lib, "Tk_PhotoPutBlock")) == NULL) ||
|
||||
((TK_PHOTO_SET_SIZE_84 =
|
||||
(Tk_PhotoSetSize_84_t)_dfunc(lib, "Tk_PhotoSetSize")) == NULL));
|
||||
}
|
||||
return (
|
||||
(TK_PHOTO_PUT_BLOCK_85 =
|
||||
(Tk_PhotoPutBlock_85_t)_dfunc(lib, "Tk_PhotoPutBlock")) == NULL);
|
||||
(TK_PHOTO_PUT_BLOCK =
|
||||
(Tk_PhotoPutBlock_t)_dfunc(lib, "Tk_PhotoPutBlock")) == NULL);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
Loading…
Reference in New Issue
Block a user