1. 25 Jan, 2001 26 commits
    • Jeremy Hylton's avatar
      PEP 227 implementation · 619eea68
      Jeremy Hylton authored
      test_new: new.code() noew takes two more arguments
      test_grammer: Add a bunch of test cases for lambda (not really PEP 227 related)
      619eea68
    • Jeremy Hylton's avatar
      PEP 227 implementation · 4588c78f
      Jeremy Hylton authored
      New tests cases for nested scopes.
      4588c78f
    • Jeremy Hylton's avatar
      In subst_vars(), change the name of the argument from str to s to · 5e2d0764
      Jeremy Hylton authored
      prevent binding for str from masking use of builtin str in nested
      function.
      
      (This is the only case I found in the standard library where a local
      shadows a global or builtin.  There may be others, but the regression
      test doesn't catch them.)
      5e2d0764
    • Jeremy Hylton's avatar
      PEP 227 implementation · a39414b1
      Jeremy Hylton authored
      Track changes to new opcodes.  Add hasfree list that applies to all
      ops that use the closure.
      a39414b1
    • Jeremy Hylton's avatar
      PEP 227 implementation · 903f654a
      Jeremy Hylton authored
      Track changes to PyFrame_New() and PyFuntion_New().
      903f654a
    • Neil Schemenauer's avatar
    • Jeremy Hylton's avatar
      PEP 227 implementation · 64949cb7
      Jeremy Hylton authored
      The majority of the changes are in the compiler.  The mainloop changes
      primarily to implement the new opcodes and to pass a function's
      closure to eval_code2().  Frames and functions got new slots to hold
      the closure.
      
      Include/compile.h
          Add co_freevars and co_cellvars slots to code objects.
          Update PyCode_New() to take freevars and cellvars as arguments
      Include/funcobject.h
          Add func_closure slot to function objects.
          Add GetClosure()/SetClosure() functions (and corresponding
          macros) for getting at the closure.
      Include/frameobject.h
          PyFrame_New() now takes a closure.
      Include/opcode.h
          Add four new opcodes: MAKE_CLOSURE, LOAD_CLOSURE, LOAD_DEREF,
          STORE_DEREF.
          Remove comment about old requirement for opcodes to fit in 7
          bits.
      compile.c
          Implement changes to code objects for co_freevars and co_cellvars.
      
          Modify symbol table to use st_cur_name (string object for the name
          of the current scope) and st_cur_children (list of nested blocks).
          Also define st_nested, which might more properly be called
          st_cur_nested.  Add several DEF_XXX flags to track def-use
          information for free variables.
      
          New or modified functions of note:
          com_make_closure(struct compiling *, PyCodeObject *)
              Emit LOAD_CLOSURE opcodes as needed to pass cells for free
              variables into nested scope.
          com_addop_varname(struct compiling *, int, char *)
              Emits opcodes for LOAD_DEREF and STORE_DEREF.
          get_ref_type(struct compiling *, char *name)
              Return NAME_CLOSURE if ref type is FREE or CELL
          symtable_load_symbols(struct compiling *)
              Decides what variables are cell or free based on def-use info.
              Can now raise SyntaxError if nested scopes are mixed with
              exec or from blah import *.
          make_scope_info(PyObject *, PyObject *, int, int)
              Helper functions for symtable scope stack.
          symtable_update_free_vars(struct symtable *)
              After a code block has been analyzed, it must check each of
              its children for free variables that are not defined in the
              block.  If a variable is free in a child and not defined in
              the parent, then it is defined by block the enclosing the
              current one or it is a global.  This does the right logic.
          symtable_add_use() is now a macro for symtable_add_def()
          symtable_assign(struct symtable *, node *)
              Use goto instead of for (;;)
      
          Fixed bug in symtable where name of keyword argument in function
          call was treated as assignment in the scope of the call site. Ex:
              def f():
                  g(a=2) # a was considered a local of f
      
      ceval.c
          eval_code2() now take one more argument, a closure.
          Implement LOAD_CLOSURE, LOAD_DEREF, STORE_DEREF, MAKE_CLOSURE>
      
          Also: When name error occurs for global variable, report that the
          name was global in the error mesage.
      
      Objects/frameobject.c
          Initialize f_closure to be a tuple containing space for cellvars
          and freevars.  f_closure is NULL if neither are present.
      Objects/funcobject.c
          Add support for func_closure.
      Python/import.c
          Change the magic number.
      Python/marshal.c
          Track changes to code objects.
      64949cb7
    • Jeremy Hylton's avatar
      PEP 227 implementation · fbd849f2
      Jeremy Hylton authored
      A cell contains a reference to a single PyObject.  It could be
      implemented as a mutable, one-element sequence, but the separate type
      has less overhead.
      fbd849f2
    • Jack Jansen's avatar
      c34a5ade
    • Fred Drake's avatar
      Add bzip2 archives back to the set of generated archives; we had way too · 88634604
      Fred Drake authored
      many reasonable requests to keep them around.
      
      Bump version number.
      88634604
    • Fred Drake's avatar
      Removed references to Python 1.5.3; that was a "tentative" number I used · 29052482
      Fred Drake authored
      in the docs to indicate the next version before we decided on 1.6.
      
      Adjusted winsound.Beep() description slightly as well.
      29052482
    • Fred Drake's avatar
      Update link to LaTeX2HTML web site. · cf069da5
      Fred Drake authored
      cf069da5
    • Jeremy Hylton's avatar
      add extra tests to verify that co_varnames is being set up properly · 92e9f29a
      Jeremy Hylton authored
      also normalize checks for syntax errors and delete commented out
      definition of verify.
      92e9f29a
    • Jeremy Hylton's avatar
      Fix bug reported by Ka-Ping Yee: The compiler botched parsing function · a6ebc484
      Jeremy Hylton authored
      parameters that contained both anonymous tuples and *arg or **arg. Ex:
      def f(a, (b, c), *d): pass
      
      Fix the symtable_params() to generate names in the right order for
      co_varnames slot of code object.  Consider *arg and **arg before the
      "complex" names introduced by anonymous tuples.
      a6ebc484
    • Jack Jansen's avatar
      ucnhash module has gone. · 41eb3c7d
      Jack Jansen authored
      41eb3c7d
    • Jack Jansen's avatar
      4ff2fe7e
    • Skip Montanaro's avatar
      added a few more __all__ lists · 03d90149
      Skip Montanaro authored
      test___all__.py: fail silently in check_all if the module can't be imported
      03d90149
    • Skip Montanaro's avatar
      fail more completely by deleting dbhash from sys.modules if bsddb can't be · 438bb947
      Skip Montanaro authored
      loaded - prevents second import later from succeeding spuriously - mostly of
      use in regression tests where the module might get imported more than once
      438bb947
    • Sjoerd Mullender's avatar
      Let's keep things portable to non GCC compilers, please. · 82e00d63
      Sjoerd Mullender authored
      You can only use mult-line strings in C if each line ends in \.
      82e00d63
    • Tim Peters's avatar
    • Tim Peters's avatar
      Fix bugs introduced by rewrite (in particular, time-based initialization · d52269bf
      Tim Peters authored
      got broken).  Also added new method .jumpahead(N).  This finally gives us
      a semi-decent answer to how Python's RNGs can be used safely and efficiently
      in multithreaded programs (although it requires the user to use the new
      machinery!).
      d52269bf
    • Tim Peters's avatar
      Reworked random.py so that it no longer depends on, and offers all the · d7b5e88e
      Tim Peters authored
      functionality of, whrandom.py.  Also closes all the "XXX" todos in
      random.py.  New frequently-requested functions/methods getstate() and
      setstate().  All exported functions are now bound methods of a hidden
      instance.  Killed all unintended exports.  Updated the docs.
      FRED:  The more I fiddle the docs, the less I understand the exact
      intended use of the \var, \code, \method tags.  Please review critically.
      GUIDO:  See email.  I updated NEWS as if whrandom were deprecated; I
      think it should be.
      d7b5e88e
    • Barry Warsaw's avatar
      83125775
    • Barry Warsaw's avatar
      Fixed a bug where \& was needed. · 21f37e1b
      Barry Warsaw authored
      21f37e1b
    • Barry Warsaw's avatar
      Provide a much better (and complete!) description of the lockf() · 8ee1a4bd
      Barry Warsaw authored
      function, based on an eyeballing of the code.
      8ee1a4bd
    • Barry Warsaw's avatar
      lockf_doc: a much better description of the lockf() function, based on · bd3dc1f0
      Barry Warsaw authored
      an eyeballing of the code.
      bd3dc1f0
  2. 24 Jan, 2001 14 commits