summaryrefslogtreecommitdiffstats
path: root/Python/errors.c
Commit message (Collapse)AuthorAgeFilesLines
* Constify filenames and scripts. Fixes #651362.Martin v. Löwis2002-12-111-5/+5
|
* Fix [ 616716 ] Bug in PyErr_SetExcFromWindowsMark Hammond2002-10-041-9/+28
| | | | | | Ensure that even if FormatMessage fails we (a) don't crash, and (b) provide something useful. Bugfix candidate.
* Fix errors to pep277 checkin identified by Neal Norwitz.Mark Hammond2002-10-041-3/+3
|
* Patch 594001: PEP 277 - Unicode file name support for Windows NT.Mark Hammond2002-10-031-10/+82
|
* New functions for extension writers on Windows:Thomas Heller2002-07-291-3/+17
| | | | | | | | | | PyErr_SetExcFromWindowsErr(), PyErr_SetExcFromWindowsErrWithFilename(). Similar to PyErr_SetFromWindowsErrWithFilename() and PyErr_SetFromWindowsErr(), but they allow to specify the exception type to raise. Available on Windows. See SF patch #576458.
* Patch #569753: Remove support for WIN16.Martin v. Löwis2002-06-301-4/+4
| | | | Rename all occurrences of MS_WIN32 to MS_WINDOWS.
* Mass checkin of universal newline support.Jack Jansen2002-04-141-2/+2
| | | | | | | | Highlights: import and friends will understand any of \r, \n and \r\n as end of line. Python file input will do the same if you use mode 'U'. Everything can be disabled by configuring with --without-universal-newlines. See PEP278 for details.
* Patch #494045: patches errno and stat to cope on plan9.Martin v. Löwis2002-03-091-1/+9
|
* Patch #50002: Display line information for bad \x escapes:Martin v. Löwis2002-03-031-1/+23
| | | | | | - recognize "SyntaxError"s by the print_file_and_line attribute. - add the syntaxerror attributes to all exceptions in compile.c. Fixes #221791
* SF bug [#467265] Compile errors on SuSe Linux on IBM/s390.Tim Peters2001-10-021-1/+1
| | | | | | | Unknown whether this fixes it. - stringobject.c, PyString_FromFormatV: don't assume that va_list is of a type that can be copied via an initializer. - errors.c, PyErr_Format: add a va_end() to balance the va_start().
* PyErr_NormalizeException()Jeremy Hylton2001-09-261-1/+12
| | | | | | | | | | | | | | | | | | If a new exception occurs while an exception instance is being created, try harder to make sure there is a traceback. If the original exception had a traceback associated with it and the new exception does not, keep the old exception. Of course, callers to PyErr_NormalizeException() must still be prepared to have tb set to NULL. XXX This isn't an ideal solution, but it's better than no traceback at all. It occurs if, for example, the exception occurs when the call to the constructor fails before any Python code is executed. Guido suggests that it there is Python code that was about to be executed -- but wasn't, say, because it was called with the wrong number of arguments -- then we should point at the first line of the code object anyway.
* PyErr_Format(): Factor out most of this code intoBarry Warsaw2001-08-241-114/+1
| | | | | PyString_FromFormat() since it's much more generally useful than just for exceptions.
* PyErr_Occurred(): Use PyThreadState_GET(), which saves a tiny function callTim Peters2001-05-301-1/+1
| | | | | | | | in release builds. Suggested by Martin v. Loewis. I'm half tempted to macroize PyErr_Occurred too, as the whole thing could collapse to just _PyThreadState_Current->curexc_type
* Use Py_CHARMASK for ctype macros. Fixes bug #232787.Martin v. Löwis2001-03-061-4/+4
|
* Add PyErr_WarnExplicit(), which calls warnings.warn_explicit(), withGuido van Rossum2001-02-281-0/+42
| | | | explicit filename, lineno etc. arguments.
* Improve SyntaxErrors for bad future statements. Set file and locationJeremy Hylton2001-02-281-0/+79
| | | | | | | for errors raised in future.c. Move some helper functions from compile.c to errors.c and make them API functions: PyErr_SyntaxLocation() and PyErr_ProgramText().
* Add PyErr_Warn().Guido van Rossum2000-12-151-0/+34
|
* 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.
* Avoid a couple of "value computed is not used" warnings from gcc -Wall;Fred Drake2000-10-101-2/+2
| | | | | | | these computations are required for their side effects in traversing the variable arguments list. Reported by Marc-Andre Lemburg <mal@lemburg.com>.
* REMOVED all CWI, CNRI and BeOpen copyright markings.Guido van Rossum2000-09-011-9/+0
| | | | This should match the situation in the 1.6b1 tree.
* code part of patch #100895 by Fredrik LundhJeremy Hylton2000-09-011-4/+124
| | | | | PyErr_Format computes size of buffer needed rather than relying on static buffer.
* refactor __del__ exception handler into PyErr_WriteUnraisableJeremy Hylton2000-09-011-0/+27
| | | | | add sanity check to gc: if an exception occurs during GC, call PyErr_WriteUnraisable and then call Py_FatalEror.
* Improve the exceptions raised by PyErr_BadInternalCall(); adding theFred Drake2000-08-241-2/+15
| | | | | | filename and line number of the call site to allow esier debugging. This closes SourceForge patch #101214.
* Do not set a MemoryError exception over another MemoryError exception,Vladimir Marangozov2000-08-181-0/+4
| | | | thus preserving the first one that has been raised.
* Avoid dumping core when PyErr_NormalizeException() is called withoutGuido van Rossum2000-08-071-0/+6
| | | | an exception set. This shouldn't happen, but we see it at times...
* Mass ANSIfication of function definitions. Doesn't cover all 'extern'Thomas Wouters2000-07-221-51/+17
| | | | declarations yet, those come later.
* delete obsolete SYMANTEC__CFM68K__ #ifdefsSkip Montanaro2000-07-121-4/+0
|
* Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.Tim Peters2000-07-091-2/+2
|
* Change copyright notice - 2nd try.Guido van Rossum2000-06-301-6/+0
|
* Change copyright notice.Guido van Rossum2000-06-301-22/+7
|
* PyErr_GivenExceptionMatches(): Check for err==NULL and exc==NULL andBarry Warsaw2000-05-021-2/+6
| | | | | | | | | | return 0 (exceptions don't match). This means that if an ImportError is raised because exceptions.py can't be imported, the interpreter will exit "cleanly" with an error message instead of just core dumping. PyErr_SetFromErrnoWithFilename(), PyErr_SetFromWindowsErrWithFilename(): Don't test on Py_UseClassExceptionsFlag.
* Mark discovered a bug in his patch: he didn't *use* PyExc_WindowsErrorGuido van Rossum2000-03-021-1/+1
| | | | in PyErr_SetFromWindowsErrWithFilename() like he intended to... :-)
* Mark pointed out a buglet in his patch: i < _sys_nerr isn't strongGuido van Rossum2000-02-211-1/+1
| | | | | enough, it could be negative. Add i > 0 test. (Not i >= 0; zero isn't a valid error number.)
* Patch by Mark Hammond:Guido van Rossum2000-02-171-15/+75
| | | | | | | | | | * Changes to a recent patch by Chris Tismer to errors.c. Chris' patch always used FormatMessage() to get the error message passing the error code from errno - but errno and FormatMessage use a different numbering scheme. The main reason the patch looked OK was that ENOFILE==ERROR_FILE_NOT_FOUND - but that is about the only shared error code :-). The MS CRT docs tell you to use _sys_errlist()/_sys_nerr. My patch does also this, and adds a very similar function specifically for win32 error codes.
* Patch by Christian Tismer for Win32, to use FormatMessage() instead ofGuido van Rossum1999-04-211-2/+29
| | | | strerror(). This improves the quality of the error messages.
* Use PyThreadState_GET() macro.Guido van Rossum1998-12-211-1/+1
|
* When errno is zero, avoid calling strerror() and use "Error" for theGuido van Rossum1998-10-141-2/+7
| | | | message.
* PyErr_SetFromErrnoWithFilename(): New function which supports settingBarry Warsaw1998-07-231-2/+14
| | | | | | | | | | | an exception from errno, with a supplied filename (primarily used by IOError and OSError). If class exceptions are used then the exception is instantiated with a 3-tuple: (errno, strerror, filename). For backwards compatibility reasons, if string exceptions are used, filename is ignored. PyErr_SetFromErrno(): Implement in terms of PyErr_SetFromErrnoWithFilename().
* 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.
* New version of PyErr_NewException() that is compatible with -X option.Guido van Rossum1997-10-031-14/+35
|
* PyErr_NormalizeException(): If the exception's type is a class and theBarry Warsaw1997-09-301-0/+8
| | | | | instance's class is a subclass of this, then use the instance's class as the exception type.
* New API PyErr_NewException(name, base, dict) to create simple new exceptions.Guido van Rossum1997-09-161-0/+31
|
* PyErr_NoMemory(): If the pre-instantiated memory exception is non-nullBarry Warsaw1997-08-291-1/+9
| | | | | | (PyExc_MemoryErrorInst) raise this instead of PyExc_MemoryError. This only happens when exception classes are enabled (e.g. when Python is started with -X).
* Three new C API functions:Barry Warsaw1997-08-221-0/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | - int PyErr_GivenExceptionMatches(obj1, obj2) Returns 1 if obj1 and obj2 are the same object, or if obj1 is an instance of type obj2, or of a class derived from obj2 - int PyErr_ExceptionMatches(obj) Higher level wrapper around PyErr_GivenExceptionMatches() which uses PyErr_Occurred() as obj1. This will be the more commonly called function. - void PyErr_NormalizeException(typeptr, valptr, tbptr) Normalizes exceptions, and places the normalized values in the arguments. If type is not a class, this does nothing. If type is a class, then it makes sure that value is an instance of the class by: 1. if instance is of the type, or a class derived from type, it does nothing. 2. otherwise it instantiates the class, using the value as an argument. If value is None, it uses an empty arg tuple, and if the value is a tuple, it uses just that.
* Use strerror on the mac if using MSL (Jack).Guido van Rossum1997-08-121-6/+0
|
* Massive changes for separate thread state management.Guido van Rossum1997-05-051-32/+44
| | | | | All per-thread globals are moved into a struct which is manipulated separately.
* Quickly renamed. Also removed the long comment explaining why this isGuido van Rossum1997-04-291-90/+56
| | | | better than the old error API.
* Keep Microsoft VC happy.Guido van Rossum1997-04-111-0/+2
|
* (Jack:) On the Mac, use standard strerror() if using MSL C-library.Guido van Rossum1997-04-111-0/+2
|
* Oops, remove an unused variable from PyErr_Format().Guido van Rossum1997-02-141-1/+0
|