Current Path: > > opt > cloudlinux > > venv > > > > lib64 > python3.11 > site-packages > guppy > heapy > test
Operation : Linux host59.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64 Software : Apache Server IP : 198.54.126.42 | Your IP: 216.73.216.135 Domains : 1034 Domain(s) Permission : [ 0755 ]
Name | Type | Size | Last Modified | Actions |
---|---|---|---|---|
__pycache__ | Directory | - | - | |
__init__.py | File | 47 bytes | April 17 2025 13:10:58. | |
support.py | File | 3814 bytes | April 17 2025 13:10:58. | |
test_Classifiers.py | File | 29059 bytes | April 17 2025 13:10:58. | |
test_ER.py | File | 12858 bytes | April 17 2025 13:10:58. | |
test_OutputHandling.py | File | 1376 bytes | April 17 2025 13:10:58. | |
test_Part.py | File | 10398 bytes | April 17 2025 13:10:58. | |
test_Path.py | File | 29516 bytes | April 17 2025 13:10:58. | |
test_RefPat.py | File | 17156 bytes | April 17 2025 13:10:58. | |
test_RetaGraph.py | File | 95 bytes | April 17 2025 13:10:58. | |
test_Spec.py | File | 351 bytes | April 17 2025 13:10:58. | |
test_UniSet.py | File | 1241 bytes | April 17 2025 13:10:58. | |
test_View.py | File | 8180 bytes | April 17 2025 13:10:58. | |
test_all.py | File | 682 bytes | April 17 2025 13:10:58. | |
test_dependencies.py | File | 214 bytes | April 17 2025 13:10:58. | |
test_gsl.py | File | 421 bytes | April 17 2025 13:10:58. | |
test_heapyc.py | File | 15972 bytes | April 17 2025 13:10:58. | |
test_menuleak.py | File | 3196 bytes | April 17 2025 13:10:58. | |
test_sf.py | File | 583 bytes | April 17 2025 13:10:58. |
from tkinter import * import sys import gc class FixedMenu(Menu): # A fix for the .delete() method in Menu. # To delete commands defined in the menu items deleted. # Also changed the comment: INDEX2 is actually INCLUDED. def delete(self, index1, index2=None): """Delete menu items between INDEX1 and INDEX2 (included).""" print(self._tclCommands) if index2 is None: index2 = index1 # First find out what entries have defined commands. cmds = [] for i in range(self.index(index1), self.index(index2)+1): c = str(self.entrycget(i, 'command')) if c in self._tclCommands: # I don't want to delete the command already, since it # seems mystical to do that while the entry is not yet deleted. cmds.append(c) # Delete the menu entries. self.tk.call(self._w, 'delete', index1, index2) # Now that the menu entries have been deleted, we can delete their commands. for c in cmds: self.deletecommand(c) def test1(M): # Test with a single command gc.collect() root = Tk() button = Menubutton(root, text='Window') menu = M(button) button['menu'] = menu def command(): print('command button pressed') rc = sys.getrefcount(command) menu.add_command(command=command) # or add_radiobutton etc idx = menu.index(END) menu.delete(idx) gc.collect() rc1 = sys.getrefcount(command) print('leak test with class', M, end=' ') if rc1 != rc: print('failed: command is now hold by', rc1, 'references') else: print('succeeded: command is now hold by', rc1, 'references') root.destroy() def test2(M): # Test with 3 commands, especially to see that deleting a range works. gc.collect() root = Tk() button = Menubutton(root, text='Window') menu = M(button) button['menu'] = menu def command0(): print('command 0 button pressed') 'deleting 0 and 1' menu.delete(idx0, idx1) def command1(): print('command 1 button pressed') def command2(): print('command 2 button pressed') print('deleting at END') menu.delete(END) root.quit() rc = [sys.getrefcount(x) for x in (command0, command1, command0)] button.pack() # or add_radiobutton etc menu.add_command(command=command0, label='press first') idx0 = menu.index(END) menu.add_radiobutton(command=command1, label='command1') # to see that delete works even when no command supplied menu.add_command(label='no Command') idx1 = menu.index(END) menu.add_command(command=command2, label='press last') idx2 = menu.index(END) root.mainloop() gc.collect() rc1 = [sys.getrefcount(x) for x in (command0, command1, command0)] print('leak test with class', M, end=' ') if rc1 != rc: print('failed: command is now hold by', rc1, 'references, should be', rc) else: print('succeeded: command is now hold by', rc1, 'references') root.destroy() for M in (Menu, FixedMenu,): test1(M) test2(M)
SILENT KILLER Tool