Commit Graph

19355 Commits

Author SHA1 Message Date
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
Jack Jansen 49a806edbb Added list of tests expected to be skipped on the mac. 2001-08-28 14:49:00 +00:00
Fred Drake 5cb29a49c8 Fix a number of minor markup errors, and improve the consistency a bit. 2001-08-28 14:25:03 +00:00
Eric S. Raymond 46ccd1dae5 Plant a mention in the description of backreferences of the fact that
while \0 doesn't do what one might expect, \g<0> does.
2001-08-28 12:50:03 +00:00
Barry Warsaw 8c64a54f75 Refcount info for PyString_FromFormat() and PyString_FromFormatV().
Closes SF patch #455666.
2001-08-28 02:32:04 +00:00
Barry Warsaw c86aa57f58 Documentation for PyString_FromFormat() and PyString_FromFormatV().
Closes SF patch #455666.
2001-08-28 02:31:28 +00:00
Jack Jansen 3070ee6b37 Experimental feature: allow \n as well as \r as newline for text files, by breaking in to the lowlevel I/O system. Can be disabled by defining WITHOUT_UNIX_NEWLINES. 2001-08-27 23:16:34 +00:00
Jeremy Hylton c59e220000 Handle private names
(Hard to believe these were never handled before)

Add misc.mangle() that mangles based on the rules in compile.c.
XXX Need to test the corner cases

Update CodeGenerator with a class_name attribute bound to None.  If a
particular instance is created within a class scope, the instance's
class_name is bound to that class's name.

Add mangle() method to CodeGenerator that mangles if the class_name
has a class_name in it.

Modify the FunctionCodeGenerator family to handle an extra argument--
the class_name.

Wrap all name ops and attrnames in calls to self.mangle()
2001-08-27 22:56:16 +00:00
Jack Jansen e7d8322630 exceptions was missing from the module list. Added. 2001-08-27 22:50:41 +00:00
Jack Jansen 535c524508 A quick hack to make the test pass on the Mac (similar to the quick hack
to make it pass on Windows:-).
2001-08-27 22:31:58 +00:00
Jeremy Hylton 80ea40d858 emit SET_LINENO for augmented assignments 2001-08-27 21:58:09 +00:00
Jeremy Hylton 2afff324ea Many changes -- bug fixes and sundry improvements
Make nested scopes enabled by default

Add is_constant_false() helper so that compiled code and symbols are
consistent with builtin compiler's handling of "if 0:"

Fix doc string handling to be consistent with recent change that
eliminates the doc string from the Module's node attribute.

Add fix to print handling from Evan & Shane.

Track change to visitor api by making "verbose" explicit.

Comment out setting CO_NESTED flag (it's unnecessary in 2.2).
2001-08-27 21:51:52 +00:00
Tim Peters 9f448150c8 Fix another test still expecting overflow on big int literals. 2001-08-27 21:50:42 +00:00
Tim Peters c15a82813a Change test_overflow to test_no_overflow; looks like big int literals
are auto-coerced to longs now, but this test still expected OverflowError.
I can't imagine this test failure was unique to Windows.
2001-08-27 21:45:32 +00:00
Jack Jansen 3c06b9a7d4 Use the new macresource module to open the accompanying resource file (if needed). 2001-08-27 21:41:23 +00:00
Jack Jansen a5d7da528b need() now returns the refno of the resource file opened, or None if the
specified resource was already available and no file was opened.
2001-08-27 21:37:45 +00:00
Jack Jansen de3226f7f9 Module to help other modules locate their resources. It currently knows about
resources in applets and separate OS9 style resource files, but it will
eventually also be thought the hoops to jump through on OSX/MachO.
2001-08-27 21:21:07 +00:00
Jack Jansen 8f2b13efce These have long outlived there usefulness, in my opinion. Moved to Unsupported. 2001-08-27 21:17:44 +00:00
Jeremy Hylton cd8a127e1a Fix for sibling nodes that define the same free variable
Evan Simpson's fix.  And his explanation:

    If you defined two nested functions in a row that refer to the
    same non-global variable, the second one will be generated as
    though the variable were global.
2001-08-27 21:06:35 +00:00
Jeremy Hylton 7e30c9bb5a Add lookup_name() to optimize use of stack frames
The use of com_node() introduces a lot of extra stack frames, enough
to cause a stack overflow compiling test.test_parser with the standard
interpreter recursionlimit.  The com_node() is a convenience function
that hides the dispatch details, but comes at a very high cost.  It is
more efficient to dispatch directly in the callers.  In these cases,
use lookup_node() and call the dispatched node directly.

Also handle yield_stmt in a way that will work with Python 2.1
(suggested by Shane Hathaway)
2001-08-27 21:02:51 +00:00
Jeremy Hylton 058a5adad0 Two changes to visitor API:
Remove _preorder as alias for dispatch and call dispatch directly.
    Add an extra optional argument to walk()

XXX Also comment out some code that does debugging prints.
2001-08-27 20:47:08 +00:00
Jeremy Hylton cccc478577 Why didn't I think of Fred off the top of my head? 2001-08-27 20:44:20 +00:00
Jeremy Hylton 627673396a Add everyone I can think of off the top of my head 2001-08-27 20:43:16 +00:00
Jeremy Hylton 2a8ec79353 Revise regrtest to compile entire standard library.
The tests are run from a copy of the library directory, where
everything has been compiled by the compiler package.

Add a raw_input() call at the end of the script, so that I can check
the output before the temp directory with the compiled code is
removed.
2001-08-27 20:40:43 +00:00
Jeremy Hylton 33c2a627f1 Add -c option to continue if one file has a SyntaxError 2001-08-27 20:39:21 +00:00
Jeremy Hylton 6d8c1aabff Add content-type header to ftp URLs (SF patch #454553)
Modify rfc822.formatdate() to always generate English names,
regardless of locale.  This is required by RFC 1123.

In open_local_file() of urllib and urllib2, use new formatdate() from
rfc822.
2001-08-27 20:16:53 +00:00
Michael W. Hudson 53da317801 Docs for the PEP 264 changes. 2001-08-27 20:02:17 +00:00