<feed xmlns='http://www.w3.org/2005/Atom'>
<title>python.git/Objects/funcobject.c, branch 2.1</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<id>http://dangofactory.net/cgit/cgit.cgi/Server/python.git/atom/Objects/funcobject.c?h=2.1</id>
<link rel='self' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/atom/Objects/funcobject.c?h=2.1'/>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/'/>
<updated>2001-03-23T04:19:27Z</updated>
<entry>
<title>Add support for weak references to the function and method types.</title>
<updated>2001-03-23T04:19:27Z</updated>
<author>
<name>Fred Drake</name>
<email>fdrake@acm.org</email>
</author>
<published>2001-03-23T04:19:27Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=db81e8ddf8953359e8c2ed9569dd2e774d78ae95'/>
<id>urn:sha1:db81e8ddf8953359e8c2ed9569dd2e774d78ae95</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Visit the closure during traversal and XDECREF it on during deallocation.</title>
<updated>2001-03-01T06:06:37Z</updated>
<author>
<name>Jeremy Hylton</name>
<email>jeremy@alum.mit.edu</email>
</author>
<published>2001-03-01T06:06:37Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=a52e8fe49a625d13d89967bc17adeb71520bf3d0'/>
<id>urn:sha1:a52e8fe49a625d13d89967bc17adeb71520bf3d0</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Fix SF buf 404774 submitted by Gregory H. Ball</title>
<updated>2001-02-28T02:42:56Z</updated>
<author>
<name>Jeremy Hylton</name>
<email>jeremy@alum.mit.edu</email>
</author>
<published>2001-02-28T02:42:56Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=3f571d6497f33945da5ea7791fc533df1f995387'/>
<id>urn:sha1:3f571d6497f33945da5ea7791fc533df1f995387</id>
<content type='text'>
A user program could delete a function's func_closure, which would
cause it to crash when called.
</content>
</entry>
<entry>
<title>The one thing I love more then writing code is deleting code.</title>
<updated>2001-01-29T06:21:17Z</updated>
<author>
<name>Moshe Zadka</name>
<email>moshez@math.huji.ac.il</email>
</author>
<published>2001-01-29T06:21:17Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=497671e094b7f18221cc1f872bfe68afc57c860b'/>
<id>urn:sha1:497671e094b7f18221cc1f872bfe68afc57c860b</id>
<content type='text'>
* 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
</content>
</entry>
<entry>
<title>PEP 227 implementation</title>
<updated>2001-01-25T20:06:59Z</updated>
<author>
<name>Jeremy Hylton</name>
<email>jeremy@alum.mit.edu</email>
</author>
<published>2001-01-25T20:06:59Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=64949cb753f206c0ca1d83f55d07afd3c179b81a'/>
<id>urn:sha1:64949cb753f206c0ca1d83f55d07afd3c179b81a</id>
<content type='text'>
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&gt;

    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.
</content>
</entry>
<entry>
<title>Application and elaboration of patch #103305 to fix core dumps when</title>
<updated>2001-01-19T19:53:29Z</updated>
<author>
<name>Barry Warsaw</name>
<email>barry@python.org</email>
</author>
<published>2001-01-19T19:53:29Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=0395fdd3a9249356f6efde5f8a5313df2d0c2b8c'/>
<id>urn:sha1:0395fdd3a9249356f6efde5f8a5313df2d0c2b8c</id>
<content type='text'>
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.
</content>
</entry>
<entry>
<title>Committing PEP 232, function attribute feature, approved by Guido.</title>
<updated>2001-01-15T20:40:19Z</updated>
<author>
<name>Barry Warsaw</name>
<email>barry@python.org</email>
</author>
<published>2001-01-15T20:40:19Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=d6a9e84c8193076e776a1b419148f3043e2f6330'/>
<id>urn:sha1:d6a9e84c8193076e776a1b419148f3043e2f6330</id>
<content type='text'>
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.
</content>
</entry>
<entry>
<title>REMOVED all CWI, CNRI and BeOpen copyright markings.</title>
<updated>2000-09-01T23:29:29Z</updated>
<author>
<name>Guido van Rossum</name>
<email>guido@python.org</email>
</author>
<published>2000-09-01T23:29:29Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=8586991099e4ace18ee94163a96b8ea1bed77ebe'/>
<id>urn:sha1:8586991099e4ace18ee94163a96b8ea1bed77ebe</id>
<content type='text'>
This should match the situation in the 1.6b1 tree.
</content>
</entry>
<entry>
<title>ANSI-fication of the sources.</title>
<updated>2000-07-09T06:03:25Z</updated>
<author>
<name>Fred Drake</name>
<email>fdrake@acm.org</email>
</author>
<published>2000-07-09T06:03:25Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=ee238b977fb7a58a4b88bdab087579d067df6451'/>
<id>urn:sha1:ee238b977fb7a58a4b88bdab087579d067df6451</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Neil Schemenauer: small fixes for GC</title>
<updated>2000-07-01T01:00:38Z</updated>
<author>
<name>Guido van Rossum</name>
<email>guido@python.org</email>
</author>
<published>2000-07-01T01:00:38Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=4cc6ac7b8797dd55cf9c93b6da7eae1d225b7dfe'/>
<id>urn:sha1:4cc6ac7b8797dd55cf9c93b6da7eae1d225b7dfe</id>
<content type='text'>
</content>
</entry>
</feed>
