summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* 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 a few unused locals (I love VC++ for this!).Guido van Rossum1998-05-291-2/+0
|
* Moved cmp_member() to abstract.c, as PySequence_Contains() [withGuido van Rossum1998-05-221-53/+2
| | | | | | | | swapped arguments]. Also make sure that no use of a function pointer gotten from a tp_as_sequence or tp_as_mapping structure is made without checking it for NULL first.
* A bunch of functions are now properly implemented in abstract.c, andGuido van Rossum1998-05-221-356/+40
| | | | | | | | | | | the code here becomes much simpler. In particular: abs(), divmod(), pow(), int(), long(), float(), len(), tuple(), list(). Also make sure that no use of a function pointer gotten from a tp_as_sequence or tp_as_mapping structure is made without checking it for NULL first. A few other cosmetic things, such as properly reindenting slice().
* Trivial little change: when setting a member to an object, hold theGuido van Rossum1998-05-201-1/+3
| | | | | | | old value in a temporary and XDECREF it only after then new value has been set. This prevents the (unlikely) case where the destructor of the member uses the containing object -- it would find it in an undefined state.
* Fix a curious bug: statements like "import sys.time" would succeed,Guido van Rossum1998-05-191-3/+10
| | | | | | because the path through the code would notice that sys.__path__ did not exist and it would fall back to the default path (builtins + sys.path) instead of failing). No longer.
* Remove use of RTLD_GLOBAL.Guido van Rossum1998-05-181-6/+4
|
* Another veeeeeery old patch...Guido van Rossum1998-05-151-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Date: Thu, 14 Sep 1995 12:18:20 -0400 From: Alan Morse <alan@dvcorp.com> To: python-list@cwi.nl Subject: getargs bug in 1.2 and 1.3 BETA We have found a bug in the part of the getargs code that we added and submitted, and which was incorporated into 1.1. The parsing of "O?" format specifiers is not handled correctly; there is no "else" for the "if" and therefore it can never fail. What's worse, the advancing of the varargs pointer is not handled properly, so from then on it is out of sync, wreaking all sorts of havoc. (If it had failed properly, then the out-of-sync varargs would not have been an issue.) Below is the context diff for the change. Note that I have made a few stylistic changes beyond adding the else case, namely: 1) Making the "O" case follow the convention established by the other format specifiers of getting all their vararg arguments before performing the test, rather than getting some before and some after the test passes. 2) Making the logic of the tests parallel, so the "if" part indicates that the format is accepted and the "else" part indicates that the format has failed. They were inconsistent with each other and with the the other format specifiers. -Alan Morse (amorse@dvcorp.com)
* In debug mode on MS Windows, DLLs are called foo_d.pyd or foo_d.dll.Guido van Rossum1998-05-151-0/+5
|
* Improved version of patch for HPUX from David Arnold.Guido van Rossum1998-05-141-4/+1
|
* New APIs for embedding applications that want to add their own entriesGuido van Rossum1998-05-141-0/+58
| | | | | | | | | | | to the table of built-in modules. This should normally be called *before* Py_Initialize(). When the malloc() or realloc() call fails, -1 is returned and the existing table is unchanged. After a similar function by Just van Rossum. int PyImport_ExtendInittab(struct _inittab *newtab); int PyImport_AppendInittab(char *name, void (*initfunc)());
* Remove unnecessary PyErr_Clear().Guido van Rossum1998-05-141-1/+0
|
* Since PyDict_GetItem() can't raise an exception any more, there's noGuido van Rossum1998-05-142-4/+0
| | | | need to call PyErr_Clear() when it returns NULL.
* DELETE_FAST should issue an exception when the local variable is undefined.Guido van Rossum1998-05-121-0/+7
|
* New APIs to write to sys.stdout or sys.stderr using a printf-like interface.Guido van Rossum1998-05-121-0/+90
| | | | | | | | | | | | | | | | | | | | | | | | Adapted from code submitted by Just van Rossum. PySys_WriteStdout(format, ...) PySys_WriteStderr(format, ...) The first function writes to sys.stdout; the second to sys.stderr. When there is a problem, they write to the real (C level) stdout or stderr; no exceptions are raised (but a pending exception may be cleared when a new exception is caught). Both take a printf-style format string as their first argument followed by a variable length argument list determined by the format string. *** WARNING *** The format should limit the total size of the formatted output string to 1000 bytes. In particular, this means that no unrestricted "%s" formats should occur; these should be limited using "%.<N>s where <N> is a decimal number calculated so that <N> plus the maximum size of other formatted text does not exceed 1000 bytes. Also watch out for "%f", which can print hundreds of digits for very large numbers.
* Implement round() slightly different, so that for negative ndigits noGuido van Rossum1998-05-091-5/+13
| | | | | additional errors happen in the last step. The trick is to avoid division by 0.1**n -- multiply by 10.0**n instead.
* Support HPUX 10.20 DCE threads.Guido van Rossum1998-05-071-0/+6
|
* Fred's right -- we need PyList_SET_ITEM().Guido van Rossum1998-04-241-1/+1
|
* In-line the code in range() to set the list items; there's really noGuido van Rossum1998-04-231-1/+1
| | | | | need to call PyList_SetItem(v,i,w) when PyList_GET_ITEM(v,i)=w {sic} will do.
* Support for OpenBSD :-(Guido van Rossum1998-04-131-1/+1
|
* Reject empty module names -- otherwise __import__("") does somethingGuido van Rossum1998-04-111-0/+5
| | | | weird!
* Move #include <sys/param.h> to before osdefs.h (Donn Cave).Guido van Rossum1998-04-101-4/+5
|
* Comment out a label on an #endif.Guido van Rossum1998-04-101-1/+1
|
* Make new gcc -Wall happyGuido van Rossum1998-04-105-9/+16
|
* Address warnings issued by the MSVC++ compilerGuido van Rossum1998-04-102-2/+2
|
* /* An extension mechanism to store arbitrary additional per-thread state.Guido van Rossum1998-04-101-0/+21
| | | | | | | | | | PyThreadState_GetDict() returns a dictionary that can be used to hold such state; the caller should pick a unique key and store its state there. If PyThreadState_GetDict() returns NULL, an exception has been raised (most likely MemoryError) and the caller should pass on the exception. */ PyObject * PyThreadState_GetDict()
* Translate E_INDENT to the clearest error message I can think of.Guido van Rossum1998-04-101-0/+3
|
* Make first raise argument optionalGuido van Rossum1998-04-093-8/+25
|
* Make sure that the message "Error in sys.exitfunc:" goes to sys.stderrGuido van Rossum1998-04-031-2/+4
| | | | and not to C's stderr.
* Make calls into ../PC/frozen_dllmain.c on MS_WIN32.Guido van Rossum1998-04-031-0/+11
|
* Add primitive test for frozen package.Guido van Rossum1998-04-031-0/+4
|
* Use a faster way to check for null bytes in the string argument forGuido van Rossum1998-03-131-7/+18
| | | | int(), long(), float().
* Support for frozen packages, matching the revamped Tools/freeze.Guido van Rossum1998-03-051-14/+60
| | | | | | Frozen packages are indicated by a negative size (the code string is the __import__.py file). A frozen package module has its __path__ set to a string, the package name.
* Oops -- overuse of dabbrev-expand introduced a strange bug, whereGuido van Rossum1998-03-031-1/+1
| | | | instead of 'locals' I was passing 'lock_import' to import_module_ex().
* Add a single Python-wide (!) lock on import. Only one thread at aGuido van Rossum1998-03-031-8/+71
| | | | | | | | | | | | | | | | | | | | time can be in PyImport_ImportModuleEx(). Recursive calls from the same thread are okay. Potential problems: - The lock should really be part of the interpreter state rather than global, but that would require modifying more files, and I first want to figure out whether this works at all. - One could argue that the lock should be per module -- however that would be complicated to implement. We would have to have a linked list of locks per module name, *or* invent a new object type to represent a lock, so we can store the locks in the module or in a separate dictionary. Both seem unwarranted. The one situation where this can cause problems is when loading a module takes a long time, e.g. when the module's initialization code interacts with the user -- during that time, no other threads can run. I say, "too bad."
* Fix the handling of errors in Py_FlushLine() in a few places.Guido van Rossum1998-02-281-5/+7
| | | | (Basically, the error is cleared... Like almost everywhere else...)
* Moved clear_carefully() to _PyModule_Clear() in moduleobject.cGuido van Rossum1998-02-191-69/+31
| | | | | | | | | | | | | | | (modified) and use that. Some differences in the cleanup algorithm: - Clear __main__ before the other modules. - Delete more sys variables: including ps1, ps2, exitfunc, argv, and even path -- this will prevent new imports! - Restore stdin, stdout, stderr from __stdin__, __stdout__, __stderr__, effectively deleting hooks that the user might have installed -- so their (the hooks') destructors will run.
* Make backup copies of stdin, stdout, stderr as __stdin__, __stdout__,Guido van Rossum1998-02-191-0/+4
| | | | __stderr__. These will be used by the import cleanup.
* Small patches to the DJGPP version of check_case().Guido van Rossum1998-02-181-1/+3
|
* Added DJGPP version of check_case(), by Pit Scrorpion (Hans Nowak).Guido van Rossum1998-02-131-0/+28
| | | | (BTW, the Mac version was by Jack Jansen.)
* Add case checking feature on import.Guido van Rossum1998-02-131-1/+78
| | | | | | | | | | | | | This is an option for OS-es with case-insensitive but case-preserving filesystems. It is currently supported for Win32 and MacOS. To enable it, #define CHECK_IMPORT_CASE in your platform specific config.h. It is enabled by default on those systems where it is supported. On Win32, it can be disabled at runtime by setting the environment variable PYTHONCASEOK (to any value). When enabled, the feature checks that the case of the requested module name matches that of the filename found in the filesystem, and raises a NameError exception when they don't match.
* Added PyImport_ExecCodeModuleEx(), which adds an extra parameter toGuido van Rossum1998-02-111-5/+25
| | | | | | pass it the true file. This is used to set __file__ properly, instead of believing what the code object carries with it. (If the pointer is NULL, the code object's co_filename is still used.)
* Set Py_FrozenFlag, to suppress error messages from getpath.c.Guido van Rossum1998-02-061-0/+2
|
* Ehm, three unrelated changes.Guido van Rossum1998-02-061-3/+31
| | | | | | | | | | | | - Add Py_FrozenFlag, intended to suppress error messages fron getpath.c in frozen binaries. - Add Py_GetPythonHome() and Py_SetPythonHome(), intended to allow embedders to force a different PYTHONHOME. - Add new interface PyErr_PrintEx(flag); same as PyErr_Print() but flag determines whether sys.last_* are set or not. PyErr_Print() now simply calls PyErr_PrintEx(1).
* Two more refinements of the cleanup process.Guido van Rossum1998-02-061-3/+52
| | | | | | | | | | | | (1) Explicitly clear __builtin__._ and sys.{last,exc}_* before clearing anything else. These are common places where user values hide and people complain when their destructors fail. Since the modules containing them are deleted *last* of all, they would come too late in the normal destruction order. Sigh. (2) Add some debugging aid to cleanup (after a suggestion by Marc Lemburg) -- print the names of the modules being cleaned, and (when -vv is used) print the names of the variables being cleared.
* Protect PyErr_Format format string argument from overflow.Guido van Rossum1998-01-191-1/+1
|
* Protect PyErr_Format format string argument from overflow (ironically,Guido van Rossum1998-01-191-1/+1
| | | | the error was about a bad format string :-).
* Add unistd.h for isatty().Guido van Rossum1998-01-191-0/+4
|
* Better #ifdefs for NetBSD, taking into account that at least on netBSDGuido van Rossum1998-01-191-3/+8
| | | | | 1.3, dlopen() etc. are fully implemented, including dlerror(). From Jaromir Dolecek and Ty Sarna.
* It seems obvious that when Py_Finalize() decides that there's nothingGuido van Rossum1998-01-191-2/+2
| | | | to do, it should not call sys.exitfunc either...