]> granicus.if.org Git - python/log
python
23 years agoGenerate SET_LINENO for list and tuple literals when the open paren
Jeremy Hylton [Wed, 29 Aug 2001 20:57:43 +0000 (20:57 +0000)]
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.

23 years agoMake sure that atoms (Tuple, List, etc.) have lineno attributes
Jeremy Hylton [Wed, 29 Aug 2001 20:56:30 +0000 (20:56 +0000)]
Make sure that atoms (Tuple, List, etc.) have lineno attributes

23 years agoFix off-by-one errors in code to find depth of stack.
Jeremy Hylton [Wed, 29 Aug 2001 20:55:17 +0000 (20:55 +0000)]
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.

23 years agoWorkaround by Tim Peters to skip this test if run from test.autotest,
Jack Jansen [Wed, 29 Aug 2001 20:26:24 +0000 (20:26 +0000)]
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.

23 years agoUndo change from list to dict for handling varnames, consts, etc.
Jeremy Hylton [Wed, 29 Aug 2001 19:45:33 +0000 (19:45 +0000)]
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.

23 years agoChange default() to use getChildNodes() instead of getChildren()
Jeremy Hylton [Wed, 29 Aug 2001 18:17:22 +0000 (18:17 +0000)]
Change default() to use getChildNodes() instead of getChildren()

23 years agoSupport // and //=
Jeremy Hylton [Wed, 29 Aug 2001 18:14:39 +0000 (18:14 +0000)]
Support // and //=

Generate SET_LINENO for del statements.

Define klass=1 for PyFlowGraph constructor for a class statement.  A
class has no varnames.

23 years agoAdd support for // and //=.
Jeremy Hylton [Wed, 29 Aug 2001 18:12:30 +0000 (18:12 +0000)]
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.

23 years agoAdd generator detection to symbol table.
Jeremy Hylton [Wed, 29 Aug 2001 18:10:51 +0000 (18:10 +0000)]
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!

23 years agoModify name conversion to be (hopefully) a bit more efficient.
Jeremy Hylton [Wed, 29 Aug 2001 18:09:50 +0000 (18:09 +0000)]
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.

23 years agoRevise implementations of getChildren() and getChildNodes().
Jeremy Hylton [Wed, 29 Aug 2001 18:08:02 +0000 (18:08 +0000)]
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.

23 years agoAdd opcodes for floor division and true division (PEP 238)
Jeremy Hylton [Wed, 29 Aug 2001 18:02:21 +0000 (18:02 +0000)]
Add opcodes for floor division and true division (PEP 238)

23 years agoAdd tests for augmented floor division
Jeremy Hylton [Wed, 29 Aug 2001 17:50:27 +0000 (17:50 +0000)]
Add tests for augmented floor division

23 years agoDon't include doc string of class in its code child
Jeremy Hylton [Wed, 29 Aug 2001 17:19:02 +0000 (17:19 +0000)]
Don't include doc string of class in its code child

23 years agoNow that int is subclassable, have to change a test that tests for
Guido van Rossum [Wed, 29 Aug 2001 15:48:43 +0000 (15:48 +0000)]
Now that int is subclassable, have to change a test that tests for
non-subclassability.  (More tests for number subclassing should follow.)

23 years agoMake int, long and float subclassable.
Guido van Rossum [Wed, 29 Aug 2001 15:47:46 +0000 (15:47 +0000)]
Make int, long and float subclassable.
This uses a slightly wimpy and wasteful approach, but it works. :-)

23 years agoFix super() so that it is usable for static methods (like __new__) as well.
Guido van Rossum [Wed, 29 Aug 2001 15:47:06 +0000 (15:47 +0000)]
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).

23 years agoMake the PyXXX_Check() macros for the numeric types inheritance-aware.
Guido van Rossum [Wed, 29 Aug 2001 15:45:32 +0000 (15:45 +0000)]
Make the PyXXX_Check() macros for the numeric types inheritance-aware.

23 years agoGUSI on the Mac creates threads with a default stack size of 20KB, which is
Jack Jansen [Wed, 29 Aug 2001 15:24:53 +0000 (15:24 +0000)]
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.

23 years agoFix a minor markup typo.
Fred Drake [Wed, 29 Aug 2001 02:34:10 +0000 (02:34 +0000)]
Fix a minor markup typo.

