Guido van Rossum
49ded3ec00
Added check for negative offset for PyBuffer_FromObject and check for
...
negative size for PyBuffer_FromMemory. Greg Stein.
1999-03-19 19:04:25 +00:00
Guido van Rossum
3fce883922
Vladimir has restructured his code somewhat so that the blocks are now
...
represented by an explicit structure. (There are still too many casts
in the code, but that may be unavoidable.)
Also added code so that with -vv it is very chatty about what it does.
1999-03-12 19:43:17 +00:00
Guido van Rossum
f61bbc8182
OK, try again. Vladimir gave me a fix for the alignment bus error,
...
so here's his patch again. This time it works (at least on Solaris,
Linux and Irix).
1999-03-12 00:12:21 +00:00
Guido van Rossum
a060fb2598
Alas, Vladimir's patch caused a bus error (probably double
...
alignment?), and I didn't test it. Withdrawing it for now.
1999-03-11 01:47:00 +00:00
Guido van Rossum
881928f7ab
Patch by Vladimir Marangoz to allow freeing of the allocated blocks of
...
floats on finalization.
1999-03-10 22:55:47 +00:00
Guido van Rossum
da084edd38
Patch by Vladimir Marangoz to allow freeing of the allocated blocks of
...
integers on finalization.
1999-03-10 22:55:24 +00:00
Guido van Rossum
98cc19fac6
Patch by Chris Petrilli to display the origin of a module in its
...
repr() -- either "(builtin)" or "from '<filename>'".
1999-02-15 14:47:16 +00:00
Guido van Rossum
00d225ea6d
Correct typo (Py_MethodDef doesn't exist). Reported by Uwe Zessin.
1999-01-29 14:39:12 +00:00
Barry Warsaw
b5cebfe164
PyLong_FromString(): Nailed a small memory leak. In the str==start
...
test, we forgot that z is still pointing to a real live object.
DECREF() it before returning.
1999-01-27 17:48:27 +00:00
Guido van Rossum
3bbef60990
Ai! complex_nonzero() has && which should be ||, else decidedly
...
non-zero things like 5j and complex(1,0) are considered to be
zero/false. Tim Peters.
1999-01-25 19:42:19 +00:00
Guido van Rossum
3aa23fdd47
Jim Ahlstrom patch: cutoff should be a long for machines with 16-bit
...
ints. (In theory, other variables should be widened to long as well,
but this won't ever be needed, since the len of a list is still an
int.)
1999-01-14 19:01:53 +00:00
Guido van Rossum
3c25904a98
Jim Ahlstrom patch: BIGCHUNK is too large for 16-bit int.
1999-01-14 19:00:14 +00:00
Guido van Rossum
031d0e5feb
Patch by Charles Waldman -- remove unneeded and even harmful test for
...
float to the negative power (which is already and better done in
floatobject.c.)
1999-01-10 16:56:58 +00:00
Guido van Rossum
5dadf7e976
Use 'xrange', not 'range', in error messages. Reported by Nathan Sullivan.
1999-01-09 21:40:35 +00:00
Guido van Rossum
41498435ba
Need to include <sys/types.h> for off_t.
1999-01-07 22:09:51 +00:00
Guido van Rossum
3c9fe0cce3
Changes for long file support by Steve Clift.
...
(This also redoes my previous patch, but better.)
1999-01-06 18:51:17 +00:00
Guido van Rossum
cdd9ae00ba
Changes for long file support by Steve Clift.
...
(Really: moved a bunch of defs to longobject.h.)
1999-01-06 18:50:37 +00:00
Guido van Rossum
88303194a5
Fix two places (seek and truncate) where a cascade of PyArg_Parse
...
calls was used instead of a single PyArg_ParseTuple call with an
optional argument.
1999-01-04 17:22:18 +00:00
Guido van Rossum
cada2938f7
As noted by Per Cederqvist, new_buffersize() sometimes returns the
...
buffer increment, and sometimes the new buffer size. Make it do what
its name says, and fix the one place where this matters to the caller.
Also add a comment explaining why we call lseek() and then ftell().
1998-12-11 20:44:56 +00:00
Guido van Rossum
68055ce6fe
When tracing references, reset the type and size of tuples allocated
...
from the fast free list -- the type (at least) is reset by
_Py_Dealloc().
1998-12-11 14:56:38 +00:00
Guido van Rossum
f5046d1aea
Remove prototype for PyOS_strtol -- Chris Herborth.
1998-12-10 16:54:48 +00:00
Guido van Rossum
13fdf5e917
When comparing bound methods, use identity test on the objects,
...
not equality test.
1998-12-04 18:52:55 +00:00
Guido van Rossum
f05fc716d1
Remove dead code discovered by Vladimir Marangozov.
1998-11-16 22:46:30 +00:00
Guido van Rossum
017f7780a8
Make tuples less hungry -- an extra item was allocated but never used.
...
Tip by Vladimir Marangozov.
1998-11-16 18:56:03 +00:00
Guido van Rossum
f61618c98e
A Py_DECREF(f) is missing in PyFrame_New for the error case when
...
the `builtins' initialization fails. Vladimir Marangozov.
1998-10-19 14:20:20 +00:00
Guido van Rossum
2f3667a7b9
Replace fprintf(stderr, ...) with PySys_WriteStderr(...).
1998-10-12 18:23:55 +00:00
Barry Warsaw
dedf6d6804
listextend(): New method which implements L.extend(L2).
1998-10-09 16:37:25 +00:00
Guido van Rossum
3886026bed
Remove unreachable code. (Sjoerd)
1998-10-09 13:27:19 +00:00
Guido van Rossum
1db7070217
Greg Stein: Implement the new bf_getcharbuffer function, indicating
...
that (as far as the data type is concerned!) this is character data.
1998-10-08 02:18:52 +00:00
Guido van Rossum
7148ca9d14
Make gcc -Wall happy.
1998-10-07 16:22:12 +00:00
Guido van Rossum
06c18088d6
Add Greg Stein's buffer object API.
1998-10-07 14:41:13 +00:00
Guido van Rossum
2e19bd7cc7
Add Greg Stein's buffer object API.
1998-10-07 14:36:10 +00:00
Guido van Rossum
2ccaf6f2f9
Remove a redundant check from list_slice() and list_ass_slice().
...
Noted by Greg Stein.
1998-10-07 13:24:13 +00:00
Guido van Rossum
c1c7b1a699
Slight rearrangement of code in lookdict() by Vladimir Marangozov, to
...
make a common case slightly faster.
1998-10-06 16:01:14 +00:00
Guido van Rossum
9d904b9389
Believe it or not, Solaris 2.6 strtod() can move the end pointer
...
*beyond* the null byte at the end of the input string, when the input
is inf(inity). Discovered by Greg Ward.
1998-10-01 20:35:46 +00:00
Guido van Rossum
07d780089d
Typo reported by Greg Stein: "modifiable" is the correct spelling.
1998-10-01 15:59:48 +00:00
Guido van Rossum
67906af811
In PyFrame_New(), don't set extras to something derived from code
...
before code has been checked for validity. Discovered by Vladimir
Marangozov.
1998-09-25 14:11:46 +00:00
Guido van Rossum
78694d970f
Patches from Greg Stein to support 'P' format in struct module's
...
native format, as void* (translated to Python int or long).
Also adds PyLong_FromVoidPtr and PyLong_AsVoidPtr to longobject.c.
1998-09-18 14:14:13 +00:00
Guido van Rossum
065ce5a4b7
Undo victim of careless global substitute ("long long_hash" was
...
changed to "LONG_LONG_hash" in the list of forward decls). Discovered
by Jason Harper.
1998-09-13 15:37:20 +00:00
Guido van Rossum
3293b07df5
Patch by Mark Hammond to support 64-bit ints on MS platforms.
...
The MS compiler doesn't call it 'long long', it uses __int64,
so a new #define, LONG_LONG, has been added and all occurrences
of 'long long' are replaced with it.
1998-08-25 16:07:15 +00:00
Guido van Rossum
21308243ca
Better error messages when a sequence is indexed with a non-integer.
...
Previously, this said "unsubscriptable object"; in 1.5.1, the reverse
problem existed, where None[''] would complain about a non-integer
index. This fix does the right thing in all cases (for get, set and
del item).
1998-08-13 16:44:44 +00:00
Guido van Rossum
bd3a527f93
Two patches by Jason Harper:
...
- Faster conversion to string for binary bases: linear instead of quadratic!
- Allocate smaller result for certain masking ops, e.g. (1L<<30000) & 1.
1998-08-11 15:04:47 +00:00
Guido van Rossum
1a8791e0b8
Changes for BeOS, QNX and long long, by Chris Herborth.
1998-08-04 22:46:29 +00:00
Guido van Rossum
ac6a37ae55
Fix a potential problem in PyLong_FromString(): could fall through the
...
for loop with z==NULL but continue to reference z later.
1998-08-04 15:04:06 +00:00
Guido van Rossum
df3d8756b7
Better error messages when raising ValueError for int and long
...
literals. (The previous version of this code would not show the
offending input, even though there was code that attempted this.)
1998-08-04 15:02:01 +00:00
Guido van Rossum
152d8173a3
Fix a memory leak -- the cached values of __getattr__ etc. were never
...
freed.
1998-08-04 14:59:16 +00:00
Barry Warsaw
52ddc0e756
PyFile_FromString(): If an exception occurs, pass in the filename that
...
was used so it's reflected in the IOError. Call
PyErr_SetFromErrnoWithFilename().
1998-07-23 16:07:02 +00:00
Guido van Rossum
b4db1944c4
When comparing objects, always check that tp_compare is not NULL
...
before calling it. This check was there when the objects were of the
same type *before* coercion, but not if they initially differed but
became the same *after* coercion.
1998-07-21 21:56:41 +00:00
Guido van Rossum
0fd00334c6
Avoid using calloc(). This triggered an obscure bug on multiprocessor
...
Sparc Solaris 2.6 (fully patched!) that I don't want to dig into, but
which I suspect is a bug in the multithreaded malloc library that only
shows up when run on a multiprocessor. (The program wasn't using
threads, it was just using the multithreaded C library.)
1998-07-16 15:06:13 +00:00
Guido van Rossum
5dba9e8aef
Add special case to PySequence_List() so that list() of a list is
...
faster (using PyList_GetSlice()). Also added a test for a NULL
argument, as with PySequence_Tuple(). (Hmm... Better names for these
two would be PyList_FromSequence() and PyTuple_FromSequence(). Oh well.)
1998-07-10 18:03:50 +00:00
Guido van Rossum
bfc725bf64
Changed PySequence_List() and PySequence_Tuple() to support
...
"indefinite length" sequences. These should still have a length, but
the length is only used as a hint -- the actual length of the sequence
is determined by the item that raises IndexError, which may be either
smaller or larger than what len() returns. (This is a novelty; map(),
filter() and reduce() only allow the actual length to be larger than
what len() returns, not shorter. I'll fix that shortly.)
1998-07-10 16:22:44 +00:00
Guido van Rossum
d4ba73c75b
Move the definition of PyMethodObject to classobject.h, so it can define
...
macros for more efficient access to the fields.
1998-07-10 15:46:33 +00:00
Guido van Rossum
9223351617
Marc-Andre Lemburg's patch to move the typedef for PyCFunctionObject
...
to the .h file and add macros there for inlined access to the fields.
1998-07-10 15:21:55 +00:00
Guido van Rossum
7859f87fdb
Marc-Andre Lemburg's patch to support instance methods with other
...
callable objects than regular Pythonm functions as their im_func.
1998-07-08 14:58:16 +00:00
Guido van Rossum
7ba30431ec
Recompute the special getattr/setattr/delattr cache slots after
...
changing __dict__ *or* __bases__.
1998-07-08 13:34:48 +00:00
Guido van Rossum
3dd7f3fef0
Added doc strings for methods and a new pop() method.
1998-06-30 15:36:32 +00:00
Guido van Rossum
8a92c627d9
New feature: if the object's type has a non-NULL tp_doc field, that
...
is returned as the object's __doc__ attribute.
(If only the list of methods would be referenced from the type...)
1998-06-27 18:28:59 +00:00
Guido van Rossum
1bb26872f5
Slight rearrangement of some code to make it faster, by Vladimir
...
Marangozov.
1998-06-26 15:53:50 +00:00
Guido van Rossum
e67629774f
Add check in long-to-int conversion for at least one digit.
1998-06-22 03:54:46 +00:00
Guido van Rossum
3b2b34790f
Fix the tests for various anomalies in the string-to-numbers
...
conversions. Formerly, for example, int('-') would return 0 instead
of raising ValueError, and int(' 0') would raise ValueError
(complaining about a null byte!) instead of 0...
1998-06-22 03:54:15 +00:00
Guido van Rossum
4281258b5f
Minor cleanup by Tim after my changes:
...
+ Took the "list" argument out of the other functions that no longer need
it. This speeds things up a little more.
+ Small comment changes in accord with that.
+ Exploited the now-safe ability to cache values in the partitioning loop.
Makes no timing difference on my flavor of Pentium, but this machine ran out
of registers 12 iterations ago. It should yield a small speedup on a RISC
machine, and not hurt in any case.
1998-06-17 14:15:44 +00:00
Guido van Rossum
4c4e7df755
Tim's latest, with some of my changes (also a TP suggestion) added:
...
instead of testing whether the list changed size after each
comparison, temporarily set the type of the list to an immutable list
type. This should allow continued use of the list for legitimate
purposes but disallows all operations that can change it in any way.
(Changes to the internals of list items are not caught, of cause;
that's not possible to detect, and it's not necessary to protect the
sort code, either.)
1998-06-16 15:18:28 +00:00
Guido van Rossum
e0fdf6f1a8
Keep Microsoft's compiler happy.
1998-06-12 15:03:58 +00:00
Guido van Rossum
cd5a5f627a
When comparing objects of different types (which is done by comparing
...
the type names), make sure that numeric objects are considered smaller
than all other objects, by forcing their name to "".
1998-06-09 18:58:44 +00:00
Guido van Rossum
4a0144c0de
Should check that PyObject_Str() really returned a string!
1998-06-09 15:08:41 +00:00
Guido van Rossum
a63eff6e6a
Allow assignments to special class attributes -- with typechecks, and
...
not in restricted mode.
__dict__ can be set to any dictionary; the cl_getattr, cl_setattr and
cl_delattr slots are refreshed.
__name__ can be set to any string.
__bases__ can be set to to a tuple of classes, provided they are not
subclasses of the class whose attribute is being assigned.
__getattr__, __setattr__ and __delattr__ can be set to anything, or
deleted; the appropriate slot (cl_getattr, cl_setattr, cl_delattr) is
refreshed.
(Note: __name__ really doesn't need to be a special attribute, but
that would be more work.)
1998-05-29 21:37:21 +00:00
Guido van Rossum
a119c0dd5e
Tim's revision of the previous patch. He also added some sparts to
...
the median-of-three code to get a few percent back.
1998-05-29 17:56:32 +00:00
Guido van Rossum
ed6219b116
Fix a whole bunch of error return NULL that should be return -1.
1998-05-29 02:59:33 +00:00
Guido van Rossum
ae621ff7b7
Guard against changes in the list size during a compare or sort.
1998-05-28 20:18:46 +00:00
Guido van Rossum
617c1b0116
Uses PyErr_ExceptionMatches() instead of comparing PyErr_Occurred().
1998-05-28 19:50:02 +00:00
Guido van Rossum
08570decb7
Uses PyErr_ExceptionMatches() instead of comparing PyErr_Occurred().
1998-05-28 19:24:35 +00:00
Guido van Rossum
9be628338d
Tim's quicksort on May 25.
1998-05-26 15:06:32 +00:00
Guido van Rossum
f753181272
Subject: Buglet in PyLong_AsLong
...
From: "Tim Peters" <tim_one@email.msn.com>
To: "Guido van Rossum" <guido@CNRI.Reston.VA.US>
Date: Sat, 23 May 1998 21:45:53 -0400
Guido, the overflow checking in PyLong_AsLong is off a little:
1) If the C in use sign-extends right shifts on signed longs, there's a
spurious overflow error when converting the most-negative int:
Python 1.5.1 (#0 , Apr 13 1998, 20:22:04) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> x = -1L << 31
>>> x
-2147483648L
>>> int(x)
Traceback (innermost last):
File "<stdin>", line 1, in ?
OverflowError: long int too long to convert
>>>
2) If C does not sign-extend, some genuine overflows won't be caught.
The attached should repair both, and, because I installed a new disk and a C
compiler today, it's even been compiled this time <wink>.
Python 1.5.1 (#0 , May 23 1998, 20:24:58) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> x = -1L << 31
>>> x
-2147483648L
>>> int(x)
-2147483648
>>> int(-x)
Traceback (innermost last):
File "<stdin>", line 1, in ?
OverflowError: long int too long to convert
>>> int(-x-1)
2147483647
>>> int(x-1)
Traceback (innermost last):
File "<stdin>", line 1, in ?
OverflowError: long int too long to convert
>>>
end-casing-ly y'rs - tim
1998-05-26 14:33:37 +00:00
Guido van Rossum
fa0b6ab01a
Address some gcc -Wall warnings (e.g. include <ctype.h>).
...
Make sure that no tp_as_numbers->nb_<whatever> function is called
without checking for a NULL pointer. Marc-Andre Lemburg will love it!
(Except that he's just rewritten all this code for a different
approach to coercions ;-( )
1998-05-22 15:23:36 +00:00
Guido van Rossum
0dabacee16
Make function objects somewhat mutable -- the members func_code,
...
func_defaults and func_doc (alias __doc__) may be assigned to. For
the first two, there's a type restriction to code object and tuple,
respectively.
1998-05-22 00:55:34 +00:00
Guido van Rossum
1c4f458099
In PyObject_IsTrue(), don't call function pointers that are NULL
...
(nb_nonzero, mp_length, sq_length).
1998-05-22 00:53:24 +00:00
Guido van Rossum
cea1c8ca22
Completely reformatted, standardizing indentation as well as
...
programming style.
Recoded many routines to incorporate better error checking, and/or
better versions of the same function found elsewhere
(e.g. bltinmodule.c or ceval.c). In particular,
Py_Number_{Int,Long,Float}() now convert from strings, just like the
built-in functions int(), long() and float().
Sequences and mappings are now safe to have NULL function pointers
anywhere in their tp_as_sequence or tp_as_mapping fields. (A few
places in other files need to be checked in too.)
Renamed PySequence_In() to PySequence_Contains().
1998-05-22 00:47:05 +00:00
Guido van Rossum
e23eb57f08
Since PyDict_GetItem() can't raise an exception any more, there's no
...
need to cxall PyErr_Clear() when it returns NULL.
1998-05-14 01:49:48 +00:00
Guido van Rossum
474b19e2ab
Make sure that PyDict_GetItem[String]() *never* raises an exception.
...
If the argument is not a dictionary, simply return NULL. If the
hash() on the key fails, clear the error.
1998-05-14 01:00:51 +00:00
Guido van Rossum
4180cf1649
Remove a redundant statement from halfbinop().
1998-05-13 22:02:16 +00:00
Guido van Rossum
ed7adcff73
Tim's quicksort on May 13.
1998-05-13 21:21:24 +00:00
Guido van Rossum
b7057640d1
Tim's quicksort on May 10.
1998-05-13 21:20:49 +00:00
Guido van Rossum
8530ef625a
Add check to conjugate() that there are no excess arguments.
1998-05-07 16:29:10 +00:00
Guido van Rossum
91aaa92c88
Ugly band-aid to work around a bug in Linux ftell().
1998-05-05 22:21:35 +00:00
Guido van Rossum
e32907df67
Get rid of the unused ifdefed-out old sort code.
1998-04-28 17:54:03 +00:00
Guido van Rossum
9b00dfae75
If USE_STACKCHECK is defined use PyOS_CheckStack() in the repr and str
...
routines. This catches a slightly different set of crashes than the
recursive-repr fix.
(Jack)
1998-04-28 16:06:54 +00:00
Guido van Rossum
f2044e1a71
Enable ftruncate() on the Mac.
...
(Jack)
1998-04-28 16:05:59 +00:00
Guido van Rossum
82e6a8f80d
Quicksort retuned by Tim Peters.
1998-04-28 13:17:56 +00:00
Guido van Rossum
d30dc0a55e
Clear the error condition set by ftell().
1998-04-27 19:01:08 +00:00
Guido van Rossum
565798d493
Be less naive about null characters in an object's repr().
1998-04-21 22:25:01 +00:00
Guido van Rossum
eb90946978
Some robustness checks in Py_ReprLeave() in the unlikely event someone
...
has messed with the dictionary or list.
1998-04-11 15:17:34 +00:00
Guido van Rossum
fb376dee55
Use Py_Repr{Enter,Leave} to display recursive lists in finite space.
...
(Jeremy will hardly recognize his patch :-)
1998-04-10 22:47:27 +00:00
Guido van Rossum
255443b720
Use Py_Repr{Enter,Leave} to display recursive dictionaries in finite space.
...
(Jeremy will hardly recognize his patch :-)
1998-04-10 22:47:14 +00:00
Guido van Rossum
8661036cb8
Add implementations of Py_Repr{Enter,Leave}.
...
(Jeremy will hardly recognize his patch :-)
1998-04-10 22:32:46 +00:00
Guido van Rossum
1109fbca76
Make new gcc -Wall happy
1998-04-10 22:16:39 +00:00
Guido van Rossum
c3d3f9692d
Add PyObject_Not().
1998-04-09 17:53:59 +00:00
Guido van Rossum
f7d590c93d
This was the reason a numeric array to a real power was not working.
1998-04-03 23:38:59 +00:00
Guido van Rossum
240c35aac0
Subtle fix in the read() code which could cause a read broken up in
...
several pieces to fail...
1998-03-18 17:59:20 +00:00
Guido van Rossum
f8b4de02a4
When we have no setvbuf(), make the file totally unbuffered using
...
setbuf() if a buffer size of 0 or 1 byte is requested.
1998-03-06 15:32:40 +00:00
Guido van Rossum
dcb5e7f389
Of course, I shouldn't have used lseek() to find out the file's
...
position in new_buffersize(); the correct function to use is ftell().
Thanks to Ben Jackson.
1998-03-03 22:36:10 +00:00
Guido van Rossum
044b9dc1d7
Add back some safeguards on the index elements that were lost in the
...
last patch. Dave Ascher found a case that dumps core without these:
def myComparison(x,y):
return cmp(x%3,y%7)
z = range(12)
z.sort(myComparison)
1998-02-25 17:50:03 +00:00
Guido van Rossum
f1dc0615e9
Add internal routine _PyModule_Clear(), which does approximately what
...
clear_carefully() used to do in import.c. Differences: leave only
__builtins__ alone in the 2nd pass; and don't clear the dictionary (on
the theory that as long as there are references left to the
dictionary, those might be destructors that might expect __builtins__
to be alive when they run; and __builtins__ can't normally be part of
a cycle).
1998-02-19 20:51:52 +00:00
Guido van Rossum
bde6ff7984
Vladimir Marangozov' performance hack: copy f_builtins from ancestor
...
if the globals are the same.
Also, when creating a dummy builtins dictionary, add "None" to it,
just to be kind.
1998-02-19 20:48:26 +00:00
Guido van Rossum
3da3fcef96
Check ferror(), not errno, for fread() error.
1998-02-19 20:46:48 +00:00
Guido van Rossum
db9351643d
Instead of "attribute-less object", issue an error message that
...
contains the type of the object and name of the attribute.
1998-01-19 22:16:36 +00:00
Guido van Rossum
24e62e2c7c
Modified quicksort by Raymund Galvin, after studying the GNU libg++
...
quicksort. This should be much faster if there are lots of
duplicates, and otherwise at least as good.
1997-12-10 15:14:24 +00:00
Guido van Rossum
b7f1afe4a8
Change the default repr() and str() of class instance objects to look
...
like <modulename.classname instance at ...> (to match the repr() of
class objects.
1997-12-03 00:06:02 +00:00
Guido van Rossum
242c64256c
Add a new function PyNumber_CoerceEx() which works just like
...
PyNumber_Coerce() except that when the coercion can't be done and no
other exceptions happen, it returns 1 instead of raising an
exception.
Use this function in PyObject_Compare() to avoid raising an exception
simply because two objects with numeric behavior can't be coerced to a
common type; instead, proceed with the non-numeric default comparison.
Note that this is a somewhat questionable practice -- comparisons for
numeric objects shouldn't default to random behavior like this, but it
is required for backward compatibility. (Case in point, it broke
comparison of kjDict objects to integers in Aaron Watters' kjbuckets
extension.) A correct fix (for python 2.0) should involve a different
definiton of comparison altogether.
1997-11-19 16:03:17 +00:00
Guido van Rossum
3931df9250
Undo another glitch of the automatic not-so-Grand Renaming; some local
...
variables called 'coerce' were accidentally renamed to
'PyNumber_Coerce'. Rename them back to coercefunc.
1997-11-18 19:23:07 +00:00
Guido van Rossum
f51815426e
Fix problem discovered by Barry: if you hit ^C to
...
sys.stdin.readline(), you get a fatal error (no current thread). This
is because there was a call to PyErr_CheckSignals() while there was no
current thread. I wonder how many more of these we find... I bnetter
go hunting for PyErr_CheckSignals() now...
1997-11-07 19:20:34 +00:00
Guido van Rossum
6345ac6d61
Add cast to realloc/malloc call to shut up AIX compiler. (Vladimir Marangozov)
1997-10-31 20:32:13 +00:00
Guido van Rossum
3c03fa87b6
Hack suggested by Matthias Klose to pull in all relevant entry points
...
in libmath.a so they are available to mathmodule.so (in case it is
shared). While this still gets triggered on Solaris 2.x, this appears
to be harmless there.
1997-10-31 17:00:30 +00:00
Guido van Rossum
1f84449fd8
New CObject from Jim Fulton, adds PyCObject_FromVoidPtrAndDesc() and
...
PyCObject_GetDesc().
1997-10-21 19:48:35 +00:00
Guido van Rossum
4a2a621907
Write a str() function for class objects that returns
...
"modulename.classname" instead of returning the same as repr().
1997-10-20 23:26:11 +00:00
Guido van Rossum
6fcfa72c63
Correct Barry's fix -- take care of {}.get(0).
1997-10-20 20:10:00 +00:00
Barry Warsaw
320ac331d1
dict_get(): Fixed a couple of stupid mistakes which caused crashes.
...
Also got rid of some unnecessary code.
1997-10-20 17:26:25 +00:00
Guido van Rossum
04d73c495e
Check that all base classes are indeed class objects, rather than
...
expecting the caller to do so.
1997-10-07 14:54:11 +00:00
Barry Warsaw
c38c5da5d0
dict_get(): New method for item access with different semantics than
...
__getitem__(). This method never raises an exception; if the key is
not in the dictionary, the second (optional) argument is returned. If
the second argument is not provided and the key is missing, None is
returned.
mapp_methods: added "get" method.
1997-10-06 17:49:20 +00:00
Guido van Rossum
4f3bf1e383
Don't intern the key string for getitem and delitem.
1997-09-29 23:31:11 +00:00
Guido van Rossum
7cc56eb524
When creating a class, set its __module__ attribute to the module
...
whose name is in the current globals' __name__ variable. If __name__
is not set, ignore this.
1997-09-12 20:04:46 +00:00
Guido van Rossum
045e688f6f
Patch submitted by Brad Howes (with one bug fixed by me): allow
...
arbitrary nested parens in a %(...)X style format.
#Also folded two lines and added more detail to the error message for
#unsupported format character.
1997-09-08 18:30:11 +00:00
Guido van Rossum
b2173c3146
Allow assignments to instance.__dict__ and instance.__class__. The
...
former lets you give an instance a set of new instance vars. The
latter lets you give it a new class. Both are typechecked and
disallowed in restricted mode.
For classes, the check for read-only special attributes is tightened
so that only assignments to __dict__, __bases__, __name__,
__getattr__, __setattr__, and __delattr__ (these could be made to work
as well, but I don't know if that's useful -- let's see first whether
mucking with instances will help).
1997-08-25 21:23:56 +00:00
Guido van Rossum
a27d112213
Rename roundup() to roundupsize(), as there's a macro roundup() in the
...
sys/types.h header on many systems that may get pulled in (through
WANT_SIGFPE_HANDLER which pulls in signal.h).
1997-08-25 18:36:23 +00:00
Guido van Rossum
36f8e2d1db
Use lseek instead of ftell; compensate by adding BUFSIZE
1997-08-21 02:31:25 +00:00
Guido van Rossum
fd7a0b871f
Made lookdict nearly twice as fast, resulting in a 5% overall
...
improvement of pystone. Vladimir Marangozov.
1997-08-18 21:52:47 +00:00
Guido van Rossum
787bdd37a0
PyTuple_SetItem should require that the tuple's refcnt is one!
1997-08-17 16:25:45 +00:00
Guido van Rossum
ea46e4d93c
Fix mixup about PyErr_NoMemory() prototype.
1997-08-12 14:54:54 +00:00
Guido van Rossum
83f9ad8399
Fix bug in comparing function objects detected by Sjoerd:
...
SystemError: bad argument to internal function
caused by comparing NULL pointer default args.
1997-08-05 16:51:05 +00:00
Guido van Rossum
fbbd57e4ca
Added _Fini() routines to free up some memory
1997-08-05 02:16:08 +00:00
Guido van Rossum
971a7aaeac
Change the Fini function to only remove otherwise unreferenced strings
...
from the interned table. There are references in hard-to-find static
variables all over the interpreter, and it's not worth trying to get
rid of all those; but "uninterning" isn't fair either and may cause
subtle failures later -- so we have to keep them in the interned
table.
Also get rid of no-longer-needed insert of None in interned dict.
1997-08-05 02:15:12 +00:00
Guido van Rossum
1f39c5c666
Added separate free list for cfunction (builtin method) objects, for a
...
few percent speed up. Also add PyCFunction_Fini() to discard it.
1997-08-05 02:11:41 +00:00
Guido van Rossum
404b95d9ba
Provide a dummy empty directory as f_builtins instead of failing, when
...
no valid directory is passed in. This prevents __del__ to fail when
invoked after __builtins__ has already been discarded.
Also add PyFrame_Fini() to discard the cache of frames.
1997-08-05 02:09:46 +00:00
Guido van Rossum
a0d349f46a
Added separate free list for instance method objects, for a few
...
percent speed up. Also add PyMethod_Fini() to discard it.
1997-08-05 02:06:53 +00:00
Guido van Rossum
e09fb55f29
Added _Py_ResetReferences(), if tracing references.
...
In _Py_PrintReferences(), no longer suppress once-referenced string.
Add Py_Malloc and friends and PyMem_Malloc and friends (malloc
wrappers for third parties).
1997-08-05 02:04:34 +00:00
Guido van Rossum
eb46d67ce5
Avoid function calls to access the current thread state and builtins
...
-- the thread state is passed in as an argument and the builtins are a
member thereof.
1997-08-02 02:59:08 +00:00
Guido van Rossum
8cf0476474
Added internal routine PyString_Fini() which deletes all interned
...
strings. For use in Py_Finalize() only.
1997-08-02 02:57:45 +00:00
Guido van Rossum
f6ca6aa869
New build procedure.
1997-07-19 19:39:57 +00:00
Guido van Rossum
5d8123f34a
Reordered list of methods to hopefully put the most frequently used
...
ones near the front.
1997-07-13 03:58:01 +00:00
Guido van Rossum
74ba24758e
Reordered list of methods to hopefully put the most frequently used
...
ones near the front.
Also added a missing "return -1" to PyFile_WriteString.
1997-07-13 03:56:50 +00:00
Guido van Rossum
71160aaffe
Use #include "mymath.h" instead of declaring fabs() explicitly.
...
This should solve a weird problem on the Mac for Jack.
1997-06-03 18:03:18 +00:00
Guido van Rossum
a8d5131d57
Renamed dict.absorb() (too spungy) to dict.update().
1997-06-02 17:13:37 +00:00
Guido van Rossum
80c2a1674e
American spelling in doc string.
1997-06-02 14:43:07 +00:00
Guido van Rossum
e3f5b9c8d1
Added dict.absorb() and dict.copy().
1997-05-28 19:15:28 +00:00
Guido van Rossum
c8b6df9004
PyObject_Compare can raise an exception now.
1997-05-23 00:06:51 +00:00
Guido van Rossum
5b2121b25f
PyObject_Compare can now return an error. Unfortunately, there are a
...
few places where we don't know how to test for them without losing
speed; don't know yet how to handle that.
1997-05-23 00:01:41 +00:00
Guido van Rossum
27a60b147c
PyFile_WriteString now returns an error indicator instead of calling
...
PyErr_Clear().
1997-05-22 22:25:11 +00:00
Guido van Rossum
e9eec54798
Fix typo in error checking spotted by Just...
1997-05-22 14:02:25 +00:00
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
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