mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	fix dis on new style classes #8310
This commit is contained in:
		
							parent
							
								
									6f65d2dd1b
								
							
						
					
					
						commit
						76a23c17bc
					
				
					 2 changed files with 6 additions and 4 deletions
				
			
		|  | @ -10,6 +10,9 @@ | |||
|            "findlinestarts", "findlabels"] + _opcodes_all | ||||
| del _opcodes_all | ||||
| 
 | ||||
| _have_code = (types.MethodType, types.FunctionType, types.CodeType, | ||||
|               types.ClassType, type) | ||||
| 
 | ||||
| def dis(x=None): | ||||
|     """Disassemble classes, methods, functions, or code. | ||||
| 
 | ||||
|  | @ -29,10 +32,7 @@ def dis(x=None): | |||
|         items = x.__dict__.items() | ||||
|         items.sort() | ||||
|         for name, x1 in items: | ||||
|             if isinstance(x1, (types.MethodType, | ||||
|                                types.FunctionType, | ||||
|                                types.CodeType, | ||||
|                                types.ClassType)): | ||||
|             if isinstance(x1, _have_code): | ||||
|                 print "Disassembly of %s:" % name | ||||
|                 try: | ||||
|                     dis(x1) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Benjamin Peterson
						Benjamin Peterson