summaryrefslogtreecommitdiffstats
path: root/Python/exceptions.c
Commit message (Collapse)AuthorAgeFilesLines
* Add a custom __str__ method to KeyError that applies repr() to theGuido van Rossum2002-09-031-2/+40
| | | | | missing key. (Also added a guard to SyntaxError__str__ to prevent calling PyString_Check(NULL).)
* Removed bogus PyUnicodeTranslateError_GetEncoding, asWalter Dörwald2002-09-021-5/+0
| | | | | UnicodeTranslateError doesn't have an encoding attribute. (Spotted by Neal Norwitz)
* Limit the length of attribute names in exception messagesWalter Dörwald2002-09-021-3/+3
| | | | to prevent buffer overflows (spotted by Neal Norwitz).
* PEP 293 implemention (from SF patch http://www.python.org/sf/432401)Walter Dörwald2002-09-021-0/+603
|
* Added a FutureWarning for constructs that will change semantically inBarry Warsaw2002-08-141-1/+9
| | | | | the future. Changed PEP 237 hex constant warnings from DeprecationWarning to FutureWarning. Updated the documentation.
* Excise DL_IMPORT/EXPORT from object.h, and related files. This patchMark Hammond2002-07-291-2/+2
| | | | | also adds 'extern' to PyAPI_DATA rather than at each declaration, as discussed with Tim and Guido.
* Patch #568124: Add doc string macros.Martin v. Löwis2002-06-131-91/+58
|
* As discussed on python-dev, add a mechanism to indicate featuresNeal Norwitz2002-05-291-0/+9
| | | | | that are in the process of deprecation (PendingDeprecationWarning). Docs could be improved.
* add comment reminding people about class hierarchy in Doc/lib/libexcs.texSkip Montanaro2002-03-281-0/+5
|
* Patch #50002: Display line information for bad \x escapes:Martin v. Löwis2002-03-031-1/+2
| | | | | | - recognize "SyntaxError"s by the print_file_and_line attribute. - add the syntaxerror attributes to all exceptions in compile.c. Fixes #221791
* Use PyOS_snprintf instead of sprintf.Jeremy Hylton2001-11-281-11/+11
| | | | | Just being sure. The old code looks like it was safe, but there's no harm in double-checking.
* weakref.ReferenceError becomes a built-in exception now that weak ref objectsFred Drake2001-10-051-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.
* Introduce OverflowWarning -- to be issued when short int operationsGuido van Rossum2001-08-231-0/+7
| | | | are overflowing and a long int operation is substituted.
* Merge of descr-branch back into trunk.Tim Peters2001-08-021-12/+25
|
* Iterators phase 1. This comprises:Guido van Rossum2001-04-201-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???)
* Make some private symbols static.Guido van Rossum2001-04-141-2/+2
|
* SyntaxError__init__(): Be a little more robust when picking apart theFred Drake2001-02-281-16/+22
| | | | | location information for the SyntaxError -- do not do more than we need to, stopping as soon as an exception has been raised.
* SF patch 404928: Support for next Cygwin gcc (2.95.2-8)Tim Peters2001-02-281-8/+2
|
* Leak pluggin', bug fixin' and better documentin'. Specifically,Barry Warsaw2001-01-231-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.
* Add definitions for standard warning category classes (PyExc_WarningGuido van Rossum2000-12-151-0/+36
| | | | etc.).
* Ka-Ping Yee <ping@lfw.org>:Fred Drake2000-10-241-1/+1
| | | | | | Changes to error messages to increase consistency & clarity. This (mostly) closes SourceForge patch #101839.
* Remove a couple of warnings turned up by "gcc -Wall".Fred Drake2000-08-181-2/+2
|
* SyntaxError__classinit__(): Slight reorg for simplicity.Barry Warsaw2000-08-181-4/+4
|
* SyntaxError__str__(): Fix two memory problems discovered by Insure.Barry Warsaw2000-08-161-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.
* my_basename(): Removes the leading path components from a path name,Fred Drake2000-08-151-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.
* SyntaxError__str__(): Do more formatting of the exception here, ratherFred Drake2000-08-151-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).
* Fix the parent of WindowsError - both the comments in this source file, and ↵Mark Hammond2000-08-151-1/+1
| | | | the previous exceptions.py have WindowsError as a sub-class of OSError.
* Fix two instances of empty argument lists, and fix styleThomas Wouters2000-07-221-79/+78
| | | | ('PyObject** x' -> 'PyObject **x')
* Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in eitherThomas Wouters2000-07-161-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 ;)
* replace PyXXX_Length calls with PyXXX_Size callsJeremy Hylton2000-07-121-8/+9
|
* Worm around MSVC6 error on single string literal > 2Kb.Tim Peters2000-07-121-2/+7
|
* Create two new exceptions: IndentationError and TabError. These areFred Drake2000-07-111-0/+17
| | | | | | | used for indentation related errors. This patch includes Ping's improvements for indentation-related error messages. Closes SourceForge patches #100734 and #100856.
* Exception__str__(): In case 1, be sure to decref the tmp localBarry Warsaw2000-07-091-4/+8
| | | | | variable. This crushes another memory leak. Slight rewrite included.
* EnvironmentError__init__(): The two case clauses were missingBarry Warsaw2000-07-091-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)
* init_exceptions(): Decref `doc' so it doesn't leak.Barry Warsaw2000-07-011-0/+1
|
* replace constant 1 with symbolic constant METH_VARARGSJeremy Hylton2000-06-301-9/+9
| | | | another typo caught by Rob Hooft
* mark SyntaxError__str__ as METH_VARARGSJeremy Hylton2000-06-201-1/+1
|
* The standard exception classes. Moved here from ../Modules/_exceptions.cBarry Warsaw2000-05-261-0/+994