summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* 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...
* Rewritten PyImport_Cleanup() and its helper, clear_carefully(). TheyGuido van Rossum1998-01-191-12/+98
| | | | | | | | | | | | | | | | | | now implement the following finalization strategy. 1. Whenever this code deletes a module, its directory is cleared carefully, as follows: - set all names to None that begin with exactly one underscore - set all names to None that don't begin with two underscores - clear the directory 2. Modules are deleted in the following order: - modules with a reference count of 1, except __builtin__ or __sys__ - repeat until no more are found with a reference count of 1 - __main__ if it's still there - all remaining modules except __builtin__ or sys - sys _ __builtin__
* Last-minute fix for Jim H: don't die after del sys.stdoutGuido van Rossum1997-12-311-2/+11
|
* Plug the most annoying recursive printing problem -- reset '_' to NoneGuido van Rossum1997-12-261-3/+8
| | | | | before printing and set it to the printed variable *after* printing (and only when printing is successful).
* Oops -- '(' is also a legal start character of a new format...Guido van Rossum1997-12-191-0/+1
|
* Oops! Should've renamed dos_8x3 to dos-8x3 here, too.Guido van Rossum1997-12-171-3/+3
|
* For base 10, cast unsigned long to long before testing overflow.Guido van Rossum1997-12-151-2/+8
| | | | This prevents 4294967296 from being an acceptable way to spell zero!
* Need a cast when comparing type object in isinstance()Guido van Rossum1997-12-101-1/+1
|
* Add explicit check for correct next character in format at end ofGuido van Rossum1997-12-091-0/+7
| | | | | format. This will complain about illegal formats like "O#" instead of ignoring the '#'.
* Fix subtle bug in cleanup code in PyErr_NormalizeException(), detectedGuido van Rossum1997-12-091-2/+2
| | | | | by Marc Lemburg. There's a path through the code where *val is NULL, but value isn't, and value should be DECREF'ed.
* Changed the finalization order again so that the reference countGuido van Rossum1997-12-081-13/+18
| | | | | printing (when Py_DEBUG is defined) happens while there's still a current thread...
* Jeff Rush: add definition for S_IFMT for VisualAge C/C++ under OS2.Guido van Rossum1997-12-051-0/+5
|
* Add the flag RTLD_GLOBAL to the dlopen() options.Guido van Rossum1997-12-021-3/+7
| | | | | | | This exports symbols defined by the loaded extension to other extensions (loaded later). (I'm not quite sure about this but suppose it can't hurt...)
* Make stdin unbuffered too, when PYTHONUNBUFFERED is specified.Guido van Rossum1997-12-021-0/+1
|
* Support type objects in isinstance().Guido van Rossum1997-12-021-10/+15
| | | | | E.g. isinstance('',types.StringType) will return true now instead of raising a TypeError exception. This is for JPython compatibility.
* Apply str() to sys.ps1 or sys.ps2 before using them as a prompt, soGuido van Rossum1997-11-251-16/+14
| | | | | you can assign an object whose str() evaluates to the current directory (or whatever).
* os2 patch by Jeff RushGuido van Rossum1997-11-223-2/+44
|
* Plug memory leak in Py_BuildValue when using {...} to construct dictionaries.Guido van Rossum1997-11-201-3/+5
|
* Fix importing of shared libraries from inside packages.Guido van Rossum1997-11-192-3/+26
| | | | | | | | This is a bit of a hack: when the shared library is loaded, the module name is "package.module", but the module calls Py_InitModule*() with just "module" for the name. The shared library loader squirrels away the true name of the module in _Py_PackageContext, and Py_InitModule*() will substitute this (if the name actually matches).
* Two changes (here we go again :-( ).Guido van Rossum1997-11-191-35/+3
| | | | | | | | | | 1) The __builtins__ variable in the __main__ module is set to the __builtin__ module instead of its __dict__. 2) Get rid of the SIGHUP and SIGTERM handlers. They can't be made to work reliably when threads may be in use, they are Unix specific, and Python programmers can now program this functionality is a safer way using the signal module.
* Give more detailed error message when the argument count isn't right.Guido van Rossum1997-11-191-4/+6
|
* Fix memory leak in exec statement with code object -- the None returnedGuido van Rossum1997-11-111-2/+4
| | | | | | by PyEval_EvalCode() on success was never DECREF'ed. Fix by Bernhard Herzog.
* Undo half of the previous change :-(Guido van Rossum1997-11-041-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | Setting interp->builtins to the __builtin__ module instead of to its dictionary had the unfortunate side effect of always running in restricted execution mode :-( I will check in a different way of setting __main__.__builtins__ to the __builtin__ module later. Also, there was a typo -- a comment was unfinished, and as a result some finalizations were not being executed. In Bart Simpson style, I Will Not Check In Untested Changes. I Will Not Check In Untested Changes. I Will Not Check In Untested Changes. I Will Not Check In Untested Changes. I Will Not Check In Untested Changes. I Will Not Check In Untested Changes. I Will Not Check In Untested Changes. I Will Not Check In Untested Changes. I Will Not Check In Untested Changes. I Will Not Check In Untested Changes.
* Get rid of another reference to _PyImport_Inittab (now a static array)Guido van Rossum1997-11-041-2/+2
| | | | | that should be PyImport_Inittab (a new pointer initialized to point to the array).
* The warning about thread still having a frame now only happens inGuido van Rossum1997-11-031-1/+1
| | | | verbose mode.
* Two independent changes (alas):Guido van Rossum1997-11-031-19/+16
| | | | | | | | | | | | - The interp->builtins variable (and hence, __main__.__builtins__) is once again initialized to the built-in *module* instead of its dictionary. - The finalization order is once again changed. Signals are finalized relatively early, because (1) it DECREF's the signal handlers, and if a signal handler happens to be a bound method, deleting it could cause problems when there's no current thread around, and (2) we don't want to risk executing signal handlers during finalization.
* New policy for package imports: only a directory containingGuido van Rossum1997-10-311-2/+38
| | | | | | __init__.py (or __init__.pyc/.pyo, whichever applies) is considered a package. All other subdirectories are left alone. Should make Konrad Hinsen happy!
* Instead of using _PyImport_Inittab[] directly, use the new "official"Guido van Rossum1997-10-311-4/+8
| | | | pointer *PyImport_Inittab which is initialized to _PyImport_Inittab.