Jack Jansen [Mon, 29 Jan 2001 14:07:01 +0000 (14:07 +0000)]
Accessor functions for regions and such expect an existing region as parameter. Fixed for grafport attribute access.
Got GetPortBitMapForCopyBits() and port.portBits to work.
Fixed posixpath.normpath() to respect two leading slashes, but
turn three or more into a single slash. (This is in sync with POSIX
susv2 according to Fredrik.)
Moshe Zadka [Mon, 29 Jan 2001 06:21:17 +0000 (06:21 +0000)]
The one thing I love more then writing code is deleting code.
* 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
Skip Montanaro [Sun, 28 Jan 2001 21:11:12 +0000 (21:11 +0000)]
allow first param urlencode to be a sequence of two-element tuples - in this
case, the order of parameters in the output matches the order of the inputs.
Fred Drake [Sun, 28 Jan 2001 03:55:09 +0000 (03:55 +0000)]
new_instance(): Use PyInstance_NewRaw() instead of knowing too much
about the internal initialization of instance objects. Make the
dict parameter optional, and allow None as equivalent to omission.
Tim Peters [Sun, 28 Jan 2001 00:27:39 +0000 (00:27 +0000)]
It's unclear whether PyMarshal_XXX() are part of the public or private API.
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.
Martin v. Löwis [Sat, 27 Jan 2001 08:38:34 +0000 (08:38 +0000)]
Merge changes of PyXML 1.13:
Use nodeName, not tagName in attributes.
Provide get method for dictionary-like objects.
Use DOM exceptions instead of standard exceptions.
Tim Peters [Sat, 27 Jan 2001 06:20:08 +0000 (06:20 +0000)]
SF bug http://sourceforge.net/bugs/?func=detailbug&bug_id=130242&group_id=5470
SF patch http://sourceforge.net/patch/?func=detailpatch&patch_id=103453&group_id=5470
PyMember_Set of T_CHAR always raises exception.
Unfortunately, this is a use of a C API function that Python itself never makes, so
there's no .py test I can check in to verify this stays fixed. But the fault in the
code is obvious, and Dave Cole's patch just as obviously fixes it.
Remaining single-line change from patch #102409: to install shared modules,
run setup.py with the --install-platlib flag so you can override
'prefix' when running make (e.g. make prefix=/tmp/python/usr/local install)
Instead of using mkdir to create directories, use install -d (mkdir -p
apparently isn't portable)
Emacs make-mode reported line 371 as suspicious; removed the whitespace from
that line.
Be extra careful with linking against libtermcap. This is now only done
if we can find the libtermcap in the usual places. Some platforms don't
have libtermcap, e.g. MacOSX.
Neil Schemenauer [Fri, 26 Jan 2001 16:18:16 +0000 (16:18 +0000)]
- LIBRARY is now a SUBST variable.
- Add CFLAGSFORSHARED variable. configure sets this to CCSHARED if LDLIBRARY
is a shared library.
- Remove -fPIC from OPT, it has no business there.
- Change CCSHARED option for Linux to -fPIC. It should probably be
-fPIC on a few other platforms as well.
- Don't create silly boot Makefile, create Setup files and run makesetup
instead.
Neil Schemenauer [Fri, 26 Jan 2001 16:14:41 +0000 (16:14 +0000)]
- Add CFLAGSFORSHARED variable. configure sets this to CCSHARED if LDLIBRARY
is a shared library.
- Add PY_CFLAGS variable (flags used to compile the interpreter)
- clobber now just removes object files, libraries and binaries
Jeremy Hylton [Thu, 25 Jan 2001 20:10:32 +0000 (20:10 +0000)]
In subst_vars(), change the name of the argument from str to s to
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.)
Jeremy Hylton [Thu, 25 Jan 2001 20:06:59 +0000 (20:06 +0000)]
PEP 227 implementation
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.
Jeremy Hylton [Thu, 25 Jan 2001 17:01:49 +0000 (17:01 +0000)]
Fix bug reported by Ka-Ping Yee: The compiler botched parsing function
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.
Skip Montanaro [Thu, 25 Jan 2001 13:47:00 +0000 (13:47 +0000)]
fail more completely by deleting dbhash from sys.modules if bsddb can't be
loaded - prevents second import later from succeeding spuriously - mostly of
use in regression tests where the module might get imported more than once
Tim Peters [Thu, 25 Jan 2001 06:23:18 +0000 (06:23 +0000)]
Fix bugs introduced by rewrite (in particular, time-based initialization
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!).