23 years agomarshal.c r_long64: When reading a TYPE_INT64 value on a box with 32-bit
Tim Peters [Wed, 29 Aug 2001 02:28:42 +0000 (02:28 +0000)]
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).

23 years agoOn Fred's suggestion, convert sprintf() examples to use
Barry Warsaw [Wed, 29 Aug 2001 01:41:58 +0000 (01:41 +0000)]
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.

23 years agoAdd METH_O and METH_NOARGS change
Andrew M. Kuchling [Wed, 29 Aug 2001 01:16:54 +0000 (01:16 +0000)]
Add METH_O and METH_NOARGS change
Rewrite snprintf() item a bit
Bump version number

23 years agopickle.py, load_int(): Match cPickle's just-repaired ability to unpickle
Tim Peters [Tue, 28 Aug 2001 22:21:18 +0000 (22:21 +0000)]
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.

23 years agoload_int: The fallback to long ints was coded in such a way that it
Tim Peters [Tue, 28 Aug 2001 22:08:34 +0000 (22:08 +0000)]
load_int:  The fallback to long ints was coded in such a way that it
couldn't succeed.  Fixed.

23 years agoUpdate an email address.
Barry Warsaw [Tue, 28 Aug 2001 21:26:33 +0000 (21:26 +0000)]
Update an email address.

23 years agoNote change in fp literal syntax (e.g. "3e-" worked by accident before).
Tim Peters [Tue, 28 Aug 2001 20:56:27 +0000 (20:56 +0000)]
Note change in fp literal syntax (e.g. "3e-" worked by accident before).

23 years agoFix a typo in SLOT0 macro for the declaration of cache_str.
Guido van Rossum [Tue, 28 Aug 2001 18:28:21 +0000 (18:28 +0000)]
Fix a typo in SLOT0 macro for the declaration of cache_str.
Dunno why I didn't catch this before.

23 years agoFix the test again due to fewer calls to __getattr__.
Guido van Rossum [Tue, 28 Aug 2001 18:23:24 +0000 (18:23 +0000)]
Fix the test again due to fewer calls to __getattr__.

23 years agoFinish the previous checkin: also avoid getattr when calling the method
Guido van Rossum [Tue, 28 Aug 2001 18:22:14 +0000 (18:22 +0000)]
Finish the previous checkin: also avoid getattr when calling the method
directly.

23 years agoRevise comments about TeX & LaTeX for accuracy.
Fred Drake [Tue, 28 Aug 2001 18:09:11 +0000 (18:09 +0000)]
Revise comments about TeX & LaTeX for accuracy.
This closes SF bug #456222.

23 years agoFix one test to reflect the change in method lookup policy.
Guido van Rossum [Tue, 28 Aug 2001 17:58:55 +0000 (17:58 +0000)]
Fix one test to reflect the change in method lookup policy.

23 years agoChange in policy: when a slot_tp_xxx function looks for the __xxx__ method,
Guido van Rossum [Tue, 28 Aug 2001 17:47:51 +0000 (17:47 +0000)]
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.

23 years agoMake sure the JUMP_ABSOLUTE and POP_BLOCK at the end of a for loop are
Jeremy Hylton [Tue, 28 Aug 2001 17:28:33 +0000 (17:28 +0000)]
Make sure the JUMP_ABSOLUTE and POP_BLOCK at the end of a for loop are
contiguous.

23 years agoThe "O!" format code should implement an isinstance() test
Guido van Rossum [Tue, 28 Aug 2001 16:37:51 +0000 (16:37 +0000)]
The "O!" format code should implement an isinstance() test
rather than a type equality test.

23 years agoXXX_NAME ops should affect varnames
Jeremy Hylton [Tue, 28 Aug 2001 16:36:12 +0000 (16:36 +0000)]
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.

23 years agoGenerate FOR_ITER-based loops instead of old FOR_LOOP-based loops
Jeremy Hylton [Tue, 28 Aug 2001 16:35:18 +0000 (16:35 +0000)]
Generate FOR_ITER-based loops instead of old FOR_LOOP-based loops

