summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* 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.)
* SF patch #471839: Bug when extensions import extensions (Shane Hathaway)Guido van Rossum2001-10-161-2/+3
| | | | | | | | | | | | | | | | | When an extension imports another extension in its initXXX() function, the variable _Py_PackageContext is prematurely reset to NULL. If the outer extension then calls Py_InitModule(), the extension is installed in sys.modules without its package name. The manifestation of this bug is a "SystemError: _PyImport_FixupExtension: module <package>.<extension> not loaded". To fix this, importdl.c just needs to retain the old value of _Py_PackageContext and restore it after the initXXX() method is called. The attached patch does this. This patch applies to Python 2.1.1 and the current CVS.
* Put descr name in "bad memberdescr type" error message.Jeremy Hylton2001-10-161-1/+2
|
* make getarray static - it's only called from ceval.c and is not anSkip Montanaro2001-10-151-1/+1
| | | | extern-able name.
* Very subtle syntax change: in a list comprehension, the testlist inGuido van Rossum2001-10-152-102/+131
| | | | | | | | | | | | | | | "for <var> in <testlist> may no longer be a single test followed by a comma. This solves SF bug #431886. Note that if the testlist contains more than one test, a trailing comma is still allowed, for maximum backward compatibility; but this example is not: [(x, y) for x in range(10), for y in range(10)] ^ The fix involved creating a new nonterminal 'testlist_safe' whose definition doesn't allow the trailing comma if there's only one test: testlist_safe: test [(',' test)+ [',']]
* Do not define _POSIX_THREADS if unistd.h defines it.Martin v. Löwis2001-10-151-1/+1
| | | | Check for pthread_sigmask before using it. Fixes remaining problem in #470781.
* Suppress a bunch of "value computed is not used" warnings when building inFred Drake2001-10-131-2/+2
| | | | debug mode (--with-pydebug).
* SF patch #467455 : Enhanced environment variables, by Toby Dickenson.Guido van Rossum2001-10-121-3/+14
| | | | | | | | | | | | | | | | | | | | | | This patch changes to logic to: if env.var. set and non-empty: if env.var. is an integer: set flag to that integer if flag is zero: # [actually, <= 0 --GvR] set flag to 1 Under this patch, anyone currently using PYTHONVERBOSE=yes will get the same output as before. PYTHONVERBNOSE=2 will generate more verbosity than before. The only unusual case that the following three are still all equivalent: PYTHONVERBOSE=yespleas PYTHONVERBOSE=1 PYTHONVERBOSE=0
* Add SF patch #468347 -- mask signals for non-main pthreads, by Jason Lowe:Guido van Rossum2001-10-121-0/+26
| | | | | | | | | | | | | | | | | | | This patch updates Python/thread_pthread.h to mask all signals for any thread created. This will keep all signals masked for any thread that isn't the initial thread. For Solaris and Linux, the two platforms I was able to test it on, it solves bug #465673 (pthreads need signal protection) and probably will solve bug #219772 (Interactive InterPreter+ Thread -> core dump at exit). I'd be great if this could get some testing on other platforms, especially HP-UX pre 11.00 and post 11.00, as I had to make some guesses for the DCE thread case. AIX is also a concern as I saw some mention of using sigthreadmask() as a pthread_sigmask() equivalent, but this patch doesn't use sigthreadmask(). I don't have access to AIX.
* Undo part of 2.59: 't' case of convertsimple() should not use convertbuffer().Jeremy Hylton2001-10-111-5/+11
| | | | | convertbuffer() uses the buffer interface's getreadbuffer(), but 't' should use getcharbuffer().
* One more place where PyString_AsString() was used after aJeremy Hylton2001-10-101-1/+1
| | | | PyString_Check() had already succeeded.
* Use AS_STRING() following the check and avoid an extra call.Jeremy Hylton2001-10-101-1/+1
|