Commit Graph

19381 Commits

Author SHA1 Message Date
Neil Schemenauer 01b66a80c4 Remove bogus PyGC_HEAD_SIZE. 2001-08-29 23:50:42 +00:00
Neil Schemenauer 74b5ade6b8 Change the GC type flag since the API has changed. Allow types using
the old flag to still compile.  Remove the PyType_BASICSIZE and
PyType_SET_BASICSIZE macros.  Add PyObject_GC_New, PyObject_GC_NewVar,
PyObject_GC_Resize, PyObject_GC_Del, PyObject_GC_Track,
PyObject_GC_UnTrack.  Part of SF patch #421893.
2001-08-29 23:49:28 +00:00
Neil Schemenauer 31ec142808 Change the GC type flag since the API has changed. Allow types using
the old flag to still compile.
2001-08-29 23:46:35 +00:00
Neil Schemenauer 251ead8dd8 Make frames a PyVarObject instead of a PyObject. 2001-08-29 23:45:25 +00:00
Neil Schemenauer 9c63e6d682 Always compile gcmodule. 2001-08-29 23:44:38 +00:00
Jeremy Hylton e4685ec57e Track the block stack more reasonably in order to handle continue in
try/except or try/finally.

Previous versions had only track SETUP_LOOP blocks and ignored the
exception part.  This meant that it allowed continue inside a
try/except but generated buggy code.  Now it does the right thing.
2001-08-29 22:30:09 +00:00
Jeremy Hylton 9263848fa1 Improve stack depth computation for try/except and try/finally
Add CONTINUE_LOOP to the list of unconditional transfers
2001-08-29 22:27:14 +00:00
Jeremy Hylton 4bd4dddd55 Add __getitem__() handler for use by visitContinue() 2001-08-29 22:26:35 +00:00
Jack Jansen 7c10008917 Added xx and xxsubtype modules, for completeness and because xxsubtype is used by the test suite. 2001-08-29 22:08:06 +00:00
Jack Jansen 028f2d5d89 Started on release notes and readme for 2.2a2. 2001-08-29 22:04:08 +00:00
Tim Peters 79248aa1e4 SF bug [#456252] Python should never stomp on [u]intptr_t.
pyport.h:  typedef a new Py_intptr_t type.
    DELICATE ASSUMPTION:  That HAVE_UINTPTR_T implies intptr_t is
    available as well as uintptr_t.  If that turns out not to be
    true, things must get uglier (C99 wants both, so I think it's
    an assumption we're *likely* to get away with).
thread_nt.h, PyThread_start_new_thread:  MS _beginthread is documented
    as returning unsigned long; no idea why uintptr_t was being used.
Others:  Always use Py_[u]intptr_t, never [u]intptr_t directly.
2001-08-29 21:37:10 +00:00
Jeremy Hylton 1936745668 Generate SET_LINENO for list and tuple literals when the open paren
starts a new line.

Also fix undetected typo in visitDict() -- uncovered by recent change
to add lineno attrs to atoms.
2001-08-29 20:57:43 +00:00
Jeremy Hylton 7845cf8d37 Make sure that atoms (Tuple, List, etc.) have lineno attributes 2001-08-29 20:56:30 +00:00
Jeremy Hylton 4ba9001f5c Fix off-by-one errors in code to find depth of stack.
XXX The code is still widely inaccurate, but most (all?) of the time
it's an overestimate.
2001-08-29 20:55:17 +00:00
Jack Jansen 87797872a8 Workaround by Tim Peters to skip this test if run from test.autotest,
in which case it will hang because the import lock is already held
by the main thread.
2001-08-29 20:26:24 +00:00
Jeremy Hylton bf77c465bd Undo change from list to dict for handling varnames, consts, etc.
As the doc string for _lookupName() explains:

    This routine uses a list instead of a dictionary, because a
    dictionary can't store two different keys if the keys have the
    same value but different types, e.g. 2 and 2L.  The compiler
    must treat these two separately, so it does an explicit type
    comparison before comparing the values.
2001-08-29 19:45:33 +00:00
Jeremy Hylton 5a9ac97040 Change default() to use getChildNodes() instead of getChildren() 2001-08-29 18:17:22 +00:00
Jeremy Hylton 94afe32b5e Support // and //=
Generate SET_LINENO for del statements.

Define klass=1 for PyFlowGraph constructor for a class statement.  A
class has no varnames.
2001-08-29 18:14:39 +00:00
Jeremy Hylton 7abf520d6c Add support for // and //=.
Avoid if/elif/elif/else tests where the final else is supposed to
handle exactly one case instead of all other cases.  When the list of
operators is extended, the catchall else treats all new operators as
the last operator in the set of tests.  Instead, raise an exception if
an unexpected operator occurs.
2001-08-29 18:12:30 +00:00
Jeremy Hylton d4be10dc2c Add generator detection to symbol table.
Fix bug in handling of statements like "l[x:y] = 2".  The visitor was
treating this as assignments to l, x, and y!
2001-08-29 18:10:51 +00:00
Jeremy Hylton e4e9cd4c01 Modify name conversion to be (hopefully) a bit more efficient.
Use a dictionary instead of a list to map objects to their offsets in
a const/name tuple of a code object.

XXX The conversion is perhaps incomplete, in that we shouldn't have to
do the list2dict to start.
2001-08-29 18:09:50 +00:00
Jeremy Hylton 5477f529d6 Revise implementations of getChildren() and getChildNodes().
Add support for floor division (// and //=)

The implementation of getChildren() and getChildNodes() is intended to
be faster, because it avoids calling flatten() on every return value.
But it's not clear that it is a lot faster, because constructing a
tuple with just the right values ends up being slow.  (Too many
attribute lookups probably.)

The ast.txt file is much more complicated, with funny characters at
the ends of names (*, &, !) to indicate the types of each child node.

The astgen script is also much more complex, making me wonder if it's
still useful.
2001-08-29 18:08:02 +00:00
Jeremy Hylton 96d68d57be Add opcodes for floor division and true division (PEP 238) 2001-08-29 18:02:21 +00:00
Jeremy Hylton 4de8df92e9 Add tests for augmented floor division 2001-08-29 17:50:27 +00:00
Jeremy Hylton da8db8ca18 Don't include doc string of class in its code child 2001-08-29 17:19:02 +00:00
Guido van Rossum 8aea0cc94e Now that int is subclassable, have to change a test that tests for
non-subclassability.  (More tests for number subclassing should follow.)
2001-08-29 15:48:43 +00:00
Guido van Rossum bef1417f9f Make int, long and float subclassable.
This uses a slightly wimpy and wasteful approach, but it works. :-)
2001-08-29 15:47:46 +00:00
Guido van Rossum e705ef1bce Fix super() so that it is usable for static methods (like __new__) as well.
In particular, the second argument can now be a subclass of the first
as well (normally it must be an instance though).
2001-08-29 15:47:06 +00:00
Guido van Rossum c16fcdf533 Make the PyXXX_Check() macros for the numeric types inheritance-aware. 2001-08-29 15:45:32 +00:00
Jack Jansen c51395d797 GUSI on the Mac creates threads with a default stack size of 20KB, which is
not enough for Python. Increased the stacksize to a (somewhat arbitrary)
64KB.
2001-08-29 15:24:53 +00:00
Fred Drake f9dc04341d Fix a minor markup typo. 2001-08-29 02:34:10 +00:00
Tim Peters 8211237db8 marshal.c r_long64: When reading a TYPE_INT64 value on a box with 32-bit
ints, convert to PyLong (rather than throwing away the high-order 32 bits).
2001-08-29 02:28:42 +00:00
Barry Warsaw da21ce3e31 On Fred's suggestion, convert sprintf() examples to use
PyString_FromFormat().  Also fixed one grammar problem, and a few
other mark-up issues.  Sample code not checked.
2001-08-29 01:41:58 +00:00
Andrew M. Kuchling 0ab31b8562 Add METH_O and METH_NOARGS change
Rewrite snprintf() item a bit
Bump version number
2001-08-29 01:16:54 +00:00
Tim Peters 19ef62d5a9 pickle.py, load_int(): Match cPickle's just-repaired ability to unpickle
64-bit INTs on 32-bit boxes (where they become longs).  Also exploit that
int(str) and long(str) will ignore a trailing newline (saves creating a
new string at the Python level).

pickletester.py:  Simulate reading a pickle produced by a 64-bit box.
2001-08-28 22:21:18 +00:00
Tim Peters 12778e314b load_int: The fallback to long ints was coded in such a way that it
couldn't succeed.  Fixed.
2001-08-28 22:08:34 +00:00
Barry Warsaw 08f9956261 Update an email address. 2001-08-28 21:26:33 +00:00
Tim Peters c6d958192e Note change in fp literal syntax (e.g. "3e-" worked by accident before). 2001-08-28 20:56:27 +00:00
Guido van Rossum 5592e4d7d5 Fix a typo in SLOT0 macro for the declaration of cache_str.
Dunno why I didn't catch this before.
2001-08-28 18:28:21 +00:00
Guido van Rossum ce129a5e79 Fix the test again due to fewer calls to __getattr__. 2001-08-28 18:23:24 +00:00
Guido van Rossum 2730b13202 Finish the previous checkin: also avoid getattr when calling the method
directly.
2001-08-28 18:22:14 +00:00
Fred Drake b5f17f2dc5 Revise comments about TeX & LaTeX for accuracy.
This closes SF bug #456222.
2001-08-28 18:09:11 +00:00
Guido van Rossum a5be8eda37 Fix one test to reflect the change in method lookup policy. 2001-08-28 17:58:55 +00:00
Guido van Rossum 607187325f Change in policy: when a slot_tp_xxx function looks for the __xxx__ method,
don't use getattr, but only look in the dict of the type and base types.
This prevents picking up all sorts of weird stuff, including things defined
by the metaclass when the object is a class (type).

For this purpose, a helper function lookup_method() was added.  One or two
other places also use this.
2001-08-28 17:47:51 +00:00
Jeremy Hylton 2ac9c3eec5 Make sure the JUMP_ABSOLUTE and POP_BLOCK at the end of a for loop are
contiguous.
2001-08-28 17:28:33 +00:00
Guido van Rossum cbfc855f57 The "O!" format code should implement an isinstance() test
rather than a type equality test.
2001-08-28 16:37:51 +00:00
Jeremy Hylton 63db7b9ca1 XXX_NAME ops should affect varnames
varnames should list all the local variables (with arguments first).
The XXX_NAME ops typically occur at the module level and assignment
ops should create locals.
2001-08-28 16:36:12 +00:00
Jeremy Hylton f354575328 Generate FOR_ITER-based loops instead of old FOR_LOOP-based loops 2001-08-28 16:35:18 +00:00
Jeremy Hylton 318e167e98 FOR_ITER is a jrel_op() not a plain old def_op() 2001-08-28 15:32:48 +00:00
Fred Drake d800cff80d Added explanation that [...] * n generates shallow copies of [...], so
the contents will be shared by multiple references.

This closes SF bug #455694.
2001-08-28 14:56:05 +00:00