[Python-checkins] python/dist/src/Lib inspect.py,1.52,1.53

doko at users.sourceforge.net doko at users.sourceforge.net
Sun Aug 15 19:05:05 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20414/Lib

Modified Files:
	inspect.py 
Log Message:
- Bug #891637, patch #1005466: fix inspect.getargs() crash on def foo((bar)).


Index: inspect.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v
retrieving revision 1.52
retrieving revision 1.53
diff -C2 -d -r1.52 -r1.53
*** inspect.py	13 Aug 2004 18:46:23 -0000	1.52
--- inspect.py	15 Aug 2004 17:04:32 -0000	1.53
***************
*** 625,636 ****
                      elif opname == 'STORE_FAST':
                          stack.append(names[value])
!                         remain[-1] = remain[-1] - 1
!                         while remain[-1] == 0:
!                             remain.pop()
!                             size = count.pop()
!                             stack[-size:] = [stack[-size:]]
!                             if not remain: break
                              remain[-1] = remain[-1] - 1
!                         if not remain: break
              args[i] = stack[0]
  
--- 625,644 ----
                      elif opname == 'STORE_FAST':
                          stack.append(names[value])
! 
!                         # Special case for sublists of length 1: def foo((bar))
!                         # doesn't generate the UNPACK_TUPLE bytecode, so if
!                         # `remain` is empty here, we have such a sublist.
!                         if not remain:
!                             stack[0] = [stack[0]]
!                             break
!                         else:
                              remain[-1] = remain[-1] - 1
!                             while remain[-1] == 0:
!                                 remain.pop()
!                                 size = count.pop()
!                                 stack[-size:] = [stack[-size:]]
!                                 if not remain: break
!                                 remain[-1] = remain[-1] - 1
!                             if not remain: break
              args[i] = stack[0]
  



More information about the Python-checkins mailing list