1. 02 Aug, 2001 1 commit
  2. 23 Jul, 2001 1 commit
  3. 16 Jul, 2001 4 commits
    • Guido van Rossum's avatar
      PyRun_StringFlags(): forgot to pass the flags on to · a1b3a474
      Guido van Rossum authored
      PyParser_SimpleParseString().  Now calls
      PyParser_SimpleParseStringFlags() with the correct flag.
      a1b3a474
    • Tim Peters's avatar
      Ugly. A pile of new xxxFlags() functions, to communicate to the parser · fe2127d3
      Tim Peters authored
      that 'yield' is a keyword.  This doesn't help test_generators at all!  I
      don't know why not.  These things do work now (and didn't before this
      patch):
      
      1. "from __future__ import generators" now works in a native shell.
      
      2. Similarly "python -i xxx.py" now has generators enabled in the
         shell if xxx.py had them enabled.
      
      3. This program (which was my doctest proxy) works fine:
      
      from __future__ import generators
      
      source = """\
      def f():
          yield 1
      """
      
      exec compile(source, "", "single") in globals()
      print type(f())
      fe2127d3
    • Tim Peters's avatar
      future.c: insert a cosmetic space. · 51d76f1f
      Tim Peters authored
      pythonrun.c, run_pyc_file():  repair semantic error wrt CO_GENERATOR vs
      CO_GENERATOR_ALLOWED.
      51d76f1f
    • Tim Peters's avatar
      Part way to allowing "from __future__ import generators" to communicate · 5ba58662
      Tim Peters authored
      that info to code dynamically compiled *by* code compiled with generators
      enabled.  Doesn't yet work because there's still no way to tell the parser
      that "yield" is OK (unlike nested_scopes, the parser has its fingers in
      this too).
      Replaced PyEval_GetNestedScopes by a more-general
      PyEval_MergeCompilerFlags.  Perhaps I should not have?  I doubted it was
      *intended* to be part of the public API, so just did.
      5ba58662
  4. 13 Jun, 2001 1 commit
  5. 26 Mar, 2001 1 commit
  6. 23 Mar, 2001 5 commits
  7. 22 Mar, 2001 1 commit
    • Jeremy Hylton's avatar
      Extend support for from __future__ import nested_scopes · bc320247
      Jeremy Hylton authored
      If a module has a future statement enabling nested scopes, they are
      also enable for the exec statement and the functions compile() and
      execfile() if they occur in the module.
      
      If Python is run with the -i option, which enters interactive mode
      after executing a script, and the script it runs enables nested
      scopes, they are also enabled in interactive mode.
      
      XXX The use of -i with -c "from __future__ import nested_scopes" is
      not supported.  What's the point?
      
      To support these changes, many function variants have been added to
      pythonrun.c.  All the variants names end with Flags and they take an
      extra PyCompilerFlags * argument.  It is possible that this complexity
      will be eliminated in a future version of the interpreter in which
      nested scopes are not optional.
      bc320247
  8. 01 Mar, 2001 1 commit
    • Jeremy Hylton's avatar
      Useful future statement support for the interactive interpreter · 9f324e96
      Jeremy Hylton authored
      (Also remove warning about module-level global decl, because we can't
      distinguish from code passed to exec.)
      
      Define PyCompilerFlags type contains a single element,
      cf_nested_scopes, that is true if a nested scopes future statement has
      been entered at the interactive prompt.
      
      New API functions:
          PyNode_CompileFlags()
          PyRun_InteractiveOneFlags()
          -- same as their non Flags counterparts except that the take an
             optional PyCompilerFlags pointer
      
      compile.c: In jcompile() use PyCompilerFlags argument.  If
          cf_nested_scopes is true, compile code with nested scopes.  If it
          is false, but the code has a valid future nested scopes statement,
          set it to true.
      
      pythonrun.c: Create a new PyCompilerFlags object in
          PyRun_InteractiveLoop() and thread it through to
          PyRun_InteractiveOneFlags().
      9f324e96
  9. 28 Feb, 2001 2 commits
    • Fred Drake's avatar
      Now that Jeremy is asking about this code, it looks really bogus to me, · b797f1f6
      Fred Drake authored
      so let's rip it out.  The constructor for SyntaxError does the right
      thing, so we do not need to do it again.
      b797f1f6
    • Jeremy Hylton's avatar
      Print the offending line of code in the traceback for SyntaxErrors · 9f1b9932
      Jeremy Hylton authored
      raised by the compiler.
      
      XXX For now, text entered into the interactive intepreter is not
      printed in the traceback.
      
      Inspired by a patch from Roman Sulzhyk
      
      compile.c:
      
      Add helper fetch_program_text() that opens a file and reads until it
      finds the specified line number.  The code is a near duplicate of
      similar code in traceback.c.
      
      Modify com_error() to pass two arguments to SyntaxError constructor,
      where the second argument contains the offending text when possible.
      
      Modify set_error_location(), now used only by the symtable pass, to
      set the text attribute on existing exceptions.
      
      pythonrun.c:
      
      Change parse_syntax_error() to continue of the offset attribute of a
      SyntaxError is None.  In this case, it sets offset to -1.
      
      Move code from PyErr_PrintEx() into helper function
      print_error_text().  In the helper, only print the caret for a
      SyntaxError if offset > 0.
      9f1b9932
  10. 17 Feb, 2001 1 commit
  11. 11 Feb, 2001 1 commit
    • Tim Peters's avatar
      Ugly fix for SF bug 131239 (-x flag busted). · 3e876565
      Tim Peters authored
      Bug was introduced by tricks played to make .pyc files executable
      via cmdline arg.  Then again, -x worked via a trick to begin with.
      If anyone can think of a portable way to test -x, be my guest!
      3e876565
  12. 02 Feb, 2001 1 commit
    • Jeremy Hylton's avatar
      Move a bunch of definitions that were internal to compile.c to · 4b38da66
      Jeremy Hylton authored
      symtable.h, so that they can be used by external module.
      
      Improve error handling in symtable_enter_scope(), which return an
      error code that went unchecked by most callers. XXX The error handling
      in symtable code is sloppy in general.
      
      Modify symtable to record the line number that begins each scope.
      This can help to identify which code block is being referred to when
      multiple blocks are bound to the same name.
      
      Add st_scopes dict that is used to preserve scope info when
      PyNode_CompileSymtable() is called.  Otherwise, this information is
      tossed as soon as it is no longer needed.
      
      Add Py_SymtableString() to pythonrun; analogous to Py_CompileString().
      4b38da66
  13. 28 Jan, 2001 1 commit
    • Tim Peters's avatar
      It's unclear whether PyMarshal_XXX() are part of the public or private API. · d9b9ac85
      Tim Peters authored
      They're named as if public, so I did a Bad Thing by changing
      PyMarshal_ReadObjectFromFile() to suck up the remainder of the file in one
      gulp:  anyone who counted on that leaving the file pointer merely at the
      end of the next object would be screwed.  So restored
      PyMarshal_ReadObjectFromFile() to its earlier state, renamed the new greedy
      code to PyMarshal_ReadLastObjectFromFile(), and changed Python internals to
      call the latter instead.
      d9b9ac85
  14. 21 Jan, 2001 1 commit
  15. 17 Jan, 2001 1 commit
  16. 05 Jan, 2001 1 commit
  17. 04 Jan, 2001 1 commit
  18. 16 Sep, 2000 1 commit
  19. 01 Sep, 2000 1 commit
  20. 31 Aug, 2000 2 commits
  21. 27 Aug, 2000 3 commits
  22. 25 Aug, 2000 1 commit
  23. 15 Aug, 2000 2 commits
  24. 22 Jul, 2000 1 commit
  25. 16 Jul, 2000 1 commit
    • Thomas Wouters's avatar
      Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in either · 7e474022
      Thomas Wouters authored
      comments, docstrings or error messages. I fixed two minor things in
      test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't").
      
      There is a minor style issue involved: Guido seems to have preferred English
      grammar (behaviour, honour) in a couple places. This patch changes that to
      American, which is the more prominent style in the source. I prefer English
      myself, so if English is preferred, I'd be happy to supply a patch myself ;)
      7e474022
  26. 11 Jul, 2000 2 commits
  27. 09 Jul, 2000 1 commit