summaryrefslogtreecommitdiffstats
path: root/Python/marshal.c
Commit message (Collapse)AuthorAgeFilesLines
* Whitespace normalization.Thomas Heller2002-07-301-4/+4
|
* Fix SF 588452: debug build crashes on marshal.dumps([128] * 1000).Thomas Heller2002-07-301-6/+6
| | | | | | | | | See there for a description. Added test case. Bugfix candidate for 2.2.x, not sure about previous versions: probably low priority, because virtually no one runs debug builds.
* Fix SF bug # 561858 Assertion with very long listsNeal Norwitz2002-06-141-10/+10
| | | | | Write 4 bytes for co_stacksize, etc. to prevent writing out bad .pyc files which can cause a crash when read back in.
* Add the 'bool' type and its values 'False' and 'True', as described inGuido van Rossum2002-04-031-0/+16
| | | | | | | | | | | | | PEP 285. Everything described in the PEP is here, and there is even some documentation. I had to fix 12 unit tests; all but one of these were printing Boolean outcomes that changed from 0/1 to False/True. (The exception is test_unicode.py, which did a type(x) == type(y) style comparison. I could've fixed that with a single line using issubtype(x, type(y)), but instead chose to be explicit about those places where a bool is expected. Still to do: perhaps more documentation; change standard library modules to return False/True from predicates.
* Use symbolic METH_VARARGS instead of 1 for ml_flagsNeal Norwitz2002-03-311-4/+4
|
* Use PyObject_CheckReadBuffer().Jeremy Hylton2001-11-091-6/+2
|
* SF patch #470393 (Jim Ahlstrom): Add missing marshal functionGuido van Rossum2001-10-191-0/+8
| | | | | | | | | | In Include/, marshal.h declares both PyMarshal_ReadLongFromFile() and PyMarshal_ReadShortFromFile(), but the second is missing from marshal.c. [Shouldn't the return type be declared as 'short' instead of 'int'? But 'int' is what was in marshal.h all those years... --Guido]
* fix for part of bug #453523: disable unmarshalling of code objects inMichael W. Hudson2001-08-301-1/+7
| | | | restricted execution mode.
* marshal.c r_long64: When reading a TYPE_INT64 value on a box with 32-bitTim Peters2001-08-291-12/+24
| | | | ints, convert to PyLong (rather than throwing away the high-order 32 bits).
* Patch #445762: Support --disable-unicodeMartin v. Löwis2001-08-171-0/+4
| | | | | | | | - Do not compile unicodeobject, unicodectype, and unicodedata if Unicode is disabled - check for Py_USING_UNICODE in all places that use Unicode functions - disables unicode literals, and the builtin functions - add the types.StringTypes list - remove Unicode literals from most tests.
* Merging the gen-branch into the main line, at Guido's direction. Yay!Tim Peters2001-06-181-0/+8
| | | | | Bugfix candidate in inspect.py: it was referencing "self" outside of a method.
* SF bug #422177: Results from .pyc differs from .pyTim Peters2001-05-081-5/+3
| | | | | | | | Store floats and doubles to full precision in marshal. Test that floats read from .pyc/.pyo closely match those read from .py. Declare PyFloat_AsString() in floatobject header file. Add new PyFloat_AsReprString() API function. Document the functions declared in floatobject.h.
* test_pickle works on sizeof(long)==8 boxes again.Tim Peters2001-04-101-1/+1
| | | | | | | | | | pickle.py The code implicitly assumed that all ints fit in 4 bytes, causing all sorts of mischief (from nonsense results to corrupted pickles). Repaired that. marshal.c The int marshaling code assumed that right shifts of signed longs sign-extend. Repaired that.
* It's unclear whether PyMarshal_XXX() are part of the public or private API.Tim Peters2001-01-281-33/+49
| | | | | | | | | | 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.
* PEP 227 implementationJeremy Hylton2001-01-251-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Variant of SF patch 103252: Startup optimize: read *.pyc as string, not with ↵Tim Peters2001-01-181-0/+47
| | | | getc().
* SF bug 119622: compile errors due to redundant atof decls. I don't understandTim Peters2000-11-141-2/+0
| | | | | | the bug report (for details, look at it), but agree there's no need for Python to declare atof itself: we #include stdlib.h, and ANSI C sez atof is declared there already.
* Obscure marshal fixes:Tim Peters2000-09-191-4/+4
| | | | | | | | When reading a short, sign-extend on platforms where shorts are bigger than 16 bits. When reading a long, repair the unportable sign extension that was being done for 64-bit machines (it assumed that signed right shift sign-extends).
* REMOVED all CWI, CNRI and BeOpen copyright markings.Guido van Rossum2000-09-011-9/+0
| | | | This should match the situation in the 1.6b1 tree.
* Included assert.h in Python.h -- it's absurd that this basic tool ofTim Peters2000-07-231-1/+1
| | | | | | | | good C practice hasn't been available to everything all along. Added Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) macro to pyport.h; this just casts VALUE from type WIDE to type NARROW, but assert-fails if Py_DEBUG is defined and info is lost due to casting. Replaced a line in Fredrik's fix to marshal.c to use the new macro.
* -- changed w_more to take an integer instead of a charFredrik Lundh2000-07-231-2/+2
| | | | (this is what the callers expect).
* Mass ANSIfication of function definitions. Doesn't cover all 'extern'Thomas Wouters2000-07-221-59/+22
| | | | declarations yet, those come later.
* Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.Tim Peters2000-07-091-6/+4
|
* Change copyright notice - 2nd try.Guido van Rossum2000-06-301-6/+0
|
* Change copyright notice.Guido van Rossum2000-06-301-22/+7
|
* Urmpf. Quality control on this patch lapsed a bit. :-(Guido van Rossum2000-06-281-2/+6
| | | | | | | | | | | The depth field was never decremented inside w_object(), and it was never initialized in PyMarshal_WriteObjectToFile(). This caused imports from .pyc files to fil mysteriously when the .pyc file was written by the broken code -- w_object() would bail out early, but PyMarshal_WriteObjectToFile() doesn't check the error or return an error code, and apparently the marshalling code doesn't call PyErr_Check() either. (That's a separate patch if I feel like it.)
* Michael Hudson <mwh21@cam.ac.uk>:Fred Drake2000-06-281-3/+22
| | | | | | | | | | | | | As I really do not have anything better to do at the moment, I have written a patch to Python/marshal.c that prevents Python dumping core when trying to marshal stack bustingly deep (or recursive) data structure. It just throws an exception; even slightly clever handling of recursive data is what pickle is for... [Fred Drake:] Moved magic constant 5000 to a #define. This closes SourceForge patch #100645.
* Vladimir Marangozov's long-awaited malloc restructuring.Guido van Rossum2000-05-031-4/+4
| | | | | | | | | | 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.)
* Use modern PyArg_ParseTuple style, with function names.Guido van Rossum2000-03-311-8/+8
|
* Marc-Andre Lemburg: support marshalling Unicode objects (code 'u').Guido van Rossum2000-03-101-5/+42
|
* The previous checkin contained an experiment of Greg Stein's that wasn'tGuido van Rossum1998-10-081-1/+1
| | | | meant for checkin, and which broke marshal.loads().
* Changes to support other object types besides stringsGuido van Rossum1998-10-071-2/+15
| | | | | as the code string of code objects, as long as they support the (readonly) buffer interface. By Greg Stein.
* When unmarshalling, add test for negative lengths on strings, tuplesGuido van Rossum1998-06-081-2/+14
| | | | | | and lists; if the size is negative, raise an exception. Also raise an exception when an undefined type is found -- all this to increase the chance that garbage input causes an exception instead of a core dump.
* Remove unnecessary PyErr_Clear().Guido van Rossum1998-05-141-1/+0
|
* Make new gcc -Wall happyGuido van Rossum1998-04-101-4/+7
|
* Plugged a leak. (The same as the one plugged in compile.c -- forgotGuido van Rossum1997-07-261-0/+1
| | | | to free lnotab).
* PyFile_WriteString now returns an error indicator instead of callingGuido van Rossum1997-05-221-2/+2
| | | | PyErr_Clear(). Add checking of those errors.
* Quickly renamed the remaining files -- this directory is done.Guido van Rossum1997-04-291-156/+161
|
* New form of PyFPE_END_PROTECT macro.Guido van Rossum1997-03-141-3/+3
|
* Changes for Lee Busby's SIGFPE patch set.Guido van Rossum1997-02-141-1/+9
| | | | | New file pyfpe.c and exception FloatingPointError. Surround some f.p. operations with PyFPE macro brackets.
* Keep gcc -Wall happy.Guido van Rossum1997-02-141-1/+1
|
* Marshal the line number table of code objects.Guido van Rossum1997-01-241-1/+9
|
* Marshal the new stacksize item in code objects.Guido van Rossum1997-01-171-1/+3
|
* Better way to handle 64-bit ints, keeping gcc -Wall happy.Guido van Rossum1996-12-101-30/+18
| | | | Tested with AMK's help.
* Tentative changes to make this work better on 64-bit machines.Guido van Rossum1996-12-051-3/+66
| | | | | A plain int that doesn't fit in 32 bits will be marshalled using a new type. 32 bits machines can't handle this and will issue a warning.
* New permission notice, includes CNRI.Guido van Rossum1996-10-251-13/+20
|
* Ellipses -> Ellipsis rename (the dictionary really says that it shouldGuido van Rossum1996-10-111-6/+6
| | | | | | | | be Ellipsis!). Bumped the API version because a linker-visible symbol is affected. Old C code will still compile -- there's a b/w compat macro. Similarly, old Python code will still run, builtin exports both Ellipses and Ellipsis.
* Added *PyMarshal_WriteObjectToString() (moved the relevant code thereGuido van Rossum1996-08-191-18/+25
| | | | from marshal_loads()).
* Changes for slice and ellipsesGuido van Rossum1996-07-301-0/+7
|
* Py_complex; and WITHOUT_COMPLEX added to getargs.cGuido van Rossum1996-07-211-1/+1
|