Skip to content

Commit

Permalink
Merge pull request #2762 from Starbuck5/remove-pygame-threads
Browse files Browse the repository at this point in the history
Remove pygame.threads
  • Loading branch information
Starbuck5 authored Mar 28, 2024
2 parents 98fc54d + 6182c7c commit 987436c
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 558 deletions.
1 change: 0 additions & 1 deletion buildconfig/stubs/gen_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"surfarray",
"transform",
"scrap",
"threads",
"version",
"base",
"bufferproxy",
Expand Down
1 change: 0 additions & 1 deletion buildconfig/stubs/pygame/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ from pygame import (
surfarray as surfarray,
transform as transform,
scrap as scrap,
threads as threads,
version as version,
base as base,
bufferproxy as bufferproxy,
Expand Down
6 changes: 1 addition & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,6 @@ def run(self):
PACKAGEDATA = {
"cmdclass": cmdclass,
"packages": ['pygame',
'pygame.threads',
'pygame._sdl2',
'pygame.tests',
'pygame.tests.test_utils',
Expand All @@ -956,7 +955,6 @@ def run(self):
'pygame.__pyinstaller'],
"package_dir": {'pygame': 'src_py',
'pygame._sdl2': 'src_py/_sdl2',
'pygame.threads': 'src_py/threads',
'pygame.tests': 'test',
'pygame.docs': 'docs',
'pygame.examples': 'examples',
Expand All @@ -977,11 +975,9 @@ def run(self):
PACKAGEDATA = {
"cmdclass": cmdclass,
"packages": ['pygame',
'pygame.threads',
'pygame._sdl2'],
"package_dir": {'pygame': 'src_py',
'pygame._sdl2': 'src_py/_sdl2',
'pygame.threads': 'src_py/threads'},
'pygame._sdl2': 'src_py/_sdl2'},
"ext_modules": extensions,
"zip_safe": False,
"data_files": data_files
Expand Down
4 changes: 0 additions & 4 deletions src_py/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,6 @@ def Cursor(*args): # pylint: disable=unused-argument
except (ImportError, OSError):
sprite = MissingModule("sprite", urgent=1)

try:
import pygame.threads
except (ImportError, OSError):
threads = MissingModule("threads", urgent=1)

try:
import pygame.pixelcopy
Expand Down
271 changes: 0 additions & 271 deletions src_py/threads/__init__.py

This file was deleted.

12 changes: 6 additions & 6 deletions test/image_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import unittest
import glob
import pathlib
from concurrent.futures import ThreadPoolExecutor

from pygame.tests.test_utils import example_path, png, tostring
import pygame, pygame.image, pygame.pkgdata
Expand Down Expand Up @@ -1356,12 +1357,11 @@ def test_save_extended(self):
)

def threads_load(self, images):
import pygame.threads

for i in range(10):
surfs = pygame.threads.tmap(pygame.image.load, images)
for s in surfs:
self.assertIsInstance(s, pygame.Surface)
for _ in range(10):
with ThreadPoolExecutor(max_workers=20) as executor:
surfs = executor.map(pygame.image.load, images)
for s in surfs:
self.assertIsInstance(s, pygame.Surface)

def test_load_png_threads(self):
self.threads_load(glob.glob(example_path("data/*.png")))
Expand Down
Loading

0 comments on commit 987436c

Please sign in to comment.