summaryrefslogtreecommitdiff
path: root/Python/pythonrun.c
AgeCommit message (Collapse)AuthorLines
2007-01-23Backport trunk revision 53527:Thomas Wouters-2/+4
SF patch #1630975: Fix crash when replacing sys.stdout in sitecustomize When running the interpreter in an environment that would cause it to set stdout/stderr/stdin's encoding, having a sitecustomize that would replace them with something other than PyFile objects would crash the interpreter. Fix it by simply ignoring the encoding-setting for non-files. This could do with a test, but I can think of no maintainable and portable way to test this bug, short of adding a sitecustomize.py to the buildsystem and have it always run with it (hmmm....)
2006-10-05[Backport r50685 | neal.norwitz]Andrew M. Kuchling-2/+13
Reported by Klocwork #151. v2 can be NULL if exception2 is NULL. I don't think that condition can happen, but I'm not sure it can't either. Now the code will protect against either being NULL.
2006-10-03[Backport r51443 | neal.norwitz]Andrew M. Kuchling-0/+5
Handle a few more error conditions. Klocwork 301 and 302. Will backport.
2006-10-03[Backport r51231 | neal.norwitz]Andrew M. Kuchling-0/+4
PyModule_GetDict() can fail, produce fatal errors if this happens on startup. Klocwork #298-299.
2006-04-12Ignore the references to the dummy objects used as deleted keysArmin Rigo-2/+2
in dicts and sets when computing the total number of references.
2005-10-02Backported:Neal Norwitz-1/+1
Fix segfault with invalid coding. (See SF bug: 772896 for another fix)
2005-08-24Forward UnicodeDecodeError into SyntaxError for source encoding errors.Martin v. Löwis-5/+7
2005-03-29Move exception finalisation later in the shutdown process - thisAnthony Baxter-7/+8
fixes the crash seen in bug #1165761
2004-10-13Patch #975056 - fixes for restartable signals on *BSD. In addition,Anthony Baxter-24/+19
a few remaining calls to signal() were converted to PyOS_setsig().
2004-10-11SF patch 1044089: New C API function PyEval_ThreadsInitialized(), by NickTim Peters-1/+0
Coghlan, for determining whether PyEval_InitThreads() has been called. Also purged the undocumented+unused _PyThread_Started int.
2004-10-07Finalize the freelist of list objects.Raymond Hettinger-0/+1
2004-08-19Patch #900727: Add Py_InitializeEx to allow embedding without signals.Martin v. Löwis-2/+10
2004-07-21Patch #984714: Properly diagnose E_DECODE errors.Martin v. Löwis-0/+3
Backported to 2.3.
2004-07-07This closes patch:Michael W. Hudson-1/+2
[ 960406 ] unblock signals in threads although the changes do not correspond exactly to any patch attached to that report. Non-main threads no longer have all signals masked. A different interface to readline is used. The handling of signals inside calls to PyOS_Readline is now rather different. These changes are all a bit scary! Review and cross-platform testing much appreciated.
2004-03-24Changed random calls to PyThreadState_Get() to use the macroNicholas Bastin-3/+3
2004-03-22Lost reference.Armin Rigo-6/+8
2004-02-10remove support for missing ANSI C header files (limits.h, stddef.h, etc).Skip Montanaro-4/+0
2003-12-01Py_Finalize(): disabled the second call of cyclic gc, and added extensiveTim Peters-2/+27
comments about why both calls to cyclic gc here can cause problems. I'll backport to 2.3 maint. Since the calls were introduced in 2.3, that will be the end of it.
2003-11-20Getting rid of all the code inside #ifdef macintosh too.Jack Jansen-14/+0
2003-11-19Getting rid of support for the ancient Apple MPW compiler.Jack Jansen-12/+0
2003-11-13Patch #804543: strdup saved locales. Backported to 2.3.Martin v. Löwis-1/+2
2003-10-12Simplify and speedup uses of Py_BuildValue():Raymond Hettinger-1/+1
* Py_BuildValue("(OOO)",a,b,c) --> PyTuple_Pack(3,a,b,c) * Py_BuildValue("()",a) --> PyTuple_New(0) * Py_BuildValue("O", a) --> Py_INCREF(a)
2003-08-11Fix refcounting and cut & paste error (?) in last checkin.Michael W. Hudson-3/+1
This should go onto release23-maint, too.
2003-08-09Move initialization of sys.std{in,out}.encoding to Py_Initialize.Martin v. Löwis-15/+51
Verify that the encoding actually exists. Fixes #775985. Will backport to 2.3.
2003-07-16Correct previous patch looking for warnings module: sys.modules, notMark Hammond-1/+1
sys.__modules__.
2003-07-15Fix [ 771097 ] frozen programs fail due to implicit import of "warnings".Mark Hammond-5/+36
If the initial import of warnings fails, clear the error. When the module is actually needed, if the original import failed, see if it has managed to find its way to sys.modules yet and if so, remember it.
2003-04-22PyGILState cleanup was too early - destructors called via module cleanup may ↵Mark Hammond-5/+5
use the API.
2003-04-19handle_system_exit(): This leaked the current exception info, inTim Peters-4/+16
particular leaving the traceback object (and everything reachable from it) alive throughout shutdown. The patch is mostly from Guido. Bugfix candidate.
2003-04-19New PyGILState_ API - implements pep 311, from patch 684256.Mark Hammond-0/+15
2003-04-17_Py_PrintReferences(): Changed to print object address at start of eachTim Peters-2/+9
new line. New pvt API function _Py_PrintReferenceAddresses(): Prints only the addresses and refcnts of the live objects. This is always safe to call, because it has no dependence on Python's C API. Py_Finalize(): If envar PYTHONDUMPREFS is set, call (the new) _Py_PrintReferenceAddresses() right before dumping final pymalloc stats. We can't print the reprs of the objects here because too much of the interpreter has been shut down. You need to correlate the addresses displayed here with the object reprs printed by the earlier PYTHONDUMPREFS call to _Py_PrintReferences().
2003-04-17- New C API PyGC_Collect(), same as calling gc.collect().Guido van Rossum-0/+8
- Call this in Py_Finalize(). - Expand the Misc/NEWS text on PY_LONG_LONG.
2003-04-17A missing piece of the PEP 269 patch: add PyParser_SetError(), aGuido van Rossum-0/+9
wrapper around err_input().
2003-04-17Trimmed trailing whitespace.Tim Peters-10/+10
2003-04-17Py_Finalize(): Reverted recent changes that tried to move theTim Peters-8/+11
PYTHONDUMPREFS output after most teardown. Attempts to use PYTHONDUMPREFS with the Zope3 test suite died with Py_FatalError(), since _Py_PrintReferences() can end up executing arbitrary Python code (for objects that override __repr__), and that requires an intact interpreter.
2003-04-15- pythunrun.c, Py_Finalize(): move the call to _Py_PrintReferences()Guido van Rossum-8/+8
even farther down, to just before the call to _PyObject_DebugMallocStats(). This required the following changes: - pystate.c, PyThreadState_GetDict(): changed not to raise an exception or issue a fatal error when no current thread state is available, but simply return NULL without raising an exception (ever). - object.c, Py_ReprEnter(): when PyThreadState_GetDict() returns NULL, don't raise an exception but return 0. This means that when printing a container that's recursive, printing will go on and on and on. But that shouldn't happen in the case we care about (see first bullet). - Updated Misc/NEWS and Doc/api/init.tex to reflect changes to PyThreadState_GetDict() definition.
2003-04-15Move the call to _Py_PrintReferences() a bit further down. ThisGuido van Rossum-7/+12
prevents it from showing stuff (like codec state) that is cleared when the interpreter state is cleared.
2003-04-10Move declaration of enc to scope where it is usedNeal Norwitz-2/+1
2003-03-19Fixed SF bug #663074. The codec system was using global staticGustavo Niemeyer-8/+0
variables to store internal data. As a result, any atempts to use the unicode system with multiple active interpreters, or successive interpreter executions, would fail. Now that information is stored into members of the PyInterpreterState structure.
2003-03-05Declare all variables at the start of their scope.Fred Drake-1/+1
2003-03-05Always initialize Py_FileSystemDefaultEncoding on Unix in Py_Initialize,Martin v. Löwis-0/+28
and not as a side effect of setlocale. Expose it as sys.getfilesystemencoding. Adjust test case.
2003-02-25Addendum to #683658:Just van Rossum-2/+2
import warnings.py _after_ site.py has run. This ensures that site.py is again the first .py to be imported, giving it back full control over sys.path.
2003-02-19Fix bug 683658 - PyErr_Warn may cause import deadlock.Mark Hammond-0/+11
2003-02-13- Finally fixed the bug in compile() and exec where a string endingGuido van Rossum-6/+2
with an indented code block but no newline would raise SyntaxError. This would have been a four-line change in parsetok.c... Except codeop.py depends on this behavior, so a compilation flag had to be invented that causes the tokenizer to revert to the old behavior; this required extra changes to 2 .h files, 2 .c files, and 2 .py files. (Fixes SF bug #501622.)
2003-01-24MacPython-OS9 has had an abort() function for quite a while now, so there's ↵Jack Jansen-3/+0
no reason to stall in an endless loop, just call abort() on a fatal error.
2003-01-22Patch #671459: Invoke import hooks in Py_NewInterpreter.Martin v. Löwis-0/+1
2002-12-31Since the *_Init() are private, prefix with _, suggested by SkipNeal Norwitz-2/+2
2002-12-30SF #561244, Micro optimizationsNeal Norwitz-0/+6
Initialize the small integers and __builtins__ in startup. This removes some if conditions. Change XDECREF to DECREF for values which shouldn't be NULL.
2002-12-30PEP 302 + zipimport:Just van Rossum-0/+2
- new import hooks in import.c, exposed in the sys module - new module called 'zipimport' - various changes to allow bootstrapping from zip files I hope I didn't break the Windows build (or anything else for that matter), but then again, it's been sitting on sf long enough... Regarding the latest discussions on python-dev: zipimport sets pkg.__path__ as specified in PEP 273, and likewise, sys.path item such as /path/to/Archive.zip/subdir/ are supported again.
2002-12-13Added missing casts.Jack Jansen-2/+2
2002-12-11Constify filenames and scripts. Fixes #651362.Martin v. Löwis-41/+41