1. 01 Mar, 2001 2 kayıt (commit)
    • Guido van Rossum's avatar
      Two improvements to large file support: · 4f53da07
      Guido van Rossum yazdı
      - In _portable_ftell(), try fgetpos() before ftello() and ftell64().
        I ran into a situation on a 64-bit capable Linux where the C
        library's ftello() and ftell64() returned negative numbers despite
        fpos_t and off_t both being 64-bit types; fgetpos() did the right
        thing.
      
      - Define a new typedef, Py_off_t, which is either fpos_t or off_t,
        depending on which one is 64 bits.  This removes the need for a lot
        of #ifdefs later on.  (XXX Should this be moved to pyport.h?  That
        file currently seems oblivious to large fille support, so for now
        I'll leave it here where it's needed.)
      4f53da07
    • Jeremy Hylton's avatar
  2. 28 Şub, 2001 1 kayıt (commit)
  3. 27 Şub, 2001 1 kayıt (commit)
  4. 26 Şub, 2001 2 kayıt (commit)
  5. 23 Şub, 2001 1 kayıt (commit)
  6. 22 Şub, 2001 2 kayıt (commit)
  7. 18 Şub, 2001 1 kayıt (commit)
  8. 12 Şub, 2001 1 kayıt (commit)
    • Guido van Rossum's avatar
      Fix core dump whenever PyList_Reverse() was called. · b86c549c
      Guido van Rossum yazdı
      This fixes SF bug #132008, reported by Warren J. Hack.
      
      The copyright for this patch (and this patch only) belongs to CNRI, as
      part of the (yet to be issued) 1.6.1 release.
      
      This is now checked into the HEAD branch.  Tim will check in a test
      case to check for this specific bug, and an assertion in
      PyArgs_ParseTuple() to catch similar bugs in the future.
      b86c549c
  9. 03 Şub, 2001 1 kayıt (commit)
  10. 01 Şub, 2001 2 kayıt (commit)
  11. 29 Ock, 2001 5 kayıt (commit)
  12. 28 Ock, 2001 1 kayıt (commit)
  13. 25 Ock, 2001 2 kayıt (commit)
    • Jeremy Hylton's avatar
      PEP 227 implementation · 64949cb7
      Jeremy Hylton yazdı
      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 yazdı
      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
  14. 24 Ock, 2001 4 kayıt (commit)
  15. 23 Ock, 2001 2 kayıt (commit)
    • Barry Warsaw's avatar
      PyObject_Dump(): Use %p format to print the address of the pointer. · 903138f7
      Barry Warsaw yazdı
      PyGC_Dump(): Wrap this in a #ifdef WITH_CYCLE_GC.
      903138f7
    • Barry Warsaw's avatar
      A few miscellaneous helpers. · 9bf16440
      Barry Warsaw yazdı
      PyObject_Dump(): New function that is useful when debugging Python's C
      runtime.  In something like gdb it can be a pain to get some useful
      information out of PyObject*'s.  This function prints the str() of the
      object to stderr, along with the object's refcount and hex address.
      
      PyGC_Dump(): Similar to PyObject_Dump() but knows how to cast from the
      garbage collector prefix back to the PyObject* structure.
      
      [See Misc/gdbinit for some useful gdb hooks]
      
      none_dealloc(): Rather than SEGV if we accidentally decref None out of
      existance, we assign None's and NotImplemented's destructor slot to
      this function, which just calls abort().
      9bf16440
  16. 22 Ock, 2001 2 kayıt (commit)
  17. 21 Ock, 2001 2 kayıt (commit)
  18. 20 Ock, 2001 3 kayıt (commit)
    • Fredrik Lundh's avatar
      Better error message if ucnhash cannot be found (obscure attribute · f6056062
      Fredrik Lundh yazdı
      errors aren't that helpful), or doesn't contain what's expected from
      it.  Also tweaked the test script so it compiles even if ucnhash is
      missing.
      f6056062
    • Barry Warsaw's avatar
      Tim chastens: · b0e754d4
      Barry Warsaw yazdı
          Barry, that comment belongs in the code, not in the checkin msg.
          The code *used* to do this correctly (as you well know, since you
          & I went thru considerable pain to fix this the first time).
          However, because the *reason* for the convolution wasn't recorded
          in the code as a comment, somebody threw it all away the first
          time it got reworked.
      
          c-code-isn't-often-self-explanatory-ly y'rs  - tim
      
      default_3way_compare(): Stick the checkin message from 2.110 in a
      comment.
      b0e754d4
    • Barry Warsaw's avatar
      default_3way_compare(): When comparing the pointers, they must be cast · 71ff8d5d
      Barry Warsaw yazdı
      to integer types (i.e. Py_uintptr_t, our spelling of C9X's uintptr_t).
      ANSI specifies that pointer compares other than == and != to
      non-related structures are undefined.  This quiets an Insure
      portability warning.
      71ff8d5d
  19. 19 Ock, 2001 3 kayıt (commit)
    • Barry Warsaw's avatar
      Application and elaboration of patch #103305 to fix core dumps when · 0395fdd3
      Barry Warsaw yazdı
      del'ing func.func_dict.  I took the opportunity to also clean up some
      other nits with the code, namely core dumps when del'ing func_defaults
      and KeyError instead of AttributeError when del'ing a non-existant
      function attribute.
      
      Specifically,
      
      func_memberlist: Move func_dict and __dict__ into here instead of
      special casing them in the setattro and getattro methods.  I don't
      remember why I took them out of here before I first uploaded the PEP
      232 patch. :/
      
      func_getattro(): No need to special case __dict__/func_dict since
      their now in the func_memberlist and PyMember_Get() should Do The
      Right Thing (i.e. transforms NULL values into Py_None).
      
      func_setattro(): Document the intended behavior of del'ing or setting
      to None one of the special func_* attributes.  I.e.:
      
          func_code - can only be set to a code object.  It can't be del'd
          or set to None.
      
          func_defaults - can be del'd.  Can only be set to None or a tuple.
      
          func_dict - can be del'd.  Can only be set to None or a
          dictionary.
      
      Fix core dumps and incorrect exceptions as described above.  Also, if
      we're del'ing an arbitrary function attribute but func_dict is NULL,
      don't create func_dict before discovering that we'll get an
      AttributeError anyway.
      0395fdd3
    • Fredrik Lundh's avatar
      refactored the unicodeobject/ucnhash interface, to hide the · 0fdb90ca
      Fredrik Lundh yazdı
      implementation details inside the ucnhash module.
      
      also cleaned up the unicode copyright blurb a little; Secret Labs'
      internal revision history isn't that interesting...
      0fdb90ca
    • Tim Peters's avatar
      Derivative of patch #102549, "simpler, faster(!) implementation of string.join". · 19fe14e7
      Tim Peters yazdı
      Also fixes two long-standing bugs (present in 2.0):
      1. .join() didn't check that the result size fit in an int.
      2. string.join(s) when len(s)==1 returned s[0] regardless of s[0]'s
         type; e.g., "".join([3]) returned 3 (overly optimistic optimization).
      I resisted a keen temptation to make .join() apply str() automagically.
      19fe14e7
  20. 18 Ock, 2001 2 kayıt (commit)