1. 28 Şub, 2001 1 kayıt (commit)
  2. 29 Ock, 2001 1 kayıt (commit)
    • Moshe Zadka's avatar
      The one thing I love more then writing code is deleting code. · 497671e0
      Moshe Zadka yazdı
      * Removed func_hash and func_compare, so they can be treated as immutable
        content-less objects (address hash and comparison)
      * Added tests to that affect to test_funcattrs (also testing func_code
        is writable)
      * Reverse meaning of tests in test_opcodes which checked identical code
        gets identical functions
      497671e0
  3. 25 Ock, 2001 1 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
  4. 19 Ock, 2001 1 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
  5. 15 Ock, 2001 1 kayıt (commit)
    • Barry Warsaw's avatar
      Committing PEP 232, function attribute feature, approved by Guido. · d6a9e84c
      Barry Warsaw yazdı
      Closes SF patch #103123.
      
      funcobject.h:
      
          PyFunctionObject: add the func_dict slot.
      
      funcobject.c:
      
          PyFunction_New(): Initialize the func_dict slot to NULL.
      
          func_getattr(): Rename to func_getattro() and change the
          signature.  It's more efficient to use attro methods and dig the C
          string out than it is to re-convert a C string to a PyString.
      
          Also, add support for getting the __dict__ (a.k.a. func_dict)
          attribute, and for getting an arbitrary function attribute.
      
          func_setattr(): Rename to func_setattro() and change the signature
          for the same reason.  Also add support for setting __dict__
          (a.k.a. func_dict) and any arbitrary function attribute.
      
          func_dealloc(): Be sure to DECREF the func_dict slot.
      
          func_traverse(): Be sure to traverse func_dict too.
      
          PyFunction_Type: make the necessary func_?etattro() changes.
      
      classobject.c:
      
          instancemethod_memberlist: Add __dict__
      
          instancemethod_setattro(): New method to set arbitrary attributes
          on methods (really the underlying im_func).  Raise TypeError when
          the instance is bound or when you're trying to set one of the
          reserved im_* attributes.
      
          instancemethod_getattr(): Renamed to instancemethod_getattro()
          since that's what it really is.  Also, added support fo getting
          arbitrary attributes through the im_func.
      
          PyMethod_Type: Do the ?etattr{,o} dance.
      d6a9e84c
  6. 01 Eyl, 2000 1 kayıt (commit)
  7. 09 Tem, 2000 1 kayıt (commit)
  8. 01 Tem, 2000 1 kayıt (commit)
  9. 30 Haz, 2000 4 kayıt (commit)
    • Guido van Rossum's avatar
      Change copyright notice - 2nd try. · ffcc3813
      Guido van Rossum yazdı
      ffcc3813
    • Guido van Rossum's avatar
      Change copyright notice. · fd71b9e9
      Guido van Rossum yazdı
      fd71b9e9
    • Fred Drake's avatar
      Trent Mick <trentm@activestate.com>: · a44d353e
      Fred Drake yazdı
      The common technique for printing out a pointer has been to cast to a long
      and use the "%lx" printf modifier. This is incorrect on Win64 where casting
      to a long truncates the pointer. The "%p" formatter should be used instead.
      
      The problem as stated by Tim:
      > Unfortunately, the C committee refused to define what %p conversion "looks
      > like" -- they explicitly allowed it to be implementation-defined. Older
      > versions of Microsoft C even stuck a colon in the middle of the address (in
      > the days of segment+offset addressing)!
      
      The result is that the hex value of a pointer will maybe/maybe not have a 0x
      prepended to it.
      
      
      Notes on the patch:
      
      There are two main classes of changes:
      - in the various repr() functions that print out pointers
      - debugging printf's in the various thread_*.h files (these are why the
      patch is large)
      
      
      Closes SourceForge patch #100505.
      a44d353e
    • Jeremy Hylton's avatar
  10. 29 Haz, 2000 1 kayıt (commit)
    • Fred Drake's avatar
      This patch addresses two main issues: (1) There exist some non-fatal · 13634cf7
      Fred Drake yazdı
      errors in some of the hash algorithms. For exmaple, in float_hash and
      complex_hash a certain part of the value is not included in the hash
      calculation. See Tim's, Guido's, and my discussion of this on
      python-dev in May under the title "fix float_hash and complex_hash for
      64-bit *nix"
      
      (2) The hash algorithms that use pointers (e.g. func_hash, code_hash)
      are universally not correct on Win64 (they assume that sizeof(long) ==
      sizeof(void*))
      
      As well, this patch significantly cleans up the hash code. It adds the
      two function _Py_HashDouble and _PyHash_VoidPtr that the various
      hashing routine are changed to use.
      
      These help maintain the hash function invariant: (a==b) =>
      (hash(a)==hash(b))) I have added Lib/test/test_hash.py and
      Lib/test/output/test_hash to test this for some cases.
      13634cf7
  11. 23 Haz, 2000 2 kayıt (commit)
    • Jeremy Hylton's avatar
      part 2 of Neil Schemenauer's GC patches: · d08b4c45
      Jeremy Hylton yazdı
      This patch modifies the type structures of objects that
      participate in GC.  The object's tp_basicsize is increased when
      GC is enabled.  GC information is prefixed to the object to
      maintain binary compatibility.  GC objects also define the
      tp_flag Py_TPFLAGS_GC.
      d08b4c45
    • Jeremy Hylton's avatar
      Round 1 of Neil Schemenauer's GC patches: · 8caad49c
      Jeremy Hylton yazdı
      This patch adds the type methods traverse and clear necessary for GC
      implementation.
      8caad49c
  12. 03 May, 2000 1 kayıt (commit)
    • Guido van Rossum's avatar
      Vladimir Marangozov's long-awaited malloc restructuring. · b18618da
      Guido van Rossum yazdı
      For more comments, read the patches@python.org archives.
      For documentation read the comments in mymalloc.h and objimpl.h.
      
      (This is not exactly what Vladimir posted to the patches list; I've
      made a few changes, and Vladimir sent me a fix in private email for a
      problem that only occurs in debug mode.  I'm also holding back on his
      change to main.c, which seems unnecessary to me.)
      b18618da
  13. 27 Nis, 2000 1 kayıt (commit)
  14. 22 May, 1998 1 kayıt (commit)
  15. 10 Nis, 1998 1 kayıt (commit)
  16. 05 Agu, 1997 1 kayıt (commit)
  17. 02 May, 1997 1 kayıt (commit)
  18. 25 Eki, 1996 1 kayıt (commit)
  19. 18 Tem, 1995 1 kayıt (commit)
  20. 20 Ock, 1995 1 kayıt (commit)
  21. 10 Ock, 1995 1 kayıt (commit)
  22. 07 Ock, 1995 1 kayıt (commit)
  23. 04 Ock, 1995 1 kayıt (commit)
  24. 30 Agu, 1994 1 kayıt (commit)
  25. 30 Kas, 1993 1 kayıt (commit)
    • Guido van Rossum's avatar
      * import.c (get_module): pass .py filename to parse_file, not .pyc filename! · 590baa4a
      Guido van Rossum yazdı
      * funcobject.c (func_repr): don't call getstringvalue(None) for anonymous
        functions.
      * bltinmodule.c: removed lambda (which is now a built-in function);
        removed implied lambda for string arg to filter/map/reduce.
      * Grammar, graminit.[ch], compile.[ch]: replaced lambda as built-in
        function by lambda as grammar entity: instead of "lambda('x: x+1')" you
        write "lambda x: x+1".
      * Xtmodule.c (checkargdict): return 0, not NULL, for error.
      590baa4a
  26. 05 Kas, 1993 1 kayıt (commit)
  27. 19 May, 1993 1 kayıt (commit)
    • Guido van Rossum's avatar
      Several changes in one: · 25831652
      Guido van Rossum yazdı
      (1) dictionaries/mappings now have attributes values() and items() as
      well as keys(); at the C level, use the new function mappinggetnext()
      to iterate over a dictionary.
      
      (2) "class C(): ..." is now illegal; you must write "class C: ...".
      
      (3) Class objects now know their own name (finally!); and minor
      improvements to the way how classes, functions and methods are
      represented as strings.
      
      (4) Added an "access" statement and semantics.  (This is still
      experimental -- as long as you don't use the keyword 'access' nothing
      should be changed.)
      25831652
  28. 29 Mar, 1993 1 kayıt (commit)
    • Guido van Rossum's avatar
      * Changed all copyright messages to include 1993. · 9bfef44d
      Guido van Rossum yazdı
      * Stubs for faster implementation of local variables (not yet finished)
      * Added function name to code object.  Print it for code and function
        objects.  THIS MAKES THE .PYC FILE FORMAT INCOMPATIBLE (the version
        number has changed accordingly)
      * Print address of self for built-in methods
      * New internal functions getattro and setattro (getattr/setattr with
        string object arg)
      * Replaced "dictobject" with more powerful "mappingobject"
      * New per-type functio tp_hash to implement arbitrary object hashing,
        and hashobject() to interface to it
      * Added built-in functions hash(v) and hasattr(v, 'name')
      * classobject: made some functions static that accidentally weren't;
        added __hash__ special instance method to implement hash()
      * Added proper comparison for built-in methods and functions
      9bfef44d
  29. 05 Nis, 1992 1 kayıt (commit)
  30. 14 Ock, 1992 1 kayıt (commit)
  31. 19 Şub, 1991 1 kayıt (commit)
  32. 20 Ara, 1990 1 kayıt (commit)
  33. 18 Kas, 1990 1 kayıt (commit)
  34. 21 Eki, 1990 1 kayıt (commit)
  35. 14 Eki, 1990 1 kayıt (commit)