Barry Warsaw
cde8b1ba0c
Two new built-in functions: issubclass() and isinstance(). Both take
classes as their second arguments. The former takes a class as the
first argument and returns true iff first is second, or is a subclass
of second.
The latter takes any object as the first argument and returns true iff
first is an instance of the second, or any subclass of second.
Also, change all occurances of pointer compares against
PyExc_IndexError with PyErr_ExceptionMatches() calls.
29 years ago
Guido van Rossum
25ce566661
The last of the mass checkins for separate (sub)interpreters.
Everything should now work again.
See the comments for the .h files mass checkin (e.g. pystate.h) for
more detail.
29 years ago
Guido van Rossum
c8b6df9004
PyObject_Compare can raise an exception now.
29 years ago
Guido van Rossum
b6a7f77c9f
Oops -- missed FloatingPointError in renaming.
30 years ago
Guido van Rossum
b05a5c7698
Instead of importing graminit.h whenever one of the three grammar 'root'
symbols is needed, define these in Python.h with a Py_ prefix.
30 years ago
Guido van Rossum
666b17a280
New dir() function --
- uses abstract interface where possible
- uses __members__ and __methods__
- returns [] when an object has no info available
30 years ago
Guido van Rossum
15e33a4c42
Avoid sprintf buffer overflow if more than 9999 arguments.
30 years ago
Guido van Rossum
79f25d9a7b
Quickly renamed the remaining files -- this directory is done.
30 years ago
Guido van Rossum
6bf62dad9e
Keep gcc -Wall and Microsoft VC happy.
30 years ago
Guido van Rossum
c6472e9ee1
1. Add string conversions to int(), long(), float(). (Not to complex()!)
2. Fix two bugs in complex():
- Memory leak when using complex(classinstance) -- r was never
DECREF'ed.
- Conversion of the second argument, if not complex, was done using
the type vector of the 1st.
30 years ago
Guido van Rossum
1c6a459921
Define __debug__ as 0 if -O is given, 1 otherwise. Also test for
errors in initializing the dictionary.
30 years ago
Guido van Rossum
0ae748d3c4
Changes for Lee Busby's SIGFPE patch set.
New file pyfpe.c and exception FloatingPointError.
Surround some f.p. operations with PyFPE macro brackets.
30 years ago
Guido van Rossum
e8811f85ed
Added intern() function.
30 years ago
Guido van Rossum
8d75161671
Intern the string "__complex__".
30 years ago
Guido van Rossum
1a2c5cbcc4
Add unistd.h to make gcc -Wall happy.
30 years ago
Guido van Rossum
ed0af8fe70
Support __complex__ method on instances, for complex() conversion.
Keep gcc -Wall happy.
30 years ago
Guido van Rossum
d266eb460e
New permission notice, includes CNRI.
30 years ago
Guido van Rossum
b75fba04c7
Forget about Ellipses b/w compatibility.
30 years ago
Guido van Rossum
e449af7da9
Ellipses -> Ellipsis rename (the dictionary really says that it should
be Ellipsis!).
Bumped the API version because a linker-visible symbol is affected.
Old C code will still compile -- there's a b/w compat macro.
Similarly, old Python code will still run, builtin exports both
Ellipses and Ellipsis.
30 years ago
Guido van Rossum
b072150d7f
Stupid bug: complex(x,y) would yield x+xj
30 years ago
Guido van Rossum
79d96d6bff
Don't die in resizestring() on filter(<func>, "").
30 years ago
Guido van Rossum
fe4b6ee775
Include mymath.h instead of declaring prototypes for math functions.
Fix leak and unchecked error in complex().
30 years ago
Guido van Rossum
6ffd553899
Add 'Ellipses' object.
30 years ago
Guido van Rossum
8861b74445
Changes for slice and ellipses
30 years ago
Guido van Rossum
530956d247
Py_complex; and WITHOUT_COMPLEX added to getargs.c
30 years ago
Guido van Rossum
795ba583f2
Removed some redundant header includes.
dir(object) now returns object.__dict__.keys() even if __dict__ is not
a dictionary.
30 years ago
Guido van Rossum
d17057745c
Add list() method, analogous to tuple().
31 years ago
Guido van Rossum
c96ef6ab9e
properly initialize optional arguments to apply()
31 years ago
Guido van Rossum
8a5c5d277e
changes for complex numbers
31 years ago
Guido van Rossum
b7b45627e8
avoid resize of 0-length tuple
31 years ago
Guido van Rossum
53bb7fff11
be more suspicious of getlocals()
31 years ago
Guido van Rossum
681d79aaf3
keyword arguments and faster calls
31 years ago
Guido van Rossum
32120311ed
rename arglist to alist (conflict with new grammar symbol)
31 years ago
Guido van Rossum
872537cc86
added locals() and globals(); [raw_]input() uses readline()
31 years ago
Guido van Rossum
8a1e8eb62f
fix bogus test for negative float
32 years ago
Guido van Rossum
24c137432c
call __import__() with 4 args instead of 1
32 years ago
Guido van Rossum
2165158ab3
test for float to the float power here
32 years ago
Guido van Rossum
a6f6050229
moved callable() to object.c
32 years ago
Guido van Rossum
7f9fa97ca2
fix import related leaks
32 years ago
Guido van Rossum
0865dd9ce9
fix Alpha bug in (x)range; different __builtins__ initialization
32 years ago
Guido van Rossum
58b6873f6b
fix subtle refcount big in filter() -- Tim MacKenzie
32 years ago
Guido van Rossum
5524a59b09
move coerce() from bltinmodule.c to object.c and implement builtin_coerce() differently
32 years ago
Guido van Rossum
84eaa8396e
fix globals/locals defaults for eval/execfile
32 years ago
Guido van Rossum
6135a87f2b
__builtins__ mods (and sys_checkinterval for ceval.c)
32 years ago
Guido van Rossum
6a00cd8b89
* Python/bltinmodule.c: restructured coerce(), divmod(), pow() to
use new instancebinop interface
32 years ago
Guido van Rossum
6d023c98b0
Added 1995 to copyright message.
bltinmodule.c: fixed coerce() nightmare in ternary pow().
modsupport.c (initmodule2): pass METH_FREENAME flag to newmethodobject().
pythonrun.c: move flushline() into and around print_error().
32 years ago
Guido van Rossum
1ae940a587
Lots of changes, most minor (fatal() instead of abort(), use of
err_fetch/err_restore and so on). But...
NOTE: import.c has been rewritten and all the DL stuff is now in the
new file importdl.c.
32 years ago
Guido van Rossum
030ae17582
fix pow() core dump
32 years ago
Guido van Rossum
180d7b4d55
* Python/ceval.c, Include/ceval.h: promote MakePendingCalls to
global: Py_MakePendingCalls. Also guard against recursive calls
* Include/classobject.h, Objects/classobject.c,
Python/{ceval.c,bltinmodule.c}: entirely redone operator
overloading. The rules for class instances are now much more
relaxed than for other built-in types
(whose coerce must still return two objects of the same type)
32 years ago
Guido van Rossum
e4ab6475f1
* Python/getmtime.c: Remove mac specifics (Mac subdirectory has
its own version now)
* Python/bltinmodule.c (builtin_tuple): use pre-existing
listtuple(v) for lists
32 years ago