Guido van Rossum
a9040ec5d9
Renamed a local variable from 'PyCFunction' (which is also a typedef
...
in methodobject.h) to 'func'. /bin/cc on SunOS 4.x didn't grok this.
1997-05-20 22:09:08 +00:00
Guido van Rossum
037b2205e8
Moved PyObject_{Get,Set}Attr to object.c.
...
Fixed two 'return NULL' that should be 'return -1'.
1997-05-20 18:35:19 +00:00
Guido van Rossum
98ff96adba
Moved PyObject_{Get,Set}Attr here (from dictobject) and add PyObject_HasAttr.
1997-05-20 18:34:44 +00:00
Guido van Rossum
967839473a
Got rid of c_error in favor of errno (and EDOM/ERANGE).
...
Assume that errno usage is thread-safe -- most vendors do this by
making in a macro that refers to a per-thread storage area.
1997-05-20 18:21:34 +00:00
Guido van Rossum
3cca24570e
Got rid of all the last_name_* bogosities. I don't think the
...
complexity saved much any more. A simple benchmark (grail) showed
that there were 3 times as many misses as hits, and the same number of
times again the code was bypassed altogether due to the existence of
setattro/getattro.
1997-05-16 14:23:33 +00:00
Guido van Rossum
d0c87ee6c4
Oops, another forgotten renaming: varobject -> PyVarObject.
1997-05-15 21:31:03 +00:00
Guido van Rossum
e61093c218
Fix reversed test for failure in PySequence_List() and PySequence_Tuple().
...
This broke cPickle.
1997-05-14 18:43:29 +00:00
Guido van Rossum
9637432265
Renamed mappingobject.c to dictobject.c.
1997-05-13 21:05:38 +00:00
Guido van Rossum
a9e7a81137
Renamed from mappingobject.c to dictobject.c.
...
(Sorry Jack, all your projects will have to be changed again. :-( )
1997-05-13 21:02:11 +00:00
Guido van Rossum
93ad0df06c
Faster floating point allocator, same idea as the int allocator.
...
By Aaron Watters.
1997-05-13 21:00:42 +00:00
Guido van Rossum
789a1613a0
Add optional 'sizehint' argument to readlines(). After approximately
...
this many bytes have been read, readlines stops. Because of
buffering, the amount of bytes read is usually at least 8K more than
the hint.
Also changed read() and readline() to use PyArg_ParseTuple().
(Note that the *previous* checkin also fixed error handling and
narrowed the range of thread unblocking for all methods using
fread().)
1997-05-10 22:33:55 +00:00
Guido van Rossum
6263d5451c
Rewrite readlines() to speed it up -- about a factor of 2 on my
...
Indigo2, reading a 9Meg file from the local disk.
1997-05-10 22:07:25 +00:00
Guido van Rossum
5449b6e123
Speed up read() (i.e. read till EOF) considerably by doing a stat() to
...
see if we can guess the #bytes until the end of the file. If we
can't, increment the buffer size increments up to 0.5Meg to avoid
realloc'ing too much.
1997-05-09 22:27:31 +00:00
Guido van Rossum
0add15f6a5
removed last #ifdef SUPPORT_OBSOLETE_ACCESS bits.
1997-05-09 01:07:15 +00:00
Guido van Rossum
b819914263
Fix by Mark Hammond to enable truncate() on Windows.
1997-05-06 15:23:24 +00:00
Guido van Rossum
fdf95dd525
Checkin of Jack's buffer mods.
...
Not really checked, but didn't fail any tests either...
1997-05-05 22:15:02 +00:00
Guido van Rossum
a027efa5bf
Massive changes for separate thread state management.
...
All per-thread globals are moved into a struct which is manipulated
separately.
1997-05-05 20:56:21 +00:00
Guido van Rossum
c0b618a2cc
Quickly renamed the last directory.
1997-05-02 03:12:38 +00:00
Guido van Rossum
1875247549
Quickly renamed.
1997-04-29 14:49:28 +00:00
Guido van Rossum
3648884490
(Jack:) Align mapping entries to 4-words if USE_CACHE_ALIGNED is defined.
1997-04-11 19:14:07 +00:00
Guido van Rossum
2095d24842
Tweaks to keep the Microsoft compiler quiet.
1997-04-09 19:41:24 +00:00
Guido van Rossum
8017767420
Remove unused variable.
1997-04-09 18:22:28 +00:00
Guido van Rossum
6191551ad6
Remove a redundant XINCREF(value). This caused the reference count of
...
all locals to be upped by one when `from <module> import <whatever>'
was executed.
1997-04-03 18:31:43 +00:00
Guido van Rossum
4669fb474b
Several fixes reported by jim F.
1997-04-02 05:31:09 +00:00
Guido van Rossum
c054d70aee
Get rid of .conj pseudo data attribute for complex numbers.
...
Add __members__ attribute.
1997-04-01 03:12:33 +00:00
Guido van Rossum
fb8f1cadb2
Add clear() method to dictionary objects.
1997-03-21 21:55:12 +00:00
Guido van Rossum
f2e499b1d7
New long_lshift, without restriction on size of shift count, by Tim Peters.
...
This makes it possible to write 1L<<1000000, memory permitting.
1997-03-16 00:37:59 +00:00
Guido van Rossum
45b83915f8
New form of PyFPE_END_PROTECT macro.
1997-03-14 04:32:50 +00:00
Guido van Rossum
19700b6a98
Add casts to CMPERROR macro to silence SunPro compiler warnings about
...
integer overflow in << operator.
1997-03-05 00:45:43 +00:00
Guido van Rossum
09e6ad0c1e
Changes for Lee Busby's SIGFPE patch set.
...
Surround various f.p. operations with PyFPE_{START,END}_PROTECT macros.
1997-02-14 22:54:21 +00:00
Guido van Rossum
0f4bbd2f34
Keep gcc -Wall happy.
1997-02-14 21:12:56 +00:00
Guido van Rossum
36b9f7908a
Slight tweak: in string_hash(), if the hash hasn't been computed yet,
...
and if there's a pointer to an interned version of the string, use its
hash and store its hash in this object, rather than recomputing it.
1997-02-14 16:29:22 +00:00
Guido van Rossum
7582bfb60a
Kill all local variables when the frame is deallocated (moved here
...
from ceval.c).
Wrapped a long line.
1997-02-14 16:27:29 +00:00
Guido van Rossum
efb4609c4a
Small lookmapping nits:
...
- remove bogus initialization using uninitialized i
- derive initial incr from hash
- copy mp->ma_table into a local variable
1997-01-29 15:53:56 +00:00
Guido van Rossum
4acdc2327f
Fix bug reported by Per Lindqvist: "%#06x" % 1 stuck the 0 padding
...
in front of the 0x, like such: "0000x1".
1997-01-29 06:00:24 +00:00
Guido van Rossum
9e5656ca3f
Final three poly table entries corrected by Tim Peters.
...
Reindented the whole table.
1997-01-29 04:45:16 +00:00
Guido van Rossum
16e93a8d59
Changed the lookup algorithm again, based on Reimer Behrends's post.
...
The table size is now constrained to be a power of two, and we use a
variable increment based on GF(2^n)-{0} (not that I have the faintest
idea what that is :-) which helps avoid the expensive '%' operation.
Some of the entries in the table of polynomials have been modified
according to a post by Tim Peters.
1997-01-28 00:00:11 +00:00
Guido van Rossum
747596a491
When a recycled frame has more local+stack slots than needed,
...
give the extra slots to the stack rather than than forgetting about
them (this reduces the number of reallocs done).
1997-01-24 04:00:21 +00:00
Guido van Rossum
ca756f2a1d
Forget keeping track of whether a dictionary contains all interned
...
string keys. Just doing a pointer compare before the string compare
(in fact before the hash compare!) is just as fast.
1997-01-23 19:39:29 +00:00
Guido van Rossum
e0e696282f
Added PyCObject_Import.
1997-01-22 20:48:48 +00:00
Guido van Rossum
a04d47b319
Don't use static buffers internally for formatstring().
1997-01-21 16:12:09 +00:00
Guido van Rossum
3bb63a8dbe
Bugfix: remove ref to fast before it's defined.
1997-01-20 04:29:16 +00:00
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