Commit Graph

68 Commits

Author SHA1 Message Date
Martin v. Löwis 95292d6caa Constify filenames and scripts. Fixes #651362. 2002-12-11 14:04:59 +00:00
Martin v. Löwis 79acb9edfa Patch #614055: Support OpenVMS. 2002-12-06 12:48:53 +00:00
Walter Dörwald bf73db835a Fix PEP 293 related problems with --disable-unicode builds
reported by Michael Hudson in
http://mail.python.org/pipermail/python-dev/2002-November/030299.html
2002-11-21 20:08:33 +00:00
Mark Hammond c2e85bd4e2 Patch 594001: PEP 277 - Unicode file name support for Windows NT. 2002-10-03 05:10:39 +00:00
Neil Schemenauer 96aa0acef0 Use Py_GCC_ATTRIBUTE instead of __attribute__. Compilers other than GCC
might use __attribute__ in other ways (e.g. CodeWarrior).
2002-09-15 14:09:54 +00:00
Walter Dörwald 70bb0d4e65 Removed bogus PyUnicodeTranslateError_GetEncoding, as
UnicodeTranslateError doesn't have an encoding attribute.
(Spotted by Neal Norwitz)
2002-09-02 16:41:55 +00:00
Walter Dörwald 3aeb632c31 PEP 293 implemention (from SF patch http://www.python.org/sf/432401) 2002-09-02 13:14:32 +00:00
Barry Warsaw 9f00739551 Added a FutureWarning for constructs that will change semantically in
the future.  Changed PEP 237 hex constant warnings from
DeprecationWarning to FutureWarning.  Updated the documentation.
2002-08-14 15:51:29 +00:00
Mark Hammond 91a681debf Excise DL_EXPORT from Include.
Thanks to Skip Montanaro and Kalle Svensson for the patches.
2002-08-12 07:21:58 +00:00
Thomas Heller 085358a3e2 New functions for extension writers on Windows:
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.
2002-07-29 14:27:41 +00:00
Neal Norwitz d68f5171eb As discussed on python-dev, add a mechanism to indicate features
that are in the process of deprecation (PendingDeprecationWarning).
Docs could be improved.
2002-05-29 15:54:55 +00:00
Tim Peters faad5ad590 mysnprintf.c: Massive rewrite of PyOS_snprintf and PyOS_vsnprintf, to
use wrappers on all platforms, to make this as consistent as possible x-
platform (in particular, make sure there's at least one \0 byte in
the output buffer).  Also document more of the truth about what these do.

getargs.c, seterror():  Three computations of remaining buffer size were
backwards, thus telling PyOS_snprintf the buffer is larger than it
actually is.  This matters a lot now that PyOS_snprintf ensures there's a
trailing \0 byte (because it didn't get the truth about the buffer size,
it was storing \0 beyond the true end of the buffer).

sysmodule.c, mywrite():  Simplify, now that PyOS_vsnprintf guarantees to
produce a \0 byte.
2001-12-03 00:43:33 +00:00
Tim Peters a437d4594b Removed preprocessor gimmick trying to force use of snprintf emulation
before 2.2b1.
2001-11-28 16:51:49 +00:00
Neil Schemenauer 90b689076a Add function attributes that allow GCC to check the arguments of printf-like
functions.
2001-10-23 02:21:22 +00:00
Fred Drake bb9fa21cfe weakref.ReferenceError becomes a built-in exception now that weak ref objects
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-10-05 21:50:08 +00:00
Guido van Rossum ae347b33be Introduce OverflowWarning -- to be issued when short int operations
are overflowing and a long int operation is substituted.
2001-08-23 02:56:07 +00:00
Marc-André Lemburg 03d1b1814b Enable PyOS_snprintf() et al. during alpha phase of 2.2.0 and
add another use case to the socketmodule.
2001-07-31 18:05:33 +00:00
Marc-André Lemburg cecd9e0af3 va_list is defined in stdarg.h. 2001-07-31 14:23:52 +00:00
Marc-André Lemburg e5006ebc9d This patch turns the Python API mismatch notice into a standard
Python warning which can be catched by means of the Python warning
framework.

It also adds two new APIs which hopefully make it easier for Python
to switch to buffer overflow safe [v]snprintf() APIs for error
reporting et al. The two new APIs are PyOS_snprintf() and
PyOS_vsnprintf() and work just like the standard ones in many
C libs. On platforms which have snprintf(), the native APIs are used,
on all other an emulation with snprintf() tries to do its best.
2001-07-31 13:24:44 +00:00
Guido van Rossum 59d1d2b434 Iterators phase 1. This comprises:
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-20 19:13:02 +00:00
Guido van Rossum 1bcb7e9327 Add declaration for PyErr_WarnExplicit(). 2001-02-28 21:44:20 +00:00
Jeremy Hylton ad3d3f2f3f Improve SyntaxErrors for bad future statements. Set file and location
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().
2001-02-28 17:47:12 +00:00
Guido van Rossum 3fc30372c7 Add declarations for standard warning category classes (PyExc_Warning
etc.) and the PyErr_Warn() function.
2000-12-15 21:57:34 +00:00
Guido van Rossum 8586991099 REMOVED all CWI, CNRI and BeOpen copyright markings.
This should match the situation in the 1.6b1 tree.
2000-09-01 23:29:29 +00:00
Jeremy Hylton b709df3810 refactor __del__ exception handler into PyErr_WriteUnraisable
add sanity check to gc: if an exception occurs during GC, call
PyErr_WriteUnraisable and then call Py_FatalEror.
2000-09-01 02:47:25 +00:00
Fred Drake 6d63adfbb7 Improve the exceptions raised by PyErr_BadInternalCall(); adding the
filename and line number of the call site to allow esier debugging.

This closes SourceForge patch #101214.
2000-08-24 22:38:39 +00:00
Fred Drake d5c84ede06 ANSI-fication of the sources -- remove Py_PROTO! 2000-07-08 17:25:55 +00:00
Guido van Rossum ffcc3813d8 Change copyright notice - 2nd try. 2000-06-30 23:58:06 +00:00
Guido van Rossum fd71b9e9d4 Change copyright notice. 2000-06-30 23:50:40 +00:00
Guido van Rossum 99cc97109e Marc-Andre Lemburg: add PyExc_UnicodeError 2000-03-10 22:33:32 +00:00
Guido van Rossum db0c9f7f5b Declarations related to new WindowsError exception. 2000-02-17 15:17:18 +00:00
Guido van Rossum 8746082175 Patch by Tim Peters:
Introduce a new builtin exception, UnboundLocalError, raised when ceval.c
tries to retrieve or delete a local name that isn't bound to a value.
Currently raises NameError, which makes this behavior a FAQ since the same
error is raised for "missing" global names too:  when the user has a global
of the same name as the unbound local, NameError makes no sense to them.
Even in the absence of shadowing, knowing whether a bogus name is local or
global is a real aid to quick understanding.

Example:

D:\src\PCbuild>type local.py
x = 42

def f():
    print x
    x = 13
    return x

f()

D:\src\PCbuild>python local.py
Traceback (innermost last):
  File "local.py", line 8, in ?
    f()
  File "local.py", line 4, in f
    print x
UnboundLocalError: x

D:\src\PCbuild>

Note that UnboundLocalError is a subclass of NameError, for compatibility
with existing class-exception code that may be trying to catch this as a
NameError.  Unfortunately, I see no way to make this wholly compatible
with -X (see comments in bltinmodule.c):  under -X, [UnboundLocalError
is an alias for NameError --GvR].

[The ceval.c patch differs slightly from the second version that Tim
submitted; I decided not to raise UnboundLocalError for DELETE_NAME,
only for DELETE_LOCAL.  DELETE_NAME is only generated at the module
level, and since at that level a NameError is raised for referencing
an undefined name, it should also be raised for deleting one.]
1999-06-22 14:47:32 +00:00
Guido van Rossum 43466ec7b0 Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
Barry Warsaw d052ff0e57 Added PyExc_NotImplementedError 1998-12-01 18:34:01 +00:00
Barry Warsaw 62a21a2ebe New global variables: PyExc_EnvironmentError and PyExc_OSError
New function: PyErr_SetFromErrnoWithFilename(PyObject* char*)
1998-07-23 15:57:34 +00:00
Guido van Rossum 2d2c34445b New API PyErr_NewException(name, base, dict) to create simple new exceptions. 1997-09-16 21:50:37 +00:00
Barry Warsaw 65349a3936 [Py_Exc]NumberError => [Py_Exc]ArithmeticError 1997-09-16 21:50:36 +00:00
Guido van Rossum 0474832d9c Introduce PyExc_Exception as the conceptual root class for all exceptions. 1997-09-16 18:43:15 +00:00
Barry Warsaw 392d8272bf Added externs for three new exceptions PyExc_StandardError,
PyExc_NumberError, and PyExc_LookupError.  Also added extern for
pre-instantiated exception instance PyExc_MemoryErrorInst.

Removed extern of obsolete exception PyExc_AccessError.
1997-08-29 21:56:07 +00:00
Barry Warsaw c0dc92af7d Three new C API functions:
- 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.
1997-08-22 21:22:58 +00:00
Guido van Rossum 6fa4466cec Added AssertionError. 1997-04-02 05:22:53 +00:00
Guido van Rossum 94dbd99483 Remove ConflictError (which was also removed from bltinmodule.c, even
though the checkin message failed to note that).
1997-03-31 17:19:40 +00:00
Guido van Rossum 7d4266ed5a Changes for Lee Busby's SIGFPE patch set.
New file pyfpe.h, new exception FloatingPointError.
1997-02-14 22:53:12 +00:00
Guido van Rossum c4193f1547 Added prototype for PyErr_Format(exception, formatstring, ...) -> NULL. 1997-02-14 17:10:25 +00:00
Barry Warsaw f3f41a9e57 Added declaration for PyErr_SetInterrupt. 1997-01-03 00:15:03 +00:00
Guido van Rossum 067998f35e Add const to error and newstring functions 1996-12-10 15:33:34 +00:00
Guido van Rossum d266eb460e New permission notice, includes CNRI. 1996-10-25 14:44:06 +00:00
Guido van Rossum 051ab123b4 make the type a parameter of the DL_IMPORT macro, for Borland C 1995-02-27 10:17:52 +00:00
Guido van Rossum 938178283c new names for lots of new functions 1995-01-17 16:01:01 +00:00
Guido van Rossum caa6380886 The great renaming, phase two: all header files have been updated to
use the new names exclusively, and the linker will see the new names.
Files that import "Python.h" also only see the new names.  Files that
import "allobjects.h" will continue to be able to use the old names,
due to the inclusion (in allobjects.h) of "rename2.h".
1995-01-12 11:45:45 +00:00