summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* Don't fail on importing things with undefined references. Unfortunately weJack Jansen2001-12-061-1/+2
| | | | | | still fail on importing modules that link with libraries that fail their initialization code (such as windowing libraries when we don't have access to the window server) and that is what I really wanted to fix.
* Fix for SF bug #489671 (Neil Norwitz): memory leak in test_richcmp.Guido van Rossum2001-12-061-0/+8
| | | | | | Had nothing to do with rich comparisons -- some stack cleanup code was lost as a result of merging in Neil Schemenauer's generators patch. Reinserted the stack cleanup code, skipping it when yielding.
* Fix a typo (probably caused by autocompletion <blush>) that caused aGuido van Rossum2001-12-061-1/+1
| | | | | | leak when a class defined a __metaclass__. This fixes the problem reported on python-dev by Ping; I dunno if it's the same as SF bug #489669 (since that mentions Unicode).
* SF bug #488514: -Qnew needs workTim Peters2001-12-062-11/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Big Hammer to implement -Qnew as PEP 238 says it should work (a global option affecting all instances of "/"). pydebug.h, main.c, pythonrun.c: define a private _Py_QnewFlag flag, true iff -Qnew is passed on the command line. This should go away (as the comments say) when true division becomes The Rule. This is deliberately not exposed to runtime inspection or modification: it's a one-way one-shot switch to pretend you're using Python 3. ceval.c: when _Py_QnewFlag is set, treat BINARY_DIVIDE as BINARY_TRUE_DIVIDE. test_{descr, generators, zipfile}.py: fiddle so these pass under -Qnew too. This was just a matter of s!/!//! in test_generators and test_zipfile. test_descr was trickier, as testbinop() is passed assumptions that "/" is the same as calling a "__div__" method; put a temporary hack there to call "__truediv__" instead when the method name is "__div__" and 1/2 evaluates to 0.5. Three standard tests still fail under -Qnew (on Windows; somebody please try the Linux tests with -Qnew too! Linux runs a whole bunch of tests Windows doesn't): test_augassign test_class test_coercion I can't stay awake longer to stare at this (be my guest). Offhand cures weren't obvious, nor was it even obvious that cures are possible without major hackery. Question: when -Qnew is in effect, should calls to __div__ magically change into calls to __truediv__? See "major hackery" at tail end of last paragraph <wink>.
* Fix SF bug #486144: Uninitialized __slot__ vrbl is None.Guido van Rossum2001-12-041-1/+8
| | | | | | | There's now a new structmember code, T_OBJECT_EX, which is used for all __slot__ variables (except __weakref__, which has special behavior anyway). This new code raises AttributeError when the variable is NULL rather than converting NULL to None.
* SF bug #488687 reported by Neal NorwitzJeremy Hylton2001-12-042-1/+2
| | | | | | | | | The error for assignment to __debug__ used ste->ste_opt_lineno instead of n->n_lineno. The latter was at best incorrect; often the slot was uninitialized. Two fixes here: Use the correct lineno for the error. Initialize ste_opt_lineno in PySymtable_New(); while there are no current cases where it is referenced unless it has already been assigned to, there is no harm in initializing it.
* More sprintf -> PyOS_snprintf.Tim Peters2001-12-041-1/+1
|
* Fix the final two issues in Armin Rigo's SF bug #488477: apply_slice()Guido van Rossum2001-12-031-4/+10
| | | | | and assign_slice() weren't properly DECREF'ing the temporary slice object they created. (Shame on me. :-)
* unpack_iterable(): Add a missing DECREF in an error case. Reported byGuido van Rossum2001-12-031-0/+1
| | | | | Armin Rigo (SF bug #488477). Added a testcase to test_unpack_iter() in test_iter.py.
* mysnprintf.c: Massive rewrite of PyOS_snprintf and PyOS_vsnprintf, toTim Peters2001-12-033-89/+78
| | | | | | | | | | | | | | | use wrappers on all platforms, to make this as consistent as possible x- platform (in particular, make sure there's at least one \0 byte in the output buffer). Also document more of the truth about what these do. getargs.c, seterror(): Three computations of remaining buffer size were backwards, thus telling PyOS_snprintf the buffer is larger than it actually is. This matters a lot now that PyOS_snprintf ensures there's a trailing \0 byte (because it didn't get the truth about the buffer size, it was storing \0 beyond the true end of the buffer). sysmodule.c, mywrite(): Simplify, now that PyOS_vsnprintf guarantees to produce a \0 byte.
* mywrite(): The test for trouble in PyOS_vsnprintf was wrong on bothTim Peters2001-12-021-3/+10
| | | | | ends. Also, when there is trouble, ensure the buffer has a traiing 0 byte.
* When the number of bytes written to the malloc'ed buffer is largerGuido van Rossum2001-12-011-5/+5
| | | | | | than the argument string size, copy as many bytes as will fit (including a terminating '\0'), rather than not copying anything. This to make it satisfy the C99 spec.
* SF bug 486278 SystemError: Python/getargs.c:1086: bad.Tim Peters2001-11-291-7/+10
| | | | | | | | | | vgetargskeywords(): Now that this routine is checking for bad input (rather than dump core in some cases), some bad calls are raising errors that previously "worked". This patch makes the error strings more revealing, and changes the exceptions from SystemError to RuntimeError (under the theory that SystemError is more of a "can't happen!" assert- like thing, and so inappropriate for bad arguments to a public C API function).
* Two screwups fixed for sizeof(char *) instead of sizeof(char []).Jeremy Hylton2001-11-281-77/+82
| | | | | Also change all the helper functions to pass along the size of the msgbuf and use PyOS_snprintf() when writing into the buffer.
* More sprintf -> PyOS_snprintf.Tim Peters2001-11-281-2/+3
|
* Use PyOS_snprintf() at some cost even though it was correct before.Jeremy Hylton2001-11-281-6/+7
| | | | | | seterror() uses a char array and a pointer to the current position in that array. Use snprintf() and compute the amount of space left in the buffer based on the current pointer position.
* Use PyOS_vsnprintf() and check its return value.Jeremy Hylton2001-11-281-2/+9
| | | | | | If it returns -1 (which indicates overflow on old Linux platforms and perhaps on Windows) or size greater than buffer, write a message indicating that the previous message was truncated.
* ste_repr(): Conversion of sprintf() to PyOS_snprintf() for bufferBarry Warsaw2001-11-281-4/+5
| | | | overrun avoidance.
* aix_loaderror(): Conversion of sprintf() to PyOS_snprintf() for bufferBarry Warsaw2001-11-281-1/+1
| | | | overrun avoidance.
* code_repr(), com_addop_varname(), com_list_comprehension(),Barry Warsaw2001-11-281-32/+42
| | | | | | | | com_arglist(), symtable_check_unoptimized(), symtable_params(), symtable_global(), symtable_list_comprehension(): Conversion of sprintf() to PyOS_snprintf() for buffer overrun avoidance.
* Use PyOS_snprintf instead of sprintf.Jeremy Hylton2001-11-2812-35/+42
|
* Use PyOS_snprintf instead of sprintf.Jeremy Hylton2001-11-281-15/+18
| | | | | Also replace a switch statement with one case and a default to an if/else.
* Use PyOS_snprintf when possible.Jeremy Hylton2001-11-281-34/+41
|
* Use PyOS_snprintf instead of sprintf.Jeremy Hylton2001-11-281-11/+11
| | | | | Just being sure. The old code looks like it was safe, but there's no harm in double-checking.
* Fixes for possible buffer overflows in sprintf() usages.Marc-André Lemburg2001-11-284-17/+12
|
* SF bug #483469: crash on unbounded recursion in __del__.Tim Peters2001-11-271-0/+8
| | | | | | | | | | | | | PyEval_EvalCodeEx(): increment tstate->recursion_depth around the decref of the frame, because the C stack for this call is still in use and the decref can lead to __del__ methods getting called. While this gives tstate->recursion_depth a value proportional to the depth of the C stack (instead of a small constant no matter how deeply __del__s recurse), it's not enough to stop the reported crash when using the default recursion limit on Windows. Bugfix candidate.
* SF bug 485175: buffer overflow in traceback.c.Tim Peters2001-11-271-3/+3
| | | | | | | Bugfix candidate. tb_displayline(): the sprintf format was choking off the file name, but used plain %s for the function name (which can be arbitrarily long). Limit both to 500 chars max.
* Fix for bug #480188: printing unicode objectsMarc-André Lemburg2001-11-201-3/+13
|
* Since the MAGIC number scheme is going to break on January 1st, documentTim Peters2001-11-181-4/+16
| | | | what it is more carefully and point out some of the subtleties.
* PyOS_getsig(), PyOS_setsig(): The minimal amount of work to avoid theBarry Warsaw2001-11-131-0/+12
| | | | | | | | | | | | | uninitialized memory reads reported in bug #478001. Note that this doesn't address the following larger issues: - Error conditions are not documented for PyOS_*sig() in the C API. - Nothing that actually calls PyOS_*sig() in the core interpreter and extension modules actually /checks/ the return value of the call. Fixing those is left as an exercise for a later day.
* Use PyObject_CheckReadBuffer().Jeremy Hylton2001-11-092-17/+4
|
* Include sys_getdefaultencoding in #ifdef Py_USING_UNICODE. Fixes #479571.Martin v. Löwis2001-11-091-2/+2
|
* Fix SF buf #480096: Assign to __debug__ still allowedJeremy Hylton2001-11-091-2/+7
| | | | | | Easy enough to catch assignment in the compiler. The perverse user can still change the value of __debug__, but that may be the least he can do.
* Fix memory leak. This is part of SF patch #478006.Fred Drake2001-11-091-1/+1
|
* Backing out the fast path for interned string compares again as requested.Marc-André Lemburg2001-11-081-15/+0
|
* Add fast-path for comparing interned (true) string objects.Marc-André Lemburg2001-11-071-0/+15
| | | | | | This patch boosts performance for comparing identical string object by some 20% on my machine while not causing any noticable slow-down for other operations (according to tests done with pybench).
* Make the CoreFoundation object _New and _Convert routines available to other ↵Jack Jansen2001-11-051-0/+22
| | | | modules. Idea by Donovan Preston, implementaion by me.
* SF patch 473749 compile under OS/2 VA C++, from Michael Muller.Tim Peters2001-11-052-0/+5
| | | | Changes enabling Python to compile under OS/2 Visual Age C++.
* Part of SF bug #478003 possible memory leaks in err handling.Tim Peters2001-11-041-1/+4
| | | | | PyNode_CompileSymtable: if symtable_init() fails, free the memory allocated for the PyFutureFeatures struct.
* Link the core with CoreServices, not with Carbon, and don't use any CarbonJack Jansen2001-10-311-0/+8
| | | | | | | | | | routines. As of 10.1 using Carbon will crash Python if no window server is available (ssh connection, console mode, MacOSX Server). This fixes bug #466907. A result of this mod is that the default 8bit encoding on OSX is now ASCII, for the time being. Also, the extension modules that need the Carbon framework now explicitly include it in setup.py.
* SF patch #474500: Make OS/2 locks work like posix locks, from MichaelTim Peters2001-10-311-30/+61
| | | | Muller.
* On the macintosh don't take a quick exit in find_module() for frozen ↵Jack Jansen2001-10-301-0/+8
| | | | submodule imports: the frozen import goes through a different mechanism.
* Rename "dictionary" (type and constructor) to "dict".Tim Peters2001-10-291-1/+1
|
* vgetargskeywords()Tim Peters2001-10-271-16/+17
| | | | | | | | | | + Squash another potential buffer overrun. + Simplify the keyword-arg loop by decrementing the count of keywords remaining instead of incrementing Yet Another Variable; also break out early if the number of keyword args remaining hits 0. Since I hit the function's closing curly brace with this patch, that's enough of this for now <wink>.
* vgetargskeywords: Now that it's clear that nkwlist must equal max, andTim Peters2001-10-271-4/+3
| | | | we're ensuring that's true during the format parse, get rid of nkwlist.
* vgetargskeywords: Prevent another potential sprintf buffer overrun.Tim Peters2001-10-271-2/+2
|
* vgetargskeywords: Verify kwlist has the required length while parsingTim Peters2001-10-271-20/+24
| | | | | the format, instead of waiting until after we can overindex it by mistake.
* vgetargskeywords: Removed all PyErr_Clear() calls. It's possible thatTim Peters2001-10-271-4/+8
| | | | | this routine will report an error now when it didn't before, but, if so, it's a legitimate error that should never have been suppressed.
* vgetargskeywords: The keywords arg is a dict (if non-NULL), so use theTim Peters2001-10-271-5/+5
| | | | | dict API everywhere on it instead of sometimes using the slower mapping API.
* vgetargskeywords: Removed one of the mysterious PyErr_Clear() calls.Tim Peters2001-10-271-10/+1
| | | | | | | The "need" for this was probably removed by an earlier patch that stopped the loop right before it from passing NULL to a dict lookup routine. I still haven't convinced myself that the next loop is correct, so am leaving the next mysterious PyErr_Clear() call in for now.