[Python-checkins] CVS: python/dist/src/Tools/compiler dumppyc.py,1.1,1.2

Jeremy Hylton jhylton@users.sourceforge.net
Mon, 17 Sep 2001 11:08:22 -0700


Update of /cvsroot/python/python/dist/src/Tools/compiler
In directory usw-pr-cvs1:/tmp/cvs-serv4483

Modified Files:
	dumppyc.py 
Log Message:
Only print attributes that start with co_.
If passed a .py file as an argument, try to find its accompanying
.pyc.





Index: dumppyc.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/compiler/dumppyc.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** dumppyc.py	2000/10/09 14:35:24	1.1
--- dumppyc.py	2001/09/17 18:08:20	1.2
***************
*** 2,5 ****
--- 2,6 ----
  
  import marshal
+ import os
  import dis
  import types
***************
*** 8,12 ****
      print obj
      for attr in dir(obj):
!         print "\t", attr, repr(getattr(obj, attr))
  
  def loadCode(path):
--- 9,15 ----
      print obj
      for attr in dir(obj):
!         if attr.startswith('co_'):
!             val = getattr(obj, attr)
!             print "\t", attr, repr(val)
  
  def loadCode(path):
***************
*** 37,39 ****
--- 40,44 ----
          filename = sys.argv[1]
          codename = None
+     if filename.endswith('.py') and os.path.exists(filename+"c"):
+         filename += "c"
      main(filename, codename)