[Python-checkins] CVS: python/nondist/peps pep-0280.txt,1.9,1.10

Guido van Rossum gvanrossum@users.sourceforge.net
Mon, 11 Feb 2002 07:48:53 -0800


Update of /cvsroot/python/python/nondist/peps
In directory usw-pr-cvs1:/tmp/cvs-serv26219

Modified Files:
	pep-0280.txt 
Log Message:
Also show C pseudo-code of Tim's version.


Index: pep-0280.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0280.txt,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** pep-0280.txt	11 Feb 2002 15:00:03 -0000	1.9
--- pep-0280.txt	11 Feb 2002 15:48:50 -0000	1.10
***************
*** 408,412 ****
         cell, it should go back to see if the __builtins__ dict has
         been modified (the pseudo code doesn't have this yet).  Tim's
!        alternative also takes care of this.
  
      Q. How does the new scheme get along with the restricted execution
--- 408,412 ----
         cell, it should go back to see if the __builtins__ dict has
         been modified (the pseudo code doesn't have this yet).  Tim's
!        "more aggressive" alternative also takes care of this.
  
      Q. How does the new scheme get along with the restricted execution
***************
*** 422,426 ****
      Q. What would the C code for LOAD_GLOBAL_CELL look like?
  
!     A. case LOAD_GLOBAL_CELL:
             cell = func_cells[oparg];
             x = cell->objptr;
--- 422,429 ----
      Q. What would the C code for LOAD_GLOBAL_CELL look like?
  
!     A. The first version, with the first two bullets under "Additional
!        ideas" incorporated, could look like this:
! 
!        case LOAD_GLOBAL_CELL:
             cell = func_cells[oparg];
             x = cell->objptr;
***************
*** 431,434 ****
--- 434,450 ----
                     break;
                 }
+            }
+            Py_INCREF(x);
+            continue;
+ 
+        With Tim's "more aggressive" alternative added, it could look
+        like this:
+ 
+        case LOAD_GLOBAL_CELL:
+            cell = func_cells[oparg];
+            x = cell->objptr;
+            if (x == NULL) {
+                ... error recovery ...
+                break;
             }
             Py_INCREF(x);