Guido van Rossum
f3e85a0356
Changes that appear to give another 12% speedup.
...
Rather than allocating a list object for the fast locals and another
(extensible one) for the value stack and allocating the block stack
dynamically, allocate the block stack with a fixed size (CO_MAXBLOCKS
from compile.h), and stick the locals and value stack at the end of
the object (this is now possible since the stack size is known
beforehand). Get rid of the owner field and the nvalues argument --
it is available in the code object, like nlocals.
This requires small changes in ceval.c only.
1997-01-20 04:20:52 +00:00
Guido van Rossum
a412d24be0
Intern the various string objects created to speed up lookups.
1997-01-18 07:59:12 +00:00
Guido van Rossum
b56933ed2e
Intern the strings "__builtins__".
1997-01-18 07:58:41 +00:00
Guido van Rossum
c6d0670f1b
Intern the strings created in getattr() and setattr().
1997-01-18 07:57:16 +00:00
Guido van Rossum
2a61e7428d
String interning.
1997-01-18 07:55:05 +00:00
Guido van Rossum
792fd435ec
Comment out extend_stack() -- it is no longer needed.
1997-01-17 21:07:57 +00:00
Guido van Rossum
7d18159614
Rewrote lookmapping() according to suggestions by Jyrki Alakuijala.
1997-01-16 21:06:45 +00:00
Guido van Rossum
6f72f97c03
Increased buffer sizes used by hex() and oct() -- on 64-bit or 128-bit
...
machines, the string may get longer than 20 characters!
1997-01-14 15:43:41 +00:00
Guido van Rossum
ebee0256f3
Changed hex() and oct() again, to never emit a '-' sign.
1997-01-12 19:48:03 +00:00
Guido van Rossum
919cf1aff1
New, better hash for floating point and complex
1997-01-11 19:26:21 +00:00
Guido van Rossum
80dd9b6672
Subtle change to hex/oct formatting so the largest negative number
...
does not receive a minus sign.
1997-01-10 17:39:30 +00:00
Guido van Rossum
541cdd84ac
Fix overflow test for multiply to catch some cases it missed.
...
Added warning about dependency of float/complex hash on int hash.
1997-01-06 22:53:20 +00:00
Guido van Rossum
53756b1097
Added PyLong_FromUnsignedLong() and PyLong_AsUnsignedLong().
1997-01-03 17:14:46 +00:00
Guido van Rossum
babab6869f
Removed all traces of accessobject.c.
1996-12-25 19:22:49 +00:00
Barry Warsaw
f90eddef5d
PySequence_Index(): set exception when object is not found in
...
sequence, otherwise
operator.indexOf([4, 3, 2, 1], 9) would raise a SystemError!
Note: it might be wise to double check all these functions. I haven't
done that yet.
1996-12-18 19:32:18 +00:00
Guido van Rossum
0969ad213d
Better tuple hash function.
1996-12-16 17:55:46 +00:00
Guido van Rossum
cc15b42e59
Change comment about MINSIZE -- 10 is optimal for Python.
1996-12-16 03:32:39 +00:00
Guido van Rossum
3176bb1df2
Some more tuning of quicksort: use pointers instead of indexing.
1996-12-11 23:57:39 +00:00
Guido van Rossum
3f236dee3a
Added new quicksort implementation, tailored to sorting arrays of
...
object pointers. Should be a bit faster than the C library's qsort(),
and doesn't have the prohibition on recursion that Solaris qsort() has
in the threaded version of their C library.
Thanks to discussions with Tim Peters.
1996-12-10 23:55:39 +00:00
Guido van Rossum
067998f35e
Add const to error and newstring functions
1996-12-10 15:33:34 +00:00
Guido van Rossum
9478dd40c2
Fix core dump from pow(x,y,0).
...
Make gcc -Wall happy.
1996-12-06 20:14:43 +00:00
Guido van Rossum
da9c2710c7
Make gcc -Wall happy
1996-12-05 21:58:58 +00:00
Guido van Rossum
472c04f18f
Fix newlongobject so it will work for 64-bit as well as 32-bit hardware
...
(although for 32-bit hardware it's a bit slower than it was).
Make gcc -Wall happy.
1996-12-05 21:57:21 +00:00
Guido van Rossum
a0a69b8b42
Experimental new implementation of dictionary comparison. This
...
defines that a shorter dictionary is always smaller than a longer one.
For dictionaries of the same size, the smallest differing element
determines the outcome (which yields the same results as before,
without explicit sorting).
1996-12-05 21:55:55 +00:00
Guido van Rossum
685a38ea94
Make gcc -Wall happy.
1996-12-05 21:54:17 +00:00
Guido van Rossum
04f95d5238
Better implementation of PyCObject_AsVoidPtr().
1996-12-05 21:53:15 +00:00
Guido van Rossum
cbd1e4eb5f
Yet more elaborate message for exception in __del__.
...
Make gcc -Wall happy.
1996-12-05 21:52:32 +00:00
Guido van Rossum
3c5936afc5
Added missing PySequence_List.
...
Correct typo in error msg (expec[t]ed).
Make gcc -Wall happy.
1996-12-05 21:51:24 +00:00
Guido van Rossum
052b7e1cfb
Make Py_ReturnNullError() statis as it should be.
1996-11-11 15:08:19 +00:00
Guido van Rossum
08ef9d98b2
Only call sq_length in Sequence_GetItem for negative index.
1996-11-09 22:32:05 +00:00
Guido van Rossum
8dbcdd0a4c
correct typo in return variable for PySequence_Index()
1996-11-06 15:31:46 +00:00
Guido van Rossum
d266eb460e
New permission notice, includes CNRI.
1996-10-25 14:44:06 +00:00
Guido van Rossum
fde7a75b78
Fixed compare function to do first char comparison in unsigned mode,
...
for consistency with the way other characters are compared.
1996-10-23 14:19:40 +00:00
Guido van Rossum
8bcf369cf9
Support passing in an empty dictionary of keywords to newinstanceobject.
1996-10-21 15:12:32 +00:00
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.
1996-10-11 16:25:41 +00:00
Guido van Rossum
336c699236
Fix subtle bug detected by Jim F.
1996-09-30 22:00:50 +00:00
Guido van Rossum
24048580ca
Oops... Need to clear c_error before calling c_quot().
1996-09-12 21:02:02 +00:00
Guido van Rossum
3be12e97cd
Properly(?) implemented remainder and divmod (Tim Hochberg)
1996-09-12 20:56:18 +00:00
Guido van Rossum
d4ab3cde8e
Raise exception instead of dropping imag part for conversion to int,
...
long, float.
Raise exception instead of dumping core for remainder and divmod.
1996-09-11 22:54:37 +00:00
Guido van Rossum
22a85e5308
More detailed error message about exception in __del__
1996-09-11 22:51:57 +00:00
Guido van Rossum
b7fc304109
Correct typo in setattr: return -1 for error, not NULL
1996-09-11 22:51:25 +00:00
Guido van Rossum
eddcb3bae1
Multiply by 1000003 instead of 3 in string hach
1996-09-11 20:22:48 +00:00
Guido van Rossum
b23a60fd6e
Get rid of bogus MSC_VER undef of CHECK()
1996-09-11 20:21:41 +00:00
Guido van Rossum
ee09fc1c30
Don't dump core on complex % or divmod -- raise a TypeError exception.
1996-09-11 13:55:55 +00:00
Guido van Rossum
e5920bc4c6
Use getstringsize where available instead of strlen.
1996-08-26 14:58:03 +00:00
Guido van Rossum
ad8997887b
Be a bit more careful with printing a warning for a failed __del__.
1996-08-22 23:15:42 +00:00
Guido van Rossum
6cdc6f4146
Added PyObject_DelItem and PySequence_Del{Item,Slice}.
1996-08-21 17:41:54 +00:00
Guido van Rossum
019f424a0a
More efficient handling of "__doc__" lookup.
1996-08-21 14:54:28 +00:00
Guido van Rossum
89227eb0f5
Write warning about exception in __del__ to stderr, not stdout.
1996-08-20 19:54:29 +00:00
Guido van Rossum
926518b683
Changes to make the file acceptable to K&R C compilers (HPUX, SunOS 4.x).
1996-08-19 19:30:45 +00:00
Guido van Rossum
c13bcca268
Test for negative # to the nonintegral float power here.
...
Expanded powi() in-line.
1996-08-16 20:42:57 +00:00
Guido van Rossum
0dfcf753ad
Disable support for access statement
1996-08-12 22:00:53 +00:00
Guido van Rossum
aacdc9da75
Define reference count admin debug functions to return void.
1996-08-12 21:32:12 +00:00
Guido van Rossum
2878a69922
Optimizations by Sjoerd:
...
- define tp_getattro, tp_setattro
- use precreated string objects for most common exceptions and method names
1996-08-09 20:53:24 +00:00
Guido van Rossum
d8eb1b340f
Support for tp_getattro, tp_setattro (Sjoerd)
1996-08-09 20:52:03 +00:00
Guido van Rossum
929f1b83ea
Use pre-created string objects for most common exceptions
...
(especially IndexError which is caught by 'for')
1996-08-09 20:51:27 +00:00
Guido van Rossum
86c04c252b
Correct wrong calculation of pow(0.0, 0.0, negative_number)
1996-08-09 20:50:14 +00:00
Guido van Rossum
cee555bda2
Allow compilation by K&R C compiler.
1996-08-01 00:02:33 +00:00
Guido van Rossum
fd4904c630
repr("...") -> "Ellipses"
1996-07-30 18:37:14 +00:00
Guido van Rossum
f2d125bdad
Added sliceobject.c
1996-07-30 16:45:48 +00:00
Guido van Rossum
310968dc06
Speedup suggested by Sjoerd
1996-07-30 16:45:31 +00:00
Guido van Rossum
6c02a2fe25
Use NEWOBJ() macro instead of calling newobject() directly.
1996-07-22 16:16:25 +00:00
Guido van Rossum
9e720e390a
complex -> Py_complex
1996-07-21 02:31:35 +00:00
Guido van Rossum
f5030abca8
Hacks for MS_COREDLL
1996-07-21 02:30:39 +00:00
Guido van Rossum
3cb486879a
Only __dict__ and __class__ are read-only instance attributes
1996-07-21 02:29:46 +00:00
Guido van Rossum
9d81b5594e
Different logic for defining CHECK(); 16-bit MSC specific define.
1996-06-26 18:27:19 +00:00
Guido van Rossum
ded690fc35
rename printrefs, getobjects to _Py_ prefix
1996-05-24 20:48:31 +00:00
Guido van Rossum
363078afa4
make some things static
1996-05-24 20:45:01 +00:00
Guido van Rossum
441e4ab802
new debugger symbol names
1996-05-23 22:46:51 +00:00
Guido van Rossum
84a9032cd3
TRACE_REFS -> Py_TRACE_REFS.
...
Added disgusting hack to force loading of abstract.o.
1996-05-22 16:34:47 +00:00
Guido van Rossum
f97632639e
Plug memory leak in the previous fix :-(
1996-05-21 23:44:17 +00:00
Guido van Rossum
993952bfb2
Fix obscure bug in string%mapping where the mapping creates its items
...
on the fly -- there was an unsafe DECREF. Actually save some lines of
code by using abstract.c:PyObject_GetItem().
1996-05-21 22:44:20 +00:00
Guido van Rossum
6dabc98400
Added __name__ attribute to class instance method objects.
...
Removed im_doc attribute; __name__ and __doc__ are now handled by
special casing in instancemethodgetattr(). This saves a few bytes and
INCREF/DECREF calls per i.m. object allocation/deallocation.
1996-05-14 21:54:20 +00:00
Guido van Rossum
724187929a
use 'j' instead of 'i' for imaginary constants
1996-01-25 16:21:31 +00:00
Jack Jansen
1e7b2aa5d6
Removed unused var
1996-01-25 16:11:19 +00:00
Guido van Rossum
d8b49250e9
added complex and c objects
1996-01-12 01:26:05 +00:00
Guido van Rossum
97ead3fb8e
Hack to force loading of cobject.o
1996-01-12 01:24:09 +00:00
Guido van Rossum
39739ea0ed
better power implementation
1996-01-12 01:22:56 +00:00
Guido van Rossum
cf3d1087d1
Added PyComplex_AsCComplex
1996-01-12 01:21:14 +00:00
Guido van Rossum
f9fca9252f
complex numbers a la Konrad Hinsen
1996-01-12 00:47:05 +00:00
Guido van Rossum
77654a7e5e
opaque C object a la Jim Fulton
1996-01-12 00:44:03 +00:00
Guido van Rossum
992ded8f12
fix free memory reads in dictlookup et al
1995-12-08 01:16:31 +00:00
Guido van Rossum
8ba873b8ad
adapted to K&R C
1995-09-18 21:17:59 +00:00
Sjoerd Mullender
6f011d7ad5
Get ordering right for TRACE_REFS/COUNT_ALLOCS combination (otherwise
...
may get inc_count sanity check abort).
1995-09-18 10:49:04 +00:00
Sjoerd Mullender
6ec3c653da
Implemented two new functions in sys:
...
getcounts() returns a list of counts of allocations and
deallocations for all different object types.
getobjects(n [, type ]) returns a list of recently allocated
and not-yet-freed objects of the given type (all
objects if no type given). Only the n most recent
(all if n==0) objects are returned.
getcounts is only available if compiled with -DCOUNT_ALLOCS,
getobjects is only available if compiled with -DTRACE_REFS. Note that
everything must be compiled with these options!
1995-08-29 09:18:14 +00:00
Sjoerd Mullender
740f357363
Fixed calling of __del__ method with TRACE_REFS defined.
1995-08-28 09:00:43 +00:00
Guido van Rossum
ac21f6a579
class objects are read-only in restricted mode
1995-08-04 04:05:31 +00:00
Guido van Rossum
055968c068
better err checks in resizetuple
1995-08-04 04:05:10 +00:00
Guido van Rossum
a83f270a4b
changes for keyword args to built-in functions and classes
1995-07-26 18:07:32 +00:00
Guido van Rossum
bdd207af79
better policy regarding NULL locals
1995-07-26 16:14:30 +00:00
Guido van Rossum
2271bf7187
changes for keyword arguments and fast function call; added abstract.c
1995-07-18 14:30:34 +00:00
Guido van Rossum
e15dee5e3c
Generic Abstract Object Interface
1995-07-18 14:12:02 +00:00
Guido van Rossum
1311e3ce73
args to call_object must be tuple or NULL
1995-07-12 02:22:06 +00:00
Guido van Rossum
d3f9a1ad83
fix read(0), readline(0); make tuple for call_object args
1995-07-10 23:32:26 +00:00
Jack Jansen
e08dea19c2
MW does not always set errno on failing fopen()
1995-04-23 22:12:47 +00:00
Guido van Rossum
e9df727176
change comparing instance methods
1995-04-06 14:46:51 +00:00
Guido van Rossum
d8953cb8d9
change in counting freed objects
1995-04-06 14:46:26 +00:00
Sjoerd Mullender
5b7f3cd3e1
Use mappinglookup instead of dictlookup for looking up __builtin__.
1995-04-04 11:47:41 +00:00
Guido van Rossum
6f9e433ab3
fix dusty debugging macros
1995-03-29 16:57:48 +00:00
Guido van Rossum
5fe605889a
a few peephole optimizations
1995-03-09 12:12:50 +00:00
Guido van Rossum
687ec1892b
changes for MPW
1995-03-04 22:43:47 +00:00
Guido van Rossum
07e3a7e781
for MPW __SC__ compiler
1995-02-27 10:13:37 +00:00
Guido van Rossum
caeaafccf7
don't complain about too many args if arg is a dict
1995-02-27 10:13:23 +00:00
Guido van Rossum
295d171650
explicitly init flags in methodlists
1995-02-19 15:55:19 +00:00
Guido van Rossum
67ca701939
NeXT/Sparc 3.3 fix
1995-02-13 16:38:41 +00:00
Guido van Rossum
9fa2c11613
use Py_CHARMASK; and don't check for neg. float to the float power here
1995-02-10 17:00:37 +00:00
Guido van Rossum
2497eada60
make size arg signed
1995-02-10 17:00:27 +00:00
Guido van Rossum
a46d51d9a4
round up list item counts to improve realloc performance
1995-01-26 22:59:43 +00:00
Guido van Rossum
6978503235
added findmethodinchain and methodchain data types
1995-01-26 22:58:48 +00:00
Guido van Rossum
e95d92b65e
removed unused vars
1995-01-26 00:39:21 +00:00
Guido van Rossum
27e916fd35
apply dictclear to dict of deleted modules
1995-01-26 00:39:00 +00:00
Guido van Rossum
49b11fed70
move callable() here
1995-01-26 00:38:22 +00:00
Guido van Rossum
e9c6bcd813
fix leak in func_dealloc (forgot to decref name)
1995-01-20 16:58:19 +00:00
Jack Jansen
7874d1fe7e
Fix NULL dereference in case of out-of-memory condition
1995-01-19 12:09:27 +00:00
Guido van Rossum
32b582b953
fix strobject() behavior
1995-01-17 16:35:13 +00:00
Guido van Rossum
b0fe3a9312
added reverselist; free recycling bin on error exit
1995-01-17 16:34:45 +00:00
Guido van Rossum
3535f6e0a1
long_scan is no longer used
1995-01-17 16:34:13 +00:00
Guido van Rossum
ce00509702
make a few things static
1995-01-17 16:33:39 +00:00
Guido van Rossum
4d3468deab
don't declare fmod/pow for any STDC compiler
1995-01-17 16:33:14 +00:00
Guido van Rossum
b4e7e25fe6
different init for __builtins__
1995-01-17 16:27:25 +00:00
Guido van Rossum
087579ea51
added $& to $(LIB) target for Sequent
1995-01-17 16:11:29 +00:00
Guido van Rossum
ae7bf1a5e7
fix reentrancy bug in slice assignment
1995-01-17 10:21:11 +00:00
Guido van Rossum
20566845c6
properly implement cmp() for class instances
1995-01-12 11:26:10 +00:00
Guido van Rossum
5524a59b09
move coerce() from bltinmodule.c to object.c and implement builtin_coerce() differently
1995-01-10 15:26:20 +00:00
Guido van Rossum
879c581826
implement coercions involving instances properly
1995-01-10 15:24:06 +00:00
Guido van Rossum
c206c766dd
fix memory leak and null pointer dereference
1995-01-10 15:23:19 +00:00
Guido van Rossum
10393b1708
add restrictions in restricted mode
1995-01-10 10:39:49 +00:00
Guido van Rossum
c113482871
add builtins handling and restricted flag
1995-01-10 10:39:16 +00:00
Guido van Rossum
e7d444f785
* Objects/classobject.c: added 5th (function) parameter to
...
instancebinop, to support things like Rational * float; added
documentation strings to classes and methods
1995-01-07 12:35:18 +00:00
Guido van Rossum
cab650db8e
* Objects/methodobject.c: changed drastically, the object now
...
contains a pointer to the struct methodlist (which must be
static); added attributes __name__, __doc__ and __self__
1995-01-07 12:34:58 +00:00
Guido van Rossum
5bd3805ae9
Added __doc__ attribute (alias func_doc), initialized from first
...
constant in code object if it is a string, else None
1995-01-07 12:01:30 +00:00
Guido van Rossum
8b14b4c733
initialize __doc__ to None
1995-01-07 11:59:29 +00:00
Guido van Rossum
29ca26eebf
added getattr(), supporting __doc__ and _name__
1995-01-07 11:58:15 +00:00
Guido van Rossum
016564ab51
attribute-less object is AttributeError, not TypeError
1995-01-07 11:54:44 +00:00
Guido van Rossum
6610ad9d6b
Added 1995 to copyright message.
...
floatobject.c: fix hash().
methodobject.c: support METH_FREENAME flag bit.
1995-01-04 19:07:38 +00:00
Guido van Rossum
efc8713428
* Objects/mappingobject.c (mappingremove): don't call
...
lookmapping() for empty dictionary
1995-01-02 19:42:39 +00:00
Guido van Rossum
d7047b395e
Lots of minor changes. Note for mappingobject.c: the hash table pointer
...
can now be NULL.
1995-01-02 19:07:15 +00:00
Guido van Rossum
bb3c5f7406
fix comparison of instances without _-cmp__
1994-11-10 22:31:02 +00:00
Sjoerd Mullender
b9a6d12498
Comparison of two class instances without __cmp__ or __rcmp__ methods
...
was broken.
1994-10-19 15:11:52 +00:00
Guido van Rossum
03093a248d
* Include/classobject.h, Objects/classobject.c, Python/ceval.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)
* Objects/floatobject.c: add overflow check when converting float
to int and implement truncation towards zero using ceil/float
* Objects/longobject.c: change ValueError to OverflowError when
converting to int
* Objects/rangeobject.c: modernized
* Objects/stringobject.c: use HAVE_LIMITS instead of __STDC__
* Objects/xxobject.c: changed to use new style (not finished?)
1994-09-28 15:51:32 +00:00
Guido van Rossum
9776adf565
rearranged code in debugging version of DELREF to avoid touching data
...
after it has been freed.
1994-09-07 14:36:45 +00:00
Guido van Rossum
52ca98a390
Yet another version (by me) of __getattr__ etc.
1994-09-05 07:32:29 +00:00
Guido van Rossum
e773754ae5
Mods (really diffs to 2.29) by Michael Scharf for alternative __getattr__ etc.
1994-09-05 07:31:41 +00:00
Guido van Rossum
1d5735e846
Merge back to main trunk
1994-08-30 08:27:36 +00:00
Guido van Rossum
013142a95f
fix nasty bug in resizing (formatstring)
1994-08-30 08:19:36 +00:00
Guido van Rossum
bf8c0e336f
mods by Andrew Kuchling to implement
...
pow(x,y,z) == pow(x,y)%z, but without incurring overflow
Correct problems found by THINK C 6.0
1994-08-29 12:48:32 +00:00
Guido van Rossum
eb1fafcec1
New patches by Andrew to fix various problems
...
Add cast for Lance
1994-08-29 12:47:19 +00:00
Guido van Rossum
6cd2fe043b
Correct problems found by THINK C 6.0
1994-08-29 12:45:32 +00:00
Guido van Rossum
f0171a1626
* configure.in, */Makefile*.in: OPT can now be specified in the
...
env at configure time and will then be put in all Makefiles as
default
* */Makefile*.in: remove lib*.a before adding to it
1994-08-23 14:06:18 +00:00
Guido van Rossum
91ab4a8353
If an attribute is deleted, __setattr__ is called with 2 instead of 3
...
arguments (adding __delattr__ was deemed too much overhead)
1994-08-16 22:13:47 +00:00