From c670569e124e518f712ac20818f2412727b05a1b Mon Sep 17 00:00:00 2001 From: Avasam Date: Sun, 13 Oct 2024 15:11:17 -0400 Subject: [PATCH] Remove temporary `win32com.server.policy` reexports hack marked for removal over 25 years ago (#2344) --- CHANGES.txt | 2 ++ com/win32com/server/policy.py | 12 ------------ com/win32comext/axdebug/util.py | 5 +++-- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 316fee89c..0868cac2f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -14,6 +14,8 @@ https://mhammond.github.io/pywin32_installers.html. Coming in build 309, as yet unreleased -------------------------------------- +* Remove temporary `win32com.server.policy` reexports hack (#2344, @Avasam) + Import `DispatcherWin32trace` and `DispatcherTrace` from `win32com.server.dispatcher` instead. * Fixed `win32timezone.TimeZoneInfo` initialization from a `[DYNAMIC_]TIME_ZONE_INFORMATION` (#2339, @Avasam) * Added runtime deprecation warning of `win2kras`, use `win32ras` instead (#2356, @Avasam) * Improved handling of dict iterations and fallbacks (removes Python 2 support code, small general speed improvement) (#2332, #2330, @Avasam) diff --git a/com/win32com/server/policy.py b/com/win32com/server/policy.py index a907bd620..2c6bc4472 100644 --- a/com/win32com/server/policy.py +++ b/com/win32com/server/policy.py @@ -801,15 +801,3 @@ def _import_module(mname): # Eeek - result of _import_ is "win32com" - not "win32com.a.b.c" # Get the full module from sys.modules return sys.modules[mname] - - -####### -# -# Temporary hacks until all old code moves. -# -# These have been moved to a new source file, but some code may -# still reference them here. These will end up being removed. -try: - from .dispatcher import DispatcherTrace, DispatcherWin32trace -except ImportError: # Quite likely a frozen executable that doesn't need dispatchers - pass diff --git a/com/win32comext/axdebug/util.py b/com/win32comext/axdebug/util.py index f3c23523a..424c529df 100644 --- a/com/win32comext/axdebug/util.py +++ b/com/win32comext/axdebug/util.py @@ -5,6 +5,7 @@ import sys import win32api +import win32com.server.dispatcher import win32com.server.policy import win32com.server.util import winerror @@ -54,9 +55,9 @@ def RaiseNotImpl(who=None): raise COMException(scode=winerror.E_NOTIMPL) -class Dispatcher(win32com.server.policy.DispatcherWin32trace): +class Dispatcher(win32com.server.dispatcher.DispatcherWin32trace): def __init__(self, policyClass, object): - win32com.server.policy.DispatcherTrace.__init__(self, policyClass, object) + win32com.server.dispatcher.DispatcherTrace.__init__(self, policyClass, object) import win32traceutil # Sets up everything. # print(f"Object with win32trace dispatcher created ({object})")