summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* vgetargskeywords:Tim Peters2001-10-271-16/+9
| | | | | | | | | | | | + Generally test nkeywords against 0 instead of keywords against NULL (saves a little work if an empty keywords dict is passed, and is conceptually more on-target regardless). + When a call erroneously specifies a keyword argument both by position and by keyword name: - It was easy to provoke this routine into an internal buffer overrun by using a long argument name. Now uses PyErr_format instead (which computes a safe buffer size). - Improved the error msg.
* vgetargskeywords:Tim Peters2001-10-271-20/+7
| | | | | | + Got rid of now-redundant dict typecheck. + Renamed nkwds to nkwlist. Now all the "counting" vrbls have names related to the things they're counting in an obvious way.
* vgetargskeywords:Tim Peters2001-10-271-12/+13
| | | | | | | + Renamed argslen to nargs. + Renamed kwlen to nkeywords. This one was especially confusing because kwlen wasn't the length of the kwlist argument, but of the keywords argument.
* vgetargskeywords:Tim Peters2001-10-271-15/+10
| | | | | | | + Removed now-redundant tuple typecheck. + Renamed "tplen" local to "argslen" (it's the length of the "args" argument; I suppose "tp" was for "Tim Peters should rename me someday <wink>).
* PyArg_ParseTupleAndKeywords: return false on internal error, not -1 (ITim Peters2001-10-271-30/+34
| | | | | | | | | | | introduced this bug just a little while ago, when *adding* internal error checks). vgetargskeywords: Rewrote the section that crawls over the format string. + Added block comment so it won't take the next person 15 minutes to reverse-engineer what it's doing. + Lined up the "else" clauses. + Rearranged the ifs in decreasing order of likelihood (for speed).
* PyArg_ParseTupleAndKeywords: do basic sanity checks on the arguments,Tim Peters2001-10-271-1/+16
| | | | | | and raise an error if they're insane. vgetargskeywords: the same, except that since this is an internal routine, just assert that the arguments are sane.
* tuple(3,4,5,x=2) dumped core on my box. vgetargskeywords() overindexedTim Peters2001-10-271-3/+13
| | | | | | | | | | | | | | the kwlist vector whenever there was a mix of positional and keyword arguments, and the number of positional arguments exceeded the length of the kwlist vector. If there was just one more positional arg than keyword, the kwlist-terminating NULL got passed to PyMapping_HasKeyString, which set an internal error that vgetargskeywords() then squashed (but it's impossible to say whether it knew it was masking an error). If more than one more positional argument, it went on to pass random trash to PyMapping_HasKeyString, which is why the example at the start happened to kill the process. Pure bugfix candidate.
* vgetargskeywords(): remove test that can't succeed. Not a bugfix, justTim Peters2001-10-271-13/+7
| | | | removing useless obfuscation.
* Use PyDict_Copy() and PyDict_Update() instead of using PyObject_CallMethod()Fred Drake2001-10-251-5/+3
| | | | | | to call the corresponding methods. This is not a performance improvement since the times are still swamped by disk I/O, but cleans up the code just a little.
* Convert getrefcount() to METH_O, and sys_excepthook() to useFred Drake2001-10-241-6/+3
| | | | PyArg_UnpackTuple().
* SF patch #474590 -- RISC OS supportGuido van Rossum2001-10-242-7/+46
|
* PyArg_UnpackTuple(): New argument unpacking function suggested by JimFred Drake2001-10-231-0/+60
| | | | Fulton, based on code Jim supplied.
* Style conformance: function name begins a new line *consistently*.Fred Drake2001-10-231-7/+11
| | | | Make convertbuffer() static like the prototype says. Not used elsewhere.
* Make traceback objects collectable.Jeremy Hylton2001-10-221-2/+46
| | | | | This should eliminate the traceback returned by sys.exc_info() as a common source of memory leaks.
* Removed two pointless and obfuscating macros.Tim Peters2001-10-221-7/+4
|
* 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]
* Move dlfcn.h block out of NetBSD block, assuming that NetBSD beforeMartin v. Löwis2001-10-181-3/+4
| | | | | 199712 didn't have dlfcn.h, or that it wouldn't conflict with the other stuff defined.
* SF Patch (but with no patch) 472555 Remove trailing common in enumeration.Tim Peters2001-10-181-1/+1
| | | | | Some AIX compiler didn't like the trailing comma at the end of the why_code enum decl.
* Squash compiler wng about signed/unsigned mismatch.Tim Peters2001-10-181-1/+1
|
* First part of SF patch #416704: More robust freeze, by Toby Dickenson.Guido van Rossum2001-10-181-5/+23
| | | | | | | This fixes the behavior reported by SF bug #404545, where a file x.y.py could be imported by the statement "import x.y" when there's a frozen package x (I believe even if x.y also exists as a frozen module).
* Fix the frozen bytecode for __hello__ (betcha didn't know that existedGuido van Rossum2001-10-181-5/+12
| | | | | | | | | | :-). Add a test that prevents the __hello__ bytecode from going stale unnoticed again. The test also tests the loophole noted in SF bug #404545. This test will fail right now; I'll check in the fix in a minute.
* Fix for SF bug [ #471928 ] global made w/nested list comprehensionsJeremy Hylton2001-10-181-19/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The symbol table pass didn't have an explicit case for the list_iter node which is used only for a nested list comprehension. As a result, the target of the list comprehension was treated as a use instead of an assignment. Fix is to add a case to symtable_node() to handle list_iter. Also, rework and document a couple of the subtler implementation issues in the symbol table pass. The symtable_node() switch statement depends on falling through the last several cases, in order to handle some of the more complicated nodes like atom. Add a comment explaining the behavior before the first fall through case. Add a comment /* fall through */ at the end of case so that it is explicitly marked as such. Move the for_stmt case out of the fall through logic, which simplifies both for_stmt and default. (The default used the local variable start to skip the first three nodes of a for_stmt when it fell through.) Rename the flag argument to symtable_assign() to def_flag and add a comment explaining its use: The third argument to symatble_assign() is a flag to be passed to symtable_add_def() if it is eventually called. The flag is useful to specify the particular type of assignment that should be recorded, e.g. an assignment caused by import.
* Patch to bug #472202: Correctly recognize NetBSD before 199712.Martin v. Löwis2001-10-181-2/+5
|
* For debug build, check that the stack pointer never exceeds the stack size.Jeremy Hylton2001-10-171-1/+3
|
* Fix computation of stack depth for classdef and closures.Jeremy Hylton2001-10-171-44/+44
| | | | | | | | | | | | | | | | | | | | | | Also minor tweaks to internal routines. Use PyCF_MASK instead of explicit list of flags. For the MAKE_CLOSURE opcode, the number of items popped off the stack depends on both the oparg and the number of free variables for the code object. Fix the code so it accounts for the free variables. In com_classdef(), record an extra pop to account for the STORE call after the BUILD_CLASS. Get rid of some commented out debugging code in com_push() and com_pop(). Factor string resize logic into helper routine com_check_size(). In com_addbyte(), remove redudant if statement after assert. (They test the same condition.) In several routines, use string macros instead of string functions.
* Fix a bug in the previous checkin. The wrong bootstrap function wasGuido van Rossum2001-10-161-1/+1
| | | | passed to _beginthread().
* SF patch #471852 (anonymous) notes that getattr(obj, name, default)Guido van Rossum2001-10-161-1/+3
| | | | masks any exception, not just AttributeError. Fix this.
* Partial patch from SF #452266, by Jason Petrone.Guido van Rossum2001-10-1612-27/+73
| | | | | | This changes Pythread_start_thread() to return the thread ID, or -1 for an error. (It's technically an incompatible API change, but I doubt anyone calls it.)