Skip to content

Cleanup win32comext.axdebug#2126

Merged
mhammond merged 5 commits intomhammond:mainfrom
Avasam:cleanup-axdebug
Nov 1, 2023
Merged

Cleanup win32comext.axdebug#2126
mhammond merged 5 commits intomhammond:mainfrom
Avasam:cleanup-axdebug

Conversation

@Avasam
Copy link
Copy Markdown
Collaborator

@Avasam Avasam commented Sep 22, 2023

This is the combination of the following changes, but scoped specifically to the win32comext.axdebug module:

Merging this first will reduce changes everywhere else.
Non-obvious changes are clarified in comments.

Comment on lines -112 to -156
def TestSmartHelper():
pdm = pythoncom.CoCreateInstance(
axdebug.CLSID_ProcessDebugManager,
None,
pythoncom.CLSCTX_ALL,
axdebug.IID_IProcessDebugManager,
)
app = pdm.CreateApplication()
app.SetName("Python Process")

pydebugger = adb.Debugger()

nodes = BuildModuleTree()

all_real_nodes = CreateDebugDocumentHelperNodes(pdm, app, nodes)
root = app.GetRootNode()
AttachParentNodes(root, nodes, all_real_nodes)

pydebugger.AttachApp(app)
cookie = pdm.AddApplication(app)
input("Waiting...")
ttest.test()

pdm.RemoveApplication(cookie)
print("Done")


def testdumb():
pdm = pythoncom.CoCreateInstance(
axdebug.CLSID_ProcessDebugManager,
None,
pythoncom.CLSCTX_ALL,
axdebug.IID_IProcessDebugManager,
)
app = pdm.GetDefaultApplication()

nodes = BuildModuleTree()
all_real_nodes = CreateDebugDocumentHelperNodes(pdm, app, nodes)
AttachParentNodes(None, nodes, all_real_nodes)

parentNode = None
all_real_nodes = {}
input("Waiting...")
print("Done")


Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were commented out in the caller code (so it's unused) and contain a bunch of undefined names / unbound variables that I can't find anywhere.
If you still think it's worth keeping around, I'll comment them out instead.

Comment on lines -12 to -17
from win32com.axdebug import axdebug
from win32com.axdebug import axdebug, contexts
from win32com.axdebug.util import _wrap
from win32com.server.exception import Exception

from . import contexts
from .util import RaiseNotImpl, _wrap

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS E:\Users\Avasam\Documents\Git\pywin32\com\win32comext\axdebug> python codecontainer.py
Traceback (most recent call last):
  File "E:\Users\Avasam\Documents\Git\pywin32\com\win32comext\axdebug\codecontainer.py", line 19, in <module>
    from . import contexts
ImportError: attempted relative import with no known parent package

Comment on lines -256 to +255
sys.path.append(".")
import ttest
from Test import ttest
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested running this script from both pywin32\com\win32comext\axdebug and pywin32\com\win32comext\axdebug\Test. With this change, it finds the module in both cases.



class DebugDocumentText(gateways.DebugDocumentInfo, gateways.DebugDocumentText):
class DebugDocumentText(gateways.DebugDocumentText):
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MRO issue, #2071 did not do enough

>>> import win32comext.axdebug.documents
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\Python39\lib\site-packages\win32comext\axdebug\documents.py", line 37, in <module>
    class DebugDocumentText(
TypeError: Cannot create a consistent method resolution
order (MRO) for bases DebugDocumentInfo, DebugDocumentText

from win32com.server.util import unwrap

print("Wrapped items:")
for key, items in all_wrapped.items():
Copy link
Copy Markdown
Collaborator Author

@Avasam Avasam Sep 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing ever modifies all_wrapped. Meaning this code likely does nothing.

Comment thread Pythonwin/pywin/framework/editor/color/coloreditor.py
Comment thread Pythonwin/pywin/framework/editor/configui.py
Comment thread Pythonwin/pywin/framework/editor/editor.py Outdated
Copy link
Copy Markdown
Owner

@mhammond mhammond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mhammond mhammond merged commit ea43be2 into mhammond:main Nov 1, 2023
@Avasam Avasam deleted the cleanup-axdebug branch November 1, 2023 19:42
@Avasam Avasam added the ActiveX label Apr 10, 2025
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.

2 participants