summaryrefslogtreecommitdiff
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* Forward-port of rev. 51857:Georg Brandl2006-09-111-1/+6
| | | | | | | | | | | Building with HP's cc on HP-UX turned up a couple of problems. _PyGILState_NoteThreadState was declared as static inconsistently. Make it static as it's not necessary outside of this module. Some tests failed because errno was reset to 0. (I think the tests that failed were at least: test_fcntl and test_mailbox). Ensure that errno doesn't change after a call to Py_END_ALLOW_THREADS. This only affected debug builds.
* Properly handle a NULL returned from PyArena_New().Neal Norwitz2006-09-111-2/+4
| | | | | | (Also fix some whitespace) Klocwork #364.
* with and as are now keywords. There are some generated files I can't recreate.Neal Norwitz2006-09-063-22/+14
|
* Bug #1550983: emit better error messages for erroneous relativeGeorg Brandl2006-09-061-2/+3
| | | | imports (if not in package and if beyond toplevel package).
* M-x untabifyNeal Norwitz2006-09-051-821/+821
|
* Add a comment about some refactoring. (There's probably more that should be ↵Neal Norwitz2006-09-051-6/+5
| | | | done.) I will reformat this file in the next checkin due to the inconsistent tabs/spaces.
* Bug #1520864 (again): unpacking singleton tuples in list comprehensions andNeal Norwitz2006-09-052-5/+14
| | | | | | | | | | | | | generator expressions (x for x, in ... ) works again. Sigh, I only fixed for loops the first time, not list comps and genexprs too. I couldn't find any more unpacking cases where there is a similar bug lurking. This code should be refactored to eliminate the duplication. I'm sure the listcomp/genexpr code can be refactored. I'm not sure if the for loop can re-use any of the same code though. Will backport to 2.5 (the only place it matters).
* Fix SF #1552093, eval docstring typo (3 ps in mapping)Neal Norwitz2006-09-051-1/+1
|
* Handle a few more error conditions.Neal Norwitz2006-08-211-0/+5
| | | | Klocwork 301 and 302. Will backport.
* Patch #1542451: disallow continue anywhere under a finallyNeal Norwitz2006-08-211-4/+9
| | | | | | I'm undecided if this should be backported to 2.5 or 2.5.1. Armin suggested to wait (I'm of the same opinion). Thomas W thinks it's fine to go in 2.5.
* Add assert to make Klocwork happy (#276)Neal Norwitz2006-08-211-0/+1
|
* Move peephole optimizer to separate file.Jeremy Hylton2006-08-212-608/+616
|
* Handle PyString_FromInternedString() failing (unlikely, but possible).Neal Norwitz2006-08-191-9/+8
| | | | | | Klocwork #325 (I'm not backporting this, but if someone wants to, feel free.)
* cpathname could be NULL if it was longer than MAXPATHLEN. Don't tryNeal Norwitz2006-08-131-1/+6
| | | | | | | | to write the .pyc to NULL. Check results of PyList_GetItem() and PyModule_GetDict() are not NULL. Klocwork 282, 283, 285
* Move/copy assert for tstate != NULL before first use.Neal Norwitz2006-08-131-1/+7
| | | | | | Verify that PyEval_Get{Globals,Locals} returned valid pointers. Klocwork 231-232
* Patch #1538606, Patch to fix __index__() clipping.Neal Norwitz2006-08-121-9/+9
| | | | | | | I modified this patch some by fixing style, some error checking, and adding XXX comments. This patch requires review and some changes are to be expected. I'm checking in now to get the greatest possible review and establish a baseline for moving forward. I don't want this to hold up release if possible.
* PyModule_GetDict() can fail, produce fatal errors if this happens on startup.Neal Norwitz2006-08-121-0/+4
| | | | Klocwork #298-299.
* Whoops, how did that get in there. :-) Revert all the parts of 51227 that ↵Neal Norwitz2006-08-122-12/+0
| | | | were not supposed to go it. Only Modules/_ctypes/cfields.c was supposed to be changed
* Check returned pointer is valid.Neal Norwitz2006-08-122-0/+12
| | | | Klocwork #233
* This code is actually not used unless WITHOUT_COMPLEX is defined.Neal Norwitz2006-08-121-0/+8
| | | | | | | | However, there was no error checking that PyFloat_FromDouble returned a valid pointer. I believe this change is correct as it seemed to follow other code in the area. Klocwork # 292.
* It's highly unlikely, though possible for PyEval_Get*() to return NULLs.Neal Norwitz2006-08-121-2/+2
| | | | | | So be safe and do an XINCREF. Klocwork # 221-222.
* Even though _Py_Mangle() isn't truly public anyone can call it andNeal Norwitz2006-08-121-2/+2
| | | | | | | | | | there was no verification that privateobj was a PyString. If it wasn't a string, this could have allowed a NULL pointer to creep in below and crash. I wonder if this should be PyString_CheckExact? Must identifiers be strings or can they be subclasses? Klocwork #275
* Klocwork made another run and found a bunch more problems.Neal Norwitz2006-08-122-1/+8
| | | | | | | This is the first batch of fixes that should be easy to verify based on context. This fixes problem numbers: 220 (ast), 323-324 (symtable), 321-322 (structseq), 215 (array), 210 (hotshot), 182 (codecs), 209 (etree).
* Followup to bug #1069160.Tim Peters2006-08-101-12/+27
| | | | | | PyThreadState_SetAsyncExc(): internal correctness changes wrt refcount safety and deadlock avoidance. Also added a basic test case (relying on ctypes) and repaired the docs.
* Concatenation on a long string breaks (SF #1526585).Armin Rigo2006-08-091-3/+9
|
* Introduce an upper bound on tuple nesting depth inGeorg Brandl2006-08-091-0/+3
| | | | C argument format strings; fixes rest of #1523610.
* Bug #1535165: fixed a segfault in input() and raw_input() whenGeorg Brandl2006-08-061-1/+1
| | | | sys.stdin is closed.
* On Windows, make PyErr_Warn an exported function again.Thomas Heller2006-08-041-1/+1
|
* There were really two issuesNeal Norwitz2006-08-041-1/+2
|
* Bug #1333982: string/number constants were inappropriately storedNeal Norwitz2006-08-041-2/+4
| | | | | in the byte code and co_consts even if they were not used, ie immediately popped off the stack.
* Bug #1191458: tracing over for loops now produces a line eventNeal Norwitz2006-08-042-8/+48
| | | | | | | | | | | | on each iteration. I'm not positive this is the best way to handle this. I'm also not sure that there aren't other cases where the lnotab is generated incorrectly. It would be great if people that use pdb or tracing could test heavily. Also: * Remove dead/duplicated code that wasn't used/necessary because we already handled the docstring prior to entering the loop. * add some debugging code into the compiler (#if 0'd out).
* Add some asserts and update commentsNeal Norwitz2006-07-302-2/+4
|
* Add PyErr_WarnEx() so C code can pass the stacklevel to warnings.warn().Neal Norwitz2006-07-301-2/+13
| | | | | | This provides the proper warning for struct.pack(). PyErr_Warn() is now deprecated in favor of PyErr_WarnEx(). As mentioned by Tim Peters on python-dev.
* Patch #1531113: Fix augmented assignment with yield expressions.Neal Norwitz2006-07-302-9/+12
| | | | Also fix a SystemError when trying to assign to yield expressions.
* Bug #1529871: The speed enhancement patch #921466 broke Python's compliancePhillip J. Eby2006-07-281-34/+132
| | | | | | with PEP 302. This was fixed by adding an ``imp.NullImporter`` type that is used in ``sys.path_importer_cache`` to cache non-directory paths and avoid excessive filesystem operations during imports.
* Bug #1521947: possible bug in mystrtol.c with recent gcc.Tim Peters2006-07-271-9/+21
| | | | | | | | | | | | | | | | | | | | | In general, C doesn't define anything about what happens when an operation on a signed integral type overflows, and PyOS_strtol() did several formally undefined things of that nature on signed longs. Some version of gcc apparently tries to exploit that now, and PyOS_strtol() could fail to detect overflow then. Tried to repair all that, although it seems at least as likely to me that we'll get screwed by bad platform definitions for LONG_MIN and/or LONG_MAX now. For that reason, I don't recommend backporting this. Note that I have no box on which this makes a lick of difference -- can't really test it, except to note that it didn't break anything on my boxes. Silent change: PyOS_strtol() used to return the hard-coded 0x7fffffff in case of overflow. Now it returns LONG_MAX. They're the same only on 32-bit boxes (although C doesn't guarantee that either ...).
* Part of bug #1523610: fix miscalculation of buffer length.Georg Brandl2006-07-261-2/+10
| | | | | Also add a guard against NULL in converttuple and add a test case (that previously would have crashed).
* bugfix: PyThread_start_new_thread() returns the thread ID, not a flag;Andrew MacIntyre2006-07-231-7/+4
| | | | will backport.
* If the for loop isn't entered, entryblock will be NULL. If passedNeal Norwitz2006-07-231-0/+2
| | | | | | to stackdepth_walk it will be dereffed. Not sure if I found with failmalloc or Klockwork #55.
* Handle more mem alloc issues found with failmallocNeal Norwitz2006-07-232-1/+5
|
* Fix more memory allocation issues found with failmalloc.Neal Norwitz2006-07-224-24/+45
|
* Handle more memory allocation failures without crashing.Neal Norwitz2006-07-215-8/+38
|
* Speel initialise write. Tanks Anthony.Neal Norwitz2006-07-211-1/+1
|
* Handle allocation failures gracefully. Found with failmalloc.Neal Norwitz2006-07-213-41/+45
| | | | Many (all?) of these could be backported.
* SF bug 1524317: configure --without-threads fails to buildTim Peters2006-07-191-48/+47
| | | | | | | | | | | | | | | | | | Moved the code for _PyThread_CurrentFrames() up, so it's no longer in a huge "#ifdef WITH_THREAD" block (I didn't realize it /was/ in one). Changed test_sys's test_current_frames() so it passes with or without thread supported compiled in. Note that test_sys fails when Python is compiled without threads, but for an unrelated reason (the old test_exit() fails with an indirect ImportError on the `thread` module). There are also other unrelated compilation failures without threads, in extension modules (like ctypes); at least the core compiles again. Do we really support --without-threads? If so, there are several problems remaining.
* Reported by Klocwork #151.Neal Norwitz2006-07-171-2/+13
| | | | | | 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.
* Fix memory leak under some conditions.Neal Norwitz2006-07-161-7/+9
| | | | Reported by Klocwork, #98.
* Bug #1512814, Fix incorrect lineno's when code within a functionNeal Norwitz2006-07-161-5/+6
| | | | had more than 255 blank lines. Byte codes need to go first, line #s second.
* Accept long options "--help" and "--version".Georg Brandl2006-07-121-4/+27
|
* Actually change the MAGIC #. Create a new section for 2.5c1 and mention the ↵Neal Norwitz2006-07-121-1/+1
| | | | impact of changing the MAGIC #.