summaryrefslogtreecommitdiff
path: root/Python/exceptions.c
AgeCommit message (Collapse)AuthorLines
2003-08-14Backport checkin:Walter Dörwald-1/+1
Fix refcount leak in the UnicodeError constructor: When parsing the constructor arguments failed, a reference to the argument tuple was leaked.
2003-08-12Backport checkins:Walter Dörwald-5/+21
* Enhance message for UnicodeEncodeError and UnicodeTranslateError. If there is only one bad character it will now be printed in a form that is a valid Python string. * Add a unicode prefix to the characters in the UnicodeEncodeError and UnicodeTranslateError message.
2003-02-24Remove unused variables.Walter Dörwald-9/+0
2003-01-31Provide __module__ attributes for functions defined in C and Python.Jeremy Hylton-6/+14
__module__ is the string name of the module the function was defined in, just like __module__ of classes. In some cases, particularly for C functions, the __module__ may be None. Change PyCFunction_New() from a function to a macro, but keep an unused copy of the function around so that we don't change the binary API. Change pickle's save_global() to use whichmodule() if __module__ is None, but add the __module__ logic to whichmodule() since it might be used outside of pickle.
2002-12-06Patch #614055: Support OpenVMS.Martin v. Löwis-0/+13
2002-11-21Fix PEP 293 related problems with --disable-unicode buildsWalter Dörwald-0/+6
reported by Michael Hudson in http://mail.python.org/pipermail/python-dev/2002-November/030299.html
2002-09-18Two more cases of switch(PySequence_Size()) without checking for case -1.Neal Norwitz-0/+7
(Same problem as last checkin for SF bug 610610) Need to clear the error and proceed. Backport candidate
2002-09-18Fix SF bug 610610 (reported by Martijn Pieters, diagnosed by Neal Norwitz).Guido van Rossum-0/+3
The switch in Exception__str__ didn't clear the error if PySequence_Size() raised an exception. Added a case -1 which clears the error and falls through to the default case. Definite backport candidate (this dates all the way to Python 2.0).
2002-09-03Add a custom __str__ method to KeyError that applies repr() to theGuido van Rossum-2/+40
missing key. (Also added a guard to SyntaxError__str__ to prevent calling PyString_Check(NULL).)
2002-09-02Removed bogus PyUnicodeTranslateError_GetEncoding, asWalter Dörwald-5/+0
UnicodeTranslateError doesn't have an encoding attribute. (Spotted by Neal Norwitz)
2002-09-02Limit the length of attribute names in exception messagesWalter Dörwald-3/+3
to prevent buffer overflows (spotted by Neal Norwitz).
2002-09-02PEP 293 implemention (from SF patch http://www.python.org/sf/432401)Walter Dörwald-0/+603
2002-08-14Added a FutureWarning for constructs that will change semantically inBarry Warsaw-1/+9
the future. Changed PEP 237 hex constant warnings from DeprecationWarning to FutureWarning. Updated the documentation.
2002-07-29Excise DL_IMPORT/EXPORT from object.h, and related files. This patchMark Hammond-2/+2
also adds 'extern' to PyAPI_DATA rather than at each declaration, as discussed with Tim and Guido.
2002-06-13Patch #568124: Add doc string macros.Martin v. Löwis-91/+58
2002-05-29As discussed on python-dev, add a mechanism to indicate featuresNeal Norwitz-0/+9
that are in the process of deprecation (PendingDeprecationWarning). Docs could be improved.
2002-03-28add comment reminding people about class hierarchy in Doc/lib/libexcs.texSkip Montanaro-0/+5
2002-03-03Patch #50002: Display line information for bad \x escapes:Martin v. Löwis-1/+2
- recognize "SyntaxError"s by the print_file_and_line attribute. - add the syntaxerror attributes to all exceptions in compile.c. Fixes #221791
2001-11-28Use PyOS_snprintf instead of sprintf.Jeremy Hylton-11/+11
Just being sure. The old code looks like it was safe, but there's no harm in double-checking.
2001-10-05weakref.ReferenceError becomes a built-in exception now that weak ref objectsFred Drake-0/+6
are moving into the core; with these changes, it will be possible for the exception to be raised without the weakref module ever being imported.
2001-08-23Introduce OverflowWarning -- to be issued when short int operationsGuido van Rossum-0/+7
are overflowing and a long int operation is substituted.
2001-08-02Merge of descr-branch back into trunk.Tim Peters-10/+23
2001-04-20Iterators phase 1. This comprises:Guido van Rossum-0/+7
new slot tp_iter in type object, plus new flag Py_TPFLAGS_HAVE_ITER new C API PyObject_GetIter(), calls tp_iter new builtin iter(), with two forms: iter(obj), and iter(function, sentinel) new internal object types iterobject and calliterobject new exception StopIteration new opcodes for "for" loops, GET_ITER and FOR_ITER (also supported by dis.py) new magic number for .pyc files new special method for instances: __iter__() returns an iterator iteration over dictionaries: "for x in dict" iterates over the keys iteration over files: "for x in file" iterates over lines TODO: documentation test suite decide whether to use a different way to spell iter(function, sentinal) decide whether "for key in dict" is a good idea use iterators in map/filter/reduce, min/max, and elsewhere (in/not in?) speed tuning (make next() a slot tp_next???)
2001-04-14Make some private symbols static.Guido van Rossum-2/+2
2001-02-28SyntaxError__init__(): Be a little more robust when picking apart theFred Drake-16/+22
location information for the SyntaxError -- do not do more than we need to, stopping as soon as an exception has been raised.
2001-02-28SF patch 404928: Support for next Cygwin gcc (2.95.2-8)Tim Peters-8/+2
2001-01-23Leak pluggin', bug fixin' and better documentin'. Specifically,Barry Warsaw-56/+72
module__doc__: Document the Warning subclass heirarchy. make_class(): Added a "goto finally" so that if populate_methods() fails, the return status will be -1 (failure) instead of 0 (success). fini_exceptions(): When decref'ing the static pointers to the exception classes, clear out their dictionaries too. This breaks a cycle from class->dict->method->class and allows the classes with unbound methods to be reclaimed. This plugs a large memory leak in a common Py_Initialize()/dosomething/Py_Finalize() loop.
2000-12-15Add definitions for standard warning category classes (PyExc_WarningGuido van Rossum-0/+36
etc.).
2000-10-24Ka-Ping Yee <ping@lfw.org>:Fred Drake-1/+1
Changes to error messages to increase consistency & clarity. This (mostly) closes SourceForge patch #101839.
2000-08-18Remove a couple of warnings turned up by "gcc -Wall".Fred Drake-2/+2
2000-08-18SyntaxError__classinit__(): Slight reorg for simplicity.Barry Warsaw-4/+4
2000-08-16SyntaxError__str__(): Fix two memory problems discovered by Insure.Barry Warsaw-4/+9
First, the allocated buffer was never freed after using it to create the PyString object. Second, it was possible that have_filename would be false (meaning that filename was not a PyString object), but that the code would still try to PyString_GET_SIZE() it.
2000-08-15my_basename(): Removes the leading path components from a path name,Fred Drake-2/+23
returning a pointer to the start of the file's "base" name; similar to os.path.basename(). SyntaxError__str__(): Use my_basename() to keep the length of the file name included in the exception message short.
2000-08-15SyntaxError__str__(): Do more formatting of the exception here, ratherFred Drake-6/+55
than depending on the site that raises the exception. If the filename and lineno attributes are set on the exception object, use them to augment the message displayed. This is part of what is needed to close SoruceForge bug #110628 (Jitterbug PR#278).
2000-08-15Fix the parent of WindowsError - both the comments in this source file, and ↵Mark Hammond-1/+1
the previous exceptions.py have WindowsError as a sub-class of OSError.
2000-07-22Fix two instances of empty argument lists, and fix styleThomas Wouters-79/+78
('PyObject** x' -> 'PyObject **x')
2000-07-16Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in eitherThomas Wouters-1/+1
comments, docstrings or error messages. I fixed two minor things in test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't"). There is a minor style issue involved: Guido seems to have preferred English grammar (behaviour, honour) in a couple places. This patch changes that to American, which is the more prominent style in the source. I prefer English myself, so if English is preferred, I'd be happy to supply a patch myself ;)
2000-07-12replace PyXXX_Length calls with PyXXX_Size callsJeremy Hylton-8/+9
2000-07-12Worm around MSVC6 error on single string literal > 2Kb.Tim Peters-2/+7
2000-07-11Create two new exceptions: IndentationError and TabError. These areFred Drake-0/+17
used for indentation related errors. This patch includes Ping's improvements for indentation-related error messages. Closes SourceForge patches #100734 and #100856.
2000-07-09Exception__str__(): In case 1, be sure to decref the tmp localBarry Warsaw-4/+8
variable. This crushes another memory leak. Slight rewrite included.
2000-07-09EnvironmentError__init__(): The two case clauses were missingBarry Warsaw-3/+9
`break's. This first missing break caused a memory leak when case 3 fell through case 2 in the following example: import os os.chmod('/missing', 0600)
2000-07-01init_exceptions(): Decref `doc' so it doesn't leak.Barry Warsaw-0/+1
2000-06-30replace constant 1 with symbolic constant METH_VARARGSJeremy Hylton-9/+9
another typo caught by Rob Hooft
2000-06-20mark SyntaxError__str__ as METH_VARARGSJeremy Hylton-1/+1
2000-05-26The standard exception classes. Moved here from ../Modules/_exceptions.cBarry Warsaw-0/+994