summaryrefslogtreecommitdiff
path: root/Python/marshal.c
AgeCommit message (Collapse)AuthorLines
2006-08-12This code is actually not used unless WITHOUT_COMPLEX is defined.Neal Norwitz-0/+8
However, there was no error checking that PyFloat_FromDouble returned a valid pointer. I believe this change is correct as it seemed to follow other code in the area. Klocwork # 292.
2006-05-29Convert more modules to METH_VARARGS.Georg Brandl-5/+3
2006-03-07Change int to Py_ssize_t in several places.Martin v. Löwis-10/+26
Add (int) casts to silence compiler warnings. Raise Python exceptions for overflows.
2006-03-01Make Py_ssize_t clean.Thomas Wouters-1/+3
2006-03-01Fix incompatible assignment warning from previous checkin.Thomas Wouters-1/+2
2006-03-01Fix gcc (4.0.x) warning about use of uninitialized variables.Thomas Wouters-1/+2
(PyMarshal_ReadShortFromFile() is only used in zipimport.c, I don't believe the extra initializations will matter one way or another.)
2006-02-16Move cast to suppress warning.Martin v. Löwis-2/+2
2006-02-15Merge ssize_t branch.Martin v. Löwis-11/+15
2006-01-19Check return result from Py_InitModule*(). This API can fail.Neal Norwitz-0/+2
Probably should be backported.
2005-11-16version was not initialized properlyNeal Norwitz-0/+1
2005-10-21Fix a bunch of imports to use code.h instead of compile.h.Jeremy Hylton-1/+0
Remove duplicate declarations from compile.h
2005-10-20Merge ast-branch to headJeremy Hylton-0/+1
This change implements a new bytecode compiler, based on a transformation of the parse tree to an abstract syntax defined in Parser/Python.asdl. The compiler implementation is not complete, but it is in stable enough shape to run the entire test suite excepting two disabled tests.
2005-08-16Add a C API for sets and frozensets.Raymond Hettinger-4/+2
2005-06-25Fix signedness of various char variables to stop causing a warning under gcc 4.Brett Cannon-10/+10
2005-06-13Fix bugMichael W. Hudson-0/+4
[ 1180997 ] lax error-checking in new-in-2.4 marshal stuff which I'd assigned to Martin, but actually turned out to be easy to fix. Also, a test.
2005-06-13Remove extraneous format character from PyArg_ParseTuple call inMichael W. Hudson-1/+1
marshal_loads. Bugfix candidate.
2005-06-03Fix a couple of crashing-on-malformed data marshal bugs.Michael W. Hudson-6/+8
2005-06-03This is my patch:Michael W. Hudson-64/+174
[ 1180995 ] binary formats for marshalling floats Adds 2 new type codes for marshal (binary floats and binary complexes), a new marshal version (2), updates MAGIC and fiddles the de-serializing of code objects to be less likely to clobber the real reason for failing if it fails.
2005-01-12remove unused variableFred Drake-1/+0
2005-01-11SF 1098985: set objects cannot be marshalledRaymond Hettinger-1/+66
2004-12-20Any call to marshal.dumps() with the new optional argument 'version' justArmin Rigo-1/+1
immediately segfaults, due to a typo! This was obviously never tested... Added a test for it, and also fixed the documentation.
2004-06-27Patch #923098: Share interned strings in marshal.Martin v. Löwis-15/+74
2004-06-13Make private function staticNeal Norwitz-1/+1
2004-06-08Patch #774665: Make Python LC_NUMERIC agnostic.Martin v. Löwis-3/+3
2004-03-26Marshal clean-up (SF patch #873224)Armin Rigo-63/+54
2003-09-04Bug #794140: cygwin builds do not embedJason Tishler-1/+1
The embed2.diff patch solves the user's problem by exporting the missing symbols from the Python core so Python can be embedded in another Cygwin application (well, at lest vim).
2002-07-30Whitespace normalization.Thomas Heller-4/+4
2002-07-30Fix SF 588452: debug build crashes on marshal.dumps([128] * 1000).Thomas Heller-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.
2002-06-14Fix SF bug # 561858 Assertion with very long listsNeal Norwitz-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.
2002-04-03Add the 'bool' type and its values 'False' and 'True', as described inGuido van Rossum-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.
2002-03-31Use symbolic METH_VARARGS instead of 1 for ml_flagsNeal Norwitz-4/+4
2001-11-09Use PyObject_CheckReadBuffer().Jeremy Hylton-6/+2
2001-10-19SF patch #470393 (Jim Ahlstrom): Add missing marshal functionGuido van Rossum-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]
2001-08-30fix for part of bug #453523: disable unmarshalling of code objects inMichael W. Hudson-1/+7
restricted execution mode.
2001-08-29marshal.c r_long64: When reading a TYPE_INT64 value on a box with 32-bitTim Peters-12/+24
ints, convert to PyLong (rather than throwing away the high-order 32 bits).
2001-08-17Patch #445762: Support --disable-unicodeMartin v. Löwis-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.
2001-06-18Merging the gen-branch into the main line, at Guido's direction. Yay!Tim Peters-0/+8
Bugfix candidate in inspect.py: it was referencing "self" outside of a method.
2001-05-08SF bug #422177: Results from .pyc differs from .pyTim Peters-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.
2001-04-10test_pickle works on sizeof(long)==8 boxes again.Tim Peters-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.
2001-01-28It's unclear whether PyMarshal_XXX() are part of the public or private API.Tim Peters-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.
2001-01-25PEP 227 implementationJeremy Hylton-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.
2001-01-18Variant of SF patch 103252: Startup optimize: read *.pyc as string, not with ↵Tim Peters-0/+47
getc().
2000-11-14SF bug 119622: compile errors due to redundant atof decls. I don't understandTim Peters-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.
2000-09-19Obscure marshal fixes:Tim Peters-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).
2000-09-01REMOVED all CWI, CNRI and BeOpen copyright markings.Guido van Rossum-9/+0
This should match the situation in the 1.6b1 tree.
2000-07-23Included assert.h in Python.h -- it's absurd that this basic tool ofTim Peters-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.
2000-07-23-- changed w_more to take an integer instead of a charFredrik Lundh-2/+2
(this is what the callers expect).
2000-07-22Mass ANSIfication of function definitions. Doesn't cover all 'extern'Thomas Wouters-59/+22
declarations yet, those come later.
2000-07-09Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.Tim Peters-6/+4
2000-06-30Change copyright notice - 2nd try.Guido van Rossum-6/+0