-
Notifications
You must be signed in to change notification settings - Fork 851
Cleanup win32comext.axdebug
#2126
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cae38cd
Cleanup win32comext.axdebug
Avasam a041c13
Ran format_all.bat
Avasam 792e0ad
axdebug string formatting
Avasam dfce13c
Merge branch 'main' of https://github.com/mhammond/pywin32 into clean…
Avasam bc4ecf8
post-merge improvements
Avasam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,10 +3,9 @@ | |
|
|
||
| import pythoncom | ||
| import win32api | ||
| import win32com.server.util | ||
| import winerror | ||
| from win32com.axdebug import adb, axdebug, codecontainer, gateways | ||
| from win32com.axdebug.util import trace | ||
| from win32com.axdebug import codecontainer, gateways | ||
| from win32com.axdebug.util import _wrap, trace | ||
| from win32com.server.exception import Exception | ||
|
|
||
|
|
||
|
|
@@ -24,8 +23,10 @@ def ReleaseConnection(self, extconn, reserved, fLastReleaseCloses): | |
| return self.numExtRefs | ||
|
|
||
|
|
||
| # externalConnectionManager = ExternalConnection() | ||
| # wrappedExternalConnectionManager = _wrap(externalConnectionManager, pythoncom.IID_IExternalConnection) | ||
| externalConnectionManager = ExternalConnection() | ||
| wrappedExternalConnectionManager = _wrap( | ||
| externalConnectionManager, pythoncom.IID_IExternalConnection | ||
| ) | ||
|
|
||
|
|
||
| def DelegatedExternalConnectionQI(iid): | ||
|
|
@@ -47,9 +48,7 @@ def _query_interface_(self, iid): | |
| from win32com.util import IIDToInterfaceName | ||
|
|
||
| trace( | ||
| "PySourceModuleDebugDocumentHost QI with {} ({})".format( | ||
| IIDToInterfaceName(iid), str(iid) | ||
| ) | ||
| f"PySourceModuleDebugDocumentHost QI with {IIDToInterfaceName(iid)} ({iid})" | ||
| ) | ||
| return 0 | ||
|
|
||
|
|
@@ -58,7 +57,7 @@ def _GetCodeContainer(self): | |
| try: | ||
| codeText = open(self.module.__file__, "rt").read() | ||
| except OSError as details: | ||
| codeText = "# Exception opening file\n# %s" % (details) | ||
| codeText = f"# Exception opening file\n# {details}" | ||
|
|
||
| self.codeContainer = codecontainer.SourceCodeContainer( | ||
| codeText, self.module.__file__ | ||
|
|
@@ -96,71 +95,25 @@ def GetPathName(self): | |
| try: | ||
| return win32api.GetFullPathName(self.module.__file__), 1 | ||
| except (AttributeError, win32api.error): | ||
| raise Exception(scode == E_FAIL) | ||
| raise Exception(scode=winerror.E_FAIL) | ||
|
|
||
| def GetFileName(self): | ||
| # Result is a string with just the name of the document, no path information. | ||
| trace("GetFileName") | ||
| return os.path.split(module.__file__) | ||
| return os.path.split(self.module.__file__) | ||
|
|
||
| def NotifyChanged(): | ||
| trace("NotifyChanged") | ||
| raise Exception(scode=winerror.E_NOTIMPL) | ||
|
|
||
|
|
||
| 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") | ||
|
|
||
|
|
||
|
Comment on lines
-111
to
-156
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| def TestSmartProvider(): | ||
| import ttest | ||
| from win32com.axdebug import debugger | ||
|
|
||
| d = debugger.AXDebugger() | ||
| # d.StartDebugger() | ||
| # d.Attach() | ||
| # d.StartDebugger() | ||
| # d.Attach() | ||
| d.Break() | ||
| input("Waiting...") | ||
| ttest.test() | ||
|
|
@@ -170,22 +123,13 @@ def TestSmartProvider(): | |
|
|
||
| def test(): | ||
| try: | ||
| # app = TestSmartHelper() | ||
| app = TestSmartProvider() | ||
| # app = testdumb() | ||
| except: | ||
| traceback.print_exc() | ||
|
|
||
|
|
||
| # _wrap_remove(externalConnectionManager) | ||
| # wrappedExternalConnectionManager = None | ||
|
|
||
| if __name__ == "__main__": | ||
| test() | ||
| import win32com.axdebug.util | ||
|
|
||
| win32com.axdebug.util._dump_wrapped() | ||
| print( | ||
| " %d/%d com objects still alive" | ||
| % (pythoncom._GetInterfaceCount(), pythoncom._GetGatewayCount()) | ||
| f" {pythoncom._GetInterfaceCount()}/{pythoncom._GetGatewayCount()} com objects still alive" | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.