summaryrefslogtreecommitdiffstats
path: root/Lib
Commit message (Collapse)AuthorAgeFilesLines
* Raise OverflowError when appropriate on long->float conversion. Most ofTim Peters2001-09-041-0/+37
| | | | | | | the fiddling is simply due to that no caller of PyLong_AsDouble ever checked for failure (so that's fixing old bugs). PyLong_AsDouble is much faster for big inputs now too, but that's more of a happy consequence than a design goal.
* builtin_dir(): Treat classic classes like types. Use PyDict_Keys insteadTim Peters2001-09-042-11/+32
| | | | | | | | | | | | | | of PyMapping_Keys because we know we have a real dict. Tolerate that objects may have an attr named "__dict__" that's not a dict (Py_None popped up during testing). test_descr.py, test_dir(): Test the new classic-class behavior; beef up the new-style class test similarly. test_pyclbr.py, checkModule(): dir(C) is no longer a synonym for C.__dict__.keys() when C is a classic class (looks like the same thing that burned distutils! -- should it be *made* a synoym again? Then it would be inconsistent with new-style class behavior.).
* Don't use dir() to find instance attribute names.Neil Schemenauer2001-09-031-3/+7
|
* Restore a line deleted by mistake.Tim Peters2001-09-031-0/+2
|
* New restriction on pow(x, y, z): If z is not None, x and y must be ofTim Peters2001-09-034-25/+41
| | | | | integer types, and y must be >= 0. See discussion at http://sf.net/tracker/index.php?func=detail&aid=457066&group_id=5470&atid=105470
* Make dir() wordier (see the new docstring). The new behavior is a mixedTim Peters2001-09-033-11/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | bag. It's clearly wrong for classic classes, at heart because a classic class doesn't have a __class__ attribute, and I'm unclear on whether that's feature or bug. I'll repair this once I find out (in the meantime, dir() applied to classic classes won't find the base classes, while dir() applied to a classic-class instance *will* find the base classes but not *their* base classes). Please give the new dir() a try and see whether you love it or hate it. The new dir([]) behavior is something I could come to love. Here's something to hate: >>> class C: ... pass ... >>> c = C() >>> dir(c) ['__doc__', '__module__'] >>> The idea that an instance has a __doc__ attribute is jarring (of course it's really c.__class__.__doc__ == C.__doc__; likewise for __module__). OTOH, the code already has too many special cases, and dir(x) doesn't have a compelling or clear purpose when x isn't a module.
* Made a doctest out of the examples in Guido's type/class tutorial.Tim Peters2001-09-031-0/+498
|
* Make dictionary() a real constructor. Accepts at most one argument, "aTim Peters2001-09-021-1/+51
| | | | | | | | | | | | mapping object", in the same sense dict.update(x) requires of x (that x has a keys() method and a getitem). Questionable: The other type constructors accept a keyword argument, so I did that here too (e.g., dictionary(mapping={1:2}) works). But type_call doesn't pass the keyword args to the tp_new slot (it passes NULL), it only passes them to the tp_init slot, so getting at them required adding a tp_init slot to dicts. Looks like that makes the normal case (i.e., no args at all) a little slower (the time it takes to call dict.tp_init and have it figure out there's nothing to do).
* Whitespace normalization (tabs -> 4 spaces) in the Mac expectations.Guido van Rossum2001-09-021-35/+35
|
* Add Listbox.itemconfig[ure] call. (A "recent" addition to Tk -- 8.0Guido van Rossum2001-09-011-5/+26
| | | | doesn't have it.) This is from SF bug #457487 by anonymous.
* Allow for the possibility that globals['__name__'] does not exist;Guido van Rossum2001-08-311-1/+4
| | | | | substitute "<string>" for the module name in that case. This actually occurred when running test_descr.py with -Dwarn.
* Correct name mangling algorithm, and add a comment.Guido van Rossum2001-08-311-2/+1
|
* SF bug #456621: normpath on Win32 not collapsing c:\\..Tim Peters2001-08-302-8/+35
| | | | | | I actually rewrote normpath quite a bit: it had no test cases, and as soon as I starting writing some I found several cases that didn't make sense.
* metaclass(): add some more examples of metaclasses, including oneGuido van Rossum2001-08-301-0/+104
| | | | | | using cooperative multiple inheritance. inherits(): add a test for subclassing the unicode type.
* SF patch #455966: Allow leading 0 in float/imag literals.Tim Peters2001-08-302-2/+46
| | | | Consequences for Jython still unknown (but raised on Jython-Dev).
* Fix _convert_NAME() so that it doesn't store locals for class bodies.Jeremy Hylton2001-08-303-15/+15
| | | | | | | | | Fix list comp code generation -- emit GET_ITER instead of Const(0) after the list. Add CO_GENERATOR flag to generators. Get CO_xxx flags from the new module
* Add testcases for inheritance from tricky builtins (numbers, strings,Guido van Rossum2001-08-301-0/+74
| | | | tuples).
* Revert the previous patch to test_pow.py and move the test to test_unary.pyFred Drake2001-08-302-10/+8
| | | | | based on a suggestion from Tim Peters; also make sure that we're really doing exponentiation and not multiplication.
* Added a regression test for the negation-of-exponentiation optimizationFred Drake2001-08-301-0/+11
| | | | bug from compile.c. (SF bug #456756.)
* spurious popJeremy Hylton2001-08-301-1/+0
|
* win_getpass(): if sys.stdin is not sys.__stdin__, useGuido van Rossum2001-08-301-0/+2
| | | | | | | default_getpass(). This should prevent hanging when it is called in IDLE. Fixes SF bug #455648.
* Add a new function imp.lock_held(), and use it to skip test_threaded_importTim Peters2001-08-301-4/+6
| | | | when that test is doomed to deadlock.
* Flush output more aggressively. This makes things look better ifNeil Schemenauer2001-08-291-0/+2
| | | | the setup script is running from inside Vim.
* Track the block stack more reasonably in order to handle continue inJeremy Hylton2001-08-291-13/+45
| | | | | | | | 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.
* Improve stack depth computation for try/except and try/finallyJeremy Hylton2001-08-291-1/+4
| | | | Add CONTINUE_LOOP to the list of unconditional transfers
* Add __getitem__() handler for use by visitContinue()Jeremy Hylton2001-08-291-0/+2
|
* Generate SET_LINENO for list and tuple literals when the open parenJeremy Hylton2001-08-291-1/+3
| | | | | | | starts a new line. Also fix undetected typo in visitDict() -- uncovered by recent change to add lineno attrs to atoms.
* Make sure that atoms (Tuple, List, etc.) have lineno attributesJeremy Hylton2001-08-291-2/+4
|
* Fix off-by-one errors in code to find depth of stack.Jeremy Hylton2001-08-291-3/+3
| | | | | XXX The code is still widely inaccurate, but most (all?) of the time it's an overestimate.
* Workaround by Tim Peters to skip this test if run from test.autotest,Jack Jansen2001-08-291-1/+5
| | | | | in which case it will hang because the import lock is already held by the main thread.
* Undo change from list to dict for handling varnames, consts, etc.Jeremy Hylton2001-08-291-49/+22
| | | | | | | | | | 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.
* Change default() to use getChildNodes() instead of getChildren()Jeremy Hylton2001-08-291-3/+2
|
* Support // and //=Jeremy Hylton2001-08-291-1/+6
| | | | | | | Generate SET_LINENO for del statements. Define klass=1 for PyFlowGraph constructor for a class statement. A class has no varnames.
* Add support for // and //=.Jeremy Hylton2001-08-291-5/+16
| | | | | | | | 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.
* Add generator detection to symbol table.Jeremy Hylton2001-08-291-9/+35
| | | | | Fix bug in handling of statements like "l[x:y] = 2". The visitor was treating this as assignments to l, x, and y!
* Modify name conversion to be (hopefully) a bit more efficient.Jeremy Hylton2001-08-291-17/+52
| | | | | | | | 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.
* Revise implementations of getChildren() and getChildNodes().Jeremy Hylton2001-08-291-100/+602
| | | | | | | | | | | | | | | | 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.
* Add opcodes for floor division and true division (PEP 238)Jeremy Hylton2001-08-291-0/+4
|
* Add tests for augmented floor divisionJeremy Hylton2001-08-292-0/+27
|
* Don't include doc string of class in its code childJeremy Hylton2001-08-291-0/+5
|
* Now that int is subclassable, have to change a test that tests forGuido van Rossum2001-08-291-2/+2
| | | | non-subclassability. (More tests for number subclassing should follow.)
* marshal.c r_long64: When reading a TYPE_INT64 value on a box with 32-bitTim Peters2001-08-291-0/+41
| | | | ints, convert to PyLong (rather than throwing away the high-order 32 bits).
* pickle.py, load_int(): Match cPickle's just-repaired ability to unpickleTim Peters2001-08-282-1/+20
| | | | | | | | 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.
* Update an email address.Barry Warsaw2001-08-281-10/+10
|
* Fix the test again due to fewer calls to __getattr__.Guido van Rossum2001-08-281-3/+1
|
* Fix one test to reflect the change in method lookup policy.Guido van Rossum2001-08-281-2/+1
|
* Make sure the JUMP_ABSOLUTE and POP_BLOCK at the end of a for loop areJeremy Hylton2001-08-281-1/+1
| | | | contiguous.
* XXX_NAME ops should affect varnamesJeremy Hylton2001-08-281-1/+4
| | | | | | 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.
* Generate FOR_ITER-based loops instead of old FOR_LOOP-based loopsJeremy Hylton2001-08-281-5/+9
|
* FOR_ITER is a jrel_op() not a plain old def_op()Jeremy Hylton2001-08-281-1/+1
|