23 years agoFOR_ITER is a jrel_op() not a plain old def_op()
Jeremy Hylton [Tue, 28 Aug 2001 15:32:48 +0000 (15:32 +0000)]
FOR_ITER is a jrel_op() not a plain old def_op()

23 years agoAdded explanation that [...] * n generates shallow copies of [...], so
Fred Drake [Tue, 28 Aug 2001 14:56:05 +0000 (14:56 +0000)]
Added explanation that [...] * n generates shallow copies of [...], so
the contents will be shared by multiple references.

This closes SF bug #455694.

23 years agoAdded list of tests expected to be skipped on the mac.
Jack Jansen [Tue, 28 Aug 2001 14:49:00 +0000 (14:49 +0000)]
Added list of tests expected to be skipped on the mac.

23 years agoFix a number of minor markup errors, and improve the consistency a bit.
Fred Drake [Tue, 28 Aug 2001 14:25:03 +0000 (14:25 +0000)]
Fix a number of minor markup errors, and improve the consistency a bit.

23 years agoPlant a mention in the description of backreferences of the fact that
Eric S. Raymond [Tue, 28 Aug 2001 12:50:03 +0000 (12:50 +0000)]
Plant a mention in the description of backreferences of the fact that
while \0 doesn't do what one might expect, \g<0> does.

23 years agoRefcount info for PyString_FromFormat() and PyString_FromFormatV().
Barry Warsaw [Tue, 28 Aug 2001 02:32:04 +0000 (02:32 +0000)]
Refcount info for PyString_FromFormat() and PyString_FromFormatV().
Closes SF patch #455666.

23 years agoDocumentation for PyString_FromFormat() and PyString_FromFormatV().
Barry Warsaw [Tue, 28 Aug 2001 02:31:28 +0000 (02:31 +0000)]
Documentation for PyString_FromFormat() and PyString_FromFormatV().
Closes SF patch #455666.

23 years agoExperimental feature: allow \n as well as \r as newline for text files, by breaking...
Jack Jansen [Mon, 27 Aug 2001 23:16:34 +0000 (23:16 +0000)]
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.

23 years agoHandle private names
Jeremy Hylton [Mon, 27 Aug 2001 22:56:16 +0000 (22:56 +0000)]
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()

23 years agoexceptions was missing from the module list. Added.
Jack Jansen [Mon, 27 Aug 2001 22:50:41 +0000 (22:50 +0000)]
exceptions was missing from the module list. Added.

23 years agoA quick hack to make the test pass on the Mac (similar to the quick hack
Jack Jansen [Mon, 27 Aug 2001 22:31:58 +0000 (22:31 +0000)]
A quick hack to make the test pass on the Mac (similar to the quick hack
to make it pass on Windows:-).

23 years agoemit SET_LINENO for augmented assignments
Jeremy Hylton [Mon, 27 Aug 2001 21:58:09 +0000 (21:58 +0000)]
emit SET_LINENO for augmented assignments

23 years agoMany changes -- bug fixes and sundry improvements
Jeremy Hylton [Mon, 27 Aug 2001 21:51:52 +0000 (21:51 +0000)]
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).

23 years agoFix another test still expecting overflow on big int literals.
Tim Peters [Mon, 27 Aug 2001 21:50:42 +0000 (21:50 +0000)]
Fix another test still expecting overflow on big int literals.

23 years agoChange test_overflow to test_no_overflow; looks like big int literals
Tim Peters [Mon, 27 Aug 2001 21:45:32 +0000 (21:45 +0000)]
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.

23 years agoUse the new macresource module to open the accompanying resource file (if needed).
Jack Jansen [Mon, 27 Aug 2001 21:41:23 +0000 (21:41 +0000)]
Use the new macresource module to open the accompanying resource file (if needed).

23 years agoneed() now returns the refno of the resource file opened, or None if the
Jack Jansen [Mon, 27 Aug 2001 21:37:45 +0000 (21:37 +0000)]
need() now returns the refno of the resource file opened, or None if the
specified resource was already available and no file was opened.

23 years agoModule to help other modules locate their resources. It currently knows about
Jack Jansen [Mon, 27 Aug 2001 21:21:07 +0000 (21:21 +0000)]
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.

23 years agoThese have long outlived there usefulness, in my opinion. Moved to Unsupported.
Jack Jansen [Mon, 27 Aug 2001 21:17:44 +0000 (21:17 +0000)]
These have long outlived there usefulness, in my opinion. Moved to Unsupported.

23 years agoFix for sibling nodes that define the same free variable
Jeremy Hylton [Mon, 27 Aug 2001 21:06:35 +0000 (21:06 +0000)]
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.

23 years agoAdd lookup_name() to optimize use of stack frames
Jeremy Hylton [Mon, 27 Aug 2001 21:02:51 +0000 (21:02 +0000)]
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)

23 years agoTwo changes to visitor API:
Jeremy Hylton [Mon, 27 Aug 2001 20:47:08 +0000 (20:47 +0000)]
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.

23 years agoWhy didn't I think of Fred off the top of my head?
Jeremy Hylton [Mon, 27 Aug 2001 20:44:20 +0000 (20:44 +0000)]
Why didn't I think of Fred off the top of my head?

23 years agoAdd everyone I can think of off the top of my head
Jeremy Hylton [Mon, 27 Aug 2001 20:43:16 +0000 (20:43 +0000)]
Add everyone I can think of off the top of my head

23 years agoRevise regrtest to compile entire standard library.
Jeremy Hylton [Mon, 27 Aug 2001 20:40:43 +0000 (20:40 +0000)]
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.

23 years agoAdd -c option to continue if one file has a SyntaxError
Jeremy Hylton [Mon, 27 Aug 2001 20:39:21 +0000 (20:39 +0000)]
Add -c option to continue if one file has a SyntaxError

23 years agoAdd content-type header to ftp URLs (SF patch #454553)
Jeremy Hylton [Mon, 27 Aug 2001 20:16:53 +0000 (20:16 +0000)]
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.

23 years agoDocs for the PEP 264 changes.
Michael W. Hudson [Mon, 27 Aug 2001 20:02:17 +0000 (20:02 +0000)]
Docs for the PEP 264 changes.

23 years agoIf an integer constant can't be generated from an integer literal
Jeremy Hylton [Mon, 27 Aug 2001 19:45:25 +0000 (19:45 +0000)]
If an integer constant can't be generated from an integer literal
because of overflow, generate a long instead.

23 years agoSF bug [#455775] float parsing discrepancy.
Tim Peters [Mon, 27 Aug 2001 19:19:28 +0000 (19:19 +0000)]
SF bug [#455775] float parsing discrepancy.
PyTokenizer_Get:  error if exponent contains no digits (3e, 2.0e+, ...).

23 years agoAdded Dean Draayer to the thank you list.
Jack Jansen [Mon, 27 Aug 2001 15:30:48 +0000 (15:30 +0000)]
Added Dean Draayer to the thank you list.

23 years agoPatch by Dean Draayer: support for indeterminate progress bars. You
Jack Jansen [Mon, 27 Aug 2001 15:24:07 +0000 (15:24 +0000)]
Patch by Dean Draayer: support for indeterminate progress bars. You
get these by specifying maxval=0, which is now also the default.

Untested.

23 years agoPatch by Bill Noon: added 'dylib' as a library type along with
Jack Jansen [Mon, 27 Aug 2001 15:08:16 +0000 (15:08 +0000)]
Patch by Bill Noon: added 'dylib' as a library type along with
'static' and 'shared'. This fixes extension building for dynamic
Pythons on MacOSX.

23 years agoFixes by Thomas Heller:
Jack Jansen [Mon, 27 Aug 2001 14:30:55 +0000 (14:30 +0000)]
Fixes by Thomas Heller:
- make the selftests work again (they were apparently not used since
  very early in bgen's development), with some minor cleanup by me
- make emacs python mode happier

23 years agoRefer to the toolbox modules by their official name (Carbon.AE), not the internal...
Jack Jansen [Mon, 27 Aug 2001 14:01:05 +0000 (14:01 +0000)]
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.

23 years agoWhen we're freezing to sourcecode and one of the modules is a dynamic module that...
Jack Jansen [Mon, 27 Aug 2001 13:59:35 +0000 (13:59 +0000)]
When we're freezing to sourcecode and one of the modules is a dynamic module that is in a package we freeze that module at toplevel (outside any package). Not optimal, but there is little more we can do as config.c has no way to specify a builtin module has to be dumped into a package.

23 years agoUpdated to the current state of affairs.
Jack Jansen [Mon, 27 Aug 2001 13:58:21 +0000 (13:58 +0000)]
Updated to the current state of affairs.

23 years agoAdded targets for building the Carbon and Classic interpreter if you don't want to...
Jack Jansen [Mon, 27 Aug 2001 13:57:43 +0000 (13:57 +0000)]
Added targets for building the Carbon and Classic interpreter if you don't want to go through fullbuild.py.

23 years ago- A forgotten "from Carbon".
Jack Jansen [Mon, 27 Aug 2001 10:55:41 +0000 (10:55 +0000)]
- A forgotten "from Carbon".
- Made the "killed unknown window" code dependent on a global var,
  so you can easily turn the behaviour off for IDE debugging.

23 years agoA few forgotten "from Carbon"s.
Jack Jansen [Mon, 27 Aug 2001 10:54:55 +0000 (10:54 +0000)]
A few forgotten "from Carbon"s.

23 years agoSF patch [ #455137 ] Makes popen work with COMMAND.COM on WNT, from
Tim Peters [Mon, 27 Aug 2001 06:37:48 +0000 (06:37 +0000)]
SF patch [ #455137 ] Makes popen work with COMMAND.COM on WNT, from
Brian Quinlan.

23 years agoTwo improvements suggested by Greg Stein:
Barry Warsaw [Mon, 27 Aug 2001 03:11:09 +0000 (03:11 +0000)]
Two improvements suggested by Greg Stein:

PyString_FromFormatV(): In the final resize at the end, we can use
    PyString_AS_STRING() since we know the object is a string and can
    avoid the typechecking.

PyString_FromFormat(): GS sez: "For safety/propriety, you should call
    va_end() on the vargs variable."

23 years agoImport the MacOS toolbox modules from the Carbon package.
Jack Jansen [Sat, 25 Aug 2001 12:15:04 +0000 (12:15 +0000)]
Import the MacOS toolbox modules from the Carbon package.

23 years agoStep 2 in putting the MacOS toolbox modules in a package: issue a DepracationWarning...
Jack Jansen [Sat, 25 Aug 2001 11:53:43 +0000 (11:53 +0000)]
Step 2 in putting the MacOS toolbox modules in a package: issue a DepracationWarning in the compatibility modules.

23 years agoPyString_FromFormatV: Massage platform %p output to match what gcc does,
Tim Peters [Sat, 25 Aug 2001 03:02:28 +0000 (03:02 +0000)]
PyString_FromFormatV:  Massage platform %p output to match what gcc does,
at least in the first two characters.  %p is ill-defined, and people will
forever commit bad tests otherwise ("bad" in the sense that they fall
over (at least on Windows) for lack of a leading '0x'; 5 of the 7 tests
in test_repr.py failed on Windows for that reason this time around).

23 years agoUndo previous checkin -- Barry fixed it better.
Guido van Rossum [Fri, 24 Aug 2001 19:46:21 +0000 (19:46 +0000)]
Undo previous checkin -- Barry fixed it better.

23 years agoUpdate test output to match new (more informative) error message about
Guido van Rossum [Fri, 24 Aug 2001 19:31:43 +0000 (19:31 +0000)]
Update test output to match new (more informative) error message about
calling unbound method with wrong first argument.

23 years agoQuick and dirty fix for test_extcall failures trigged by Guido's
Barry Warsaw [Fri, 24 Aug 2001 19:11:57 +0000 (19:11 +0000)]
Quick and dirty fix for test_extcall failures trigged by Guido's
recent classobject.c change.  When calling an unbound method with no
instances as first argument, the error message has changed.  The
message now contains the class name, but the output text being
compared to is too generic, so skip printing it.

23 years agoRemove the local 'getset' class -- this is now a built-in type with
Guido van Rossum [Fri, 24 Aug 2001 18:52:50 +0000 (18:52 +0000)]
Remove the local 'getset' class -- this is now a built-in type with
the same signature.

23 years agogetset_init(): the function name in the PyArg_ParseTuple() format
Guido van Rossum [Fri, 24 Aug 2001 18:49:10 +0000 (18:49 +0000)]
getset_init(): the function name in the PyArg_ParseTuple() format
should just be "getset", not "getset.__init__".

23 years agoImprove the error message issued when an unbound method is called with
Guido van Rossum [Fri, 24 Aug 2001 18:48:27 +0000 (18:48 +0000)]
Improve the error message issued when an unbound method is called with
an inappropriate first argument.  Now that there are more ways for
this to fail, make sure to report the name of the class of the
expected instance and of the actual instance.

23 years agoRip the import repr truncation test out of here and put it in test_repr.py
Barry Warsaw [Fri, 24 Aug 2001 18:38:02 +0000 (18:38 +0000)]
Rip the import repr truncation test out of here and put it in test_repr.py

23 years agoAdded lots of tests for reprs of "simple" objects, such as file,
Barry Warsaw [Fri, 24 Aug 2001 18:37:32 +0000 (18:37 +0000)]
Added lots of tests for reprs of "simple" objects, such as file,
lambda (anonymous functions?), function, xrange, buffer, cell (need to
fill in), and (some) descriptor types.

Also added a new test case for testing repr truncation fixes.

23 years agoPyErr_Format(): Factor out most of this code into
Barry Warsaw [Fri, 24 Aug 2001 18:35:23 +0000 (18:35 +0000)]
PyErr_Format(): Factor out most of this code into
    PyString_FromFormat() since it's much more generally useful than
    just for exceptions.

23 years agorepr's converted to using PyString_FromFormat() instead of sprintf'ing
Barry Warsaw [Fri, 24 Aug 2001 18:34:26 +0000 (18:34 +0000)]
repr's converted to using PyString_FromFormat() instead of sprintf'ing
into a hardcoded char* buffer.

Closes patch #454743.

23 years agoPyString_FromFormat() and PyString_FromFormatV(): Largely ripped from
Barry Warsaw [Fri, 24 Aug 2001 18:32:06 +0000 (18:32 +0000)]
PyString_FromFormat() and PyString_FromFormatV(): Largely ripped from
    PyErr_Format() these new C API methods can be used instead of
    sprintf()'s into hardcoded char* buffers.  This allows us to fix
    many situation where long package, module, or class names get
    truncated in reprs.

    PyString_FromFormat() is the varargs variety.
    PyString_FromFormatV() is the va_list variety

    Original PyErr_Format() code was modified to allow %p and %ld
    expansions.

    Many reprs were converted to this, checkins coming soo.  Not
    changed: complex_repr(), float_repr(), float_print(), float_str(),
    int_repr().  There may be other candidates not yet converted.

    Closes patch #454743.

23 years agoRepair repr of future-features (wasn't updated to include the new
Tim Peters [Fri, 24 Aug 2001 17:13:54 +0000 (17:13 +0000)]
Repair repr of future-features (wasn't updated to include the new
compiler-flag argument).

23 years agosupers(): typo -- "if verify" should be "if verbose".
Guido van Rossum [Fri, 24 Aug 2001 17:07:20 +0000 (17:07 +0000)]
supers(): typo -- "if verify" should be "if verbose".

23 years agoAdd test suite for super().
Guido van Rossum [Fri, 24 Aug 2001 16:55:27 +0000 (16:55 +0000)]
Add test suite for super().

23 years agoAdd 'super' builtin type.
Guido van Rossum [Fri, 24 Aug 2001 16:52:18 +0000 (16:52 +0000)]
Add 'super' builtin type.

23 years agoAdd decl of PySuper_Type; fixup comments for the two other types.
Guido van Rossum [Fri, 24 Aug 2001 16:51:42 +0000 (16:51 +0000)]
Add decl of PySuper_Type; fixup comments for the two other types.

23 years agoAdd 'super', another new object type with magical properties.
Guido van Rossum [Fri, 24 Aug 2001 16:47:00 +0000 (16:47 +0000)]
Add 'super', another new object type with magical properties.

super(type) -> unbound super object
super(type, obj) -> bound super object; requires isinstance(obj, type)

Typical use to call a cooperative superclass method:

class C(B):
    def meth(self, arg):
        super(C, self).meth(arg);

23 years agoAdd a test for the new getset type.
Guido van Rossum [Fri, 24 Aug 2001 15:24:24 +0000 (15:24 +0000)]
Add a test for the new getset type.