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

_imaging module cleanup #8389

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Tests/test_image_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def test_embeddable(self) -> None:
home = sys.prefix.replace("\\", "\\\\")
fh.write(
f"""
#include "Python.h"
#include <Python.h>

int main(int argc, char* argv[])
{{
Expand Down
3 changes: 0 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,6 @@ def __iter__(self) -> Iterator[str]:
("disable-platform-guessing", None, "Disable platform guessing"),
("debug", None, "Debug logging"),
]
+ [("add-imaging-libs=", None, "Add libs to _imaging build")]
)

@staticmethod
Expand All @@ -358,7 +357,6 @@ def initialize_options(self) -> None:
self.disable_platform_guessing = self.check_configuration(
"platform-guessing", "disable"
)
self.add_imaging_libs = ""
build_ext.initialize_options(self)
for x in self.feature:
setattr(self, f"disable_{x}", self.check_configuration(x, "disable"))
Expand Down Expand Up @@ -855,7 +853,6 @@ def build_extensions(self) -> None:
# core library

libs: list[str | bool | None] = []
libs.extend(self.add_imaging_libs.split())
defs: list[tuple[str, str | None]] = []
if feature.get("tiff"):
libs.append(feature.get("tiff"))
Expand Down
2 changes: 1 addition & 1 deletion src/PIL/ImageTk.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def paste(self, im: Image.Image) -> None:
image = im.im
if not image.isblock() or im.mode != self.__mode:
block = Image.core.new_block(self.__mode, im.size)
image.convert2(block, image) # convert directly between buffers
image.convert2(block) # convert directly between buffers
ptr = block.ptr

_pyimagingtkcall("PyImagingPhoto", self.__photo, ptr)
Expand Down
6 changes: 1 addition & 5 deletions src/Tk/tkImaging.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,9 @@
* Set Python exception if we can't find `func_name` in `lib_handle`.
* Returns function pointer or NULL if not present.
*/

char message[100];

FARPROC func = GetProcAddress(lib_handle, func_name);
if (func == NULL) {
sprintf(message, "Cannot load function %s", func_name);
PyErr_SetString(PyExc_RuntimeError, message);
PyErr_Format(PyExc_RuntimeError, "Cannot load function %s", func_name);

Check warning on line 248 in src/Tk/tkImaging.c

View check run for this annotation

Codecov / codecov/patch

src/Tk/tkImaging.c#L248

Added line #L248 was not covered by tests
}
return func;
}
Expand Down
Loading
Loading