summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Fix peculiar (and ungrammatical) wording in an example program.Greg Ward2002-08-221-2/+2
|
* Simplification/cleanup in IndentTestCases.Greg Ward2002-08-221-16/+10
|
* Factor LongWordTestCase out of WrapTestCase, and rename its methodsGreg Ward2002-08-221-13/+14
| | | | | (tests) from test_funky_punc() to test_break_long() and test_long_words() to test_nobreak_long().
* Rename base test case class to (yawn) BaseTestCase.Greg Ward2002-08-221-3/+3
|
* Ditch the whole loop-over-subcases way of working. Add check_wrap() toGreg Ward2002-08-221-74/+59
| | | | | | | base class (WrapperTestCase) instead, and call it repeatedly in the methods that used to have a loop-over-subcases. Much simpler. Rename perennial temp variable 't' to 'text'.
* Simplify and reformat the use of 'subcases' lists (and followingGreg Ward2002-08-221-52/+32
| | | | | for-loops) in test_simple(), test_wrap_short() test_hyphenated(), and test_funky_punc().
* Add comment header block.Greg Ward2002-08-221-12/+10
| | | | | Remove some useless comments (redundant, or info presumably available in PyUnit docs).
* Conform to standards documented in README:Greg Ward2002-08-221-15/+19
| | | | | | | * lowercase test*() methods * define test_main() and use it instead of unittest.main() Kill #! line. Improve some test names and docstrings.
* Test script for the textwrap module. Kindly provided by Peter HansenGreg Ward2002-08-221-0/+261
| | | | | | <peter@engcorp.com> based on a test script that's been kicking around my home directory for a couple of months now and only saw the light of day because I included it when I sent textwrap.py to python-dev for review.
* On Windows, make sure SocketType is the same as socket. (SF bugGuido van Rossum2002-08-221-1/+1
| | | | 598097)
* Change the binary operators |, &, ^, - to return NotImplemented ratherGuido van Rossum2002-08-221-14/+40
| | | | | | | | | | | | | | | | | | | | than raising TypeError when the other argument is not a BaseSet. This made it necessary to separate the implementation of e.g. __or__ from the union method; the latter should not return NotImplemented but raise TypeError. This is accomplished by making union(self, other) return self|other, etc.; Python's binary operator machinery will raise TypeError. The idea behind this change is to allow other set implementations with an incompatible internal structure; these can provide union (etc.) with standard sets by implementing __ror__ etc. I wish I could do this for comparisons too, but the default comparison implementation allows comparing anything to anything else (returning false); we don't want that (at least the test suite makes sure e.g. Set()==42 raises TypeError). That's probably fine; otherwise other set implementations would be constrained to implementing a hash that's compatible with ours.
* Give the section on PEP 263 a more meaningful title, so readers willFred Drake2002-08-221-1/+1
| | | | be able to locate this information without knowing the PEP number.
* Add a note that apply() is needed since the extended call syntax isFred Drake2002-08-221-0/+2
| | | | completely equivalent.
* Fix grammatically inept comment.Michael W. Hudson2002-08-221-2/+1
|
* Added a main() function and support to run this module as a script.Fred Drake2002-08-212-3/+33
| | | | Closes SF feature request #588768.
* Refactor: Remove some code that was obsoleted when this module wasFred Drake2002-08-211-11/+17
| | | | | | | | | changed to use universal newlines. Remove all imports from the compile() function; these are now done at the top of the module ("Python normal form"), and define a helper based on the platform instead of testing the platform in the compile() function.
* Clarify that even though some of the relevant specifications define theFred Drake2002-08-211-8/+10
| | | | | | | order in which form variables should be encoded in a request, a CGI script should not rely on that since a client may not conform to those specs, or they may not be relevant to the request. Closes SF bug #596866.
* Now that __init__ transforms set elements, we know that all of theRaymond Hettinger2002-08-211-1/+3
| | | | | elements are hashable, so we can use dict.update() or dict.copy() for a C speed Set.copy().
* Add regression test for proper construction of sets of sets.Raymond Hettinger2002-08-211-0/+10
|
* Replace all cases of "while 1" with "while True".Raymond Hettinger2002-08-211-7/+7
| | | | Though slightly slower, has better clarity and teaching value.
* Sped ._update() method by factoring try/except out of the inner loop.Raymond Hettinger2002-08-211-4/+5
|
* Ouch. The test suite *really* needs work!!!!! There were severalGuido van Rossum2002-08-211-46/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | superficial errors and one deep one that aren't currently caught. I'm headed for bed after this checkin. - Fixed several typos introduced by Raymond Hettinger (through cut-n-paste from my template): it's _as_temporarily_immutable, not _as_temporary_immutable, and moreover when the element is added, we should use _as_immutable. - Made the seq argument to ImmutableSet.__init__ optional, so we can write ImmutableSet() to create an immutable empty set. - Rename the seq argument to Set and ImmutableSet to iterable. - Add a Set.__hash__ method that raises a TypeError. We inherit a default __hash__ implementation from object, and we don't want that. We can then catch this in update(), so that e.g. s.update([Set([1])]) will transform the Set([1]) to ImmutableSet([1]). - Added the dance to catch TypeError and try _as_immutable in the constructors too (by calling _update()). This is needed so that Set([Set([1])]) is correctly interpreted as Set([ImmutableSet([1])]). (I was puzzled by a side effect of this and the inherited __hash__ when comparing two sets of sets while testing different powerset implementations: the Set element passed to a Set constructor wasn't transformed to an ImmutableSet, and then the dictionary didn't believe the Set found in one dict it was the same as ImmutableSet in the other, because the hashes were different.) - Refactored Set.update() and both __init__() methods; moved the body of update() into BaseSet as _update(), and call this from __init__() and update(). - Changed the NotImplementedError in BaseSet.__init__ to TypeError, both for consistency with basestring() and because we have to use TypeError when denying Set.__hash__. Together those provide sufficient evidence that an unimplemented method needs to raise TypeError.
* Add Raymond H to the list of authors; add some XXX comments aboutGuido van Rossum2002-08-211-0/+9
| | | | possible API improvements.
* Fast size check for sub/super set testsRaymond Hettinger2002-08-211-0/+4
|
* Optimize try/except ordering in sets.py.Raymond Hettinger2002-08-211-25/+25
| | | | | | | | Gains a 5:1 speed-up for membership testing by handling the most common case first (the case where the element is hashable). Closes SF Patch 597444.
* Minor typoRaymond Hettinger2002-08-201-1/+1
|
* Rename popitem() to pop(). (An idea from SF patch 597444.)Guido van Rossum2002-08-202-3/+3
|
* Move __init__ from BaseSet into Set and ImmutableSet. This causes aGuido van Rossum2002-08-201-16/+28
| | | | | tiny amount of code duplication, but makes it possible to give BaseSet an __init__ that raises an exception.
* Typo repair. Please include in any backports.Guido van Rossum2002-08-201-1/+1
|
* Add a note reminding the reader that sets are not sequences. IGuido van Rossum2002-08-201-0/+10
| | | | | received feedback that was based in the misunderstanding that sets were sequences.
* SF patch 595846 by Brett Cannon: Update environ for CGIHTTPServer.pyGuido van Rossum2002-08-201-2/+1
| | | | | | | This patch causes CGIHTTPServer to update os.environ regardless of how it tries to handle calls (fork, popen*, etc.). Backport bugfix candidate.
* long_format(), long_lshift(): Someone on c.l.py is trying to boostTim Peters2002-08-201-2/+2
| | | | | | | | | | | | SHIFT and MASK, and widen digit. One problem is that code of the form digit << small_integer implicitly assumes that the result fits in an int or unsigned int (platform-dependent, but "int sized" in any case), since digit is promoted "just" to int or unsigned via the usual integer promotions. But if digit is typedef'ed as unsigned int, this loses information. The cure for this is just to cast digit to twodigits first.
* Fix some endcase bugs in unicode rfind()/rindex() and endswith().Guido van Rossum2002-08-204-4/+11
| | | | | | These were reported and fixed by Inyeol Lee in SF bug 595350. The endswith() bug was already fixed in 2.3, but this adds some more test cases.
* Comment typo repair.Michael W. Hudson2002-08-201-1/+1
|
* My patch #597221. Use f_lasti more consistently.Michael W. Hudson2002-08-201-9/+9
|
* Bump version number to 2.3Barry Warsaw2002-08-201-1/+1
|
* Added tests for SF patch #597593, syntactically invalid Content-Type: headers.Barry Warsaw2002-08-201-2/+23
|
* get_content_type(), get_content_maintype(), get_content_subtype(): RFCBarry Warsaw2002-08-201-5/+5
| | | | | | | | | | | 2045, section 5.2 states that if the Content-Type: header is syntactically invalid, the default type should be text/plain. Implement minimal sanity checking of the header -- it must have exactly one slash in it. This closes SF patch #597593 by Skip, but in a different way. Note that these methods used to raise ValueError for invalid ctypes, but now they won't.
* _dispatch(): Use get_content_maintype() and get_content_subtype() toBarry Warsaw2002-08-201-3/+2
| | | | | | get the MIME main and sub types, instead of getting the whole ctype and splitting it here. The two more specific methods now correctly implement RFC 2045, section 5.2.
* getinstclassname(): Squash new compiler wng in assert (comparison ofTim Peters2002-08-201-1/+1
| | | | signed vs unsigned).
* Clarify the endpos argument to the rx.match() method.Fred Drake2002-08-201-2/+6
| | | | Closes SF bug #597177.
* test_three_lines(): Test case reported by Andrew McNamara. Works inBarry Warsaw2002-08-201-0/+8
| | | | email 2.2 but fails in email 1.0.
* Cover the sets module.Andrew M. Kuchling2002-08-201-0/+95
| | | | | (There's a link to PEP218; has PEP218 been updated to match the actual module implementation?)
* Create two subsections of the "Core Language Changes" section, becauseAndrew M. Kuchling2002-08-201-67/+104
| | | | | the list is getting awfully long Mention Karatsuba multiplication and some other items
* Add versionadded for operator.powNeal Norwitz2002-08-191-0/+1
|
* Extend some comments on the order of values in the returns fromFred Drake2002-08-191-8/+14
| | | | dict.items/keys/values/iteritems/iterkeys/itervalues().
* SF patch 576101, by Oren Tirosh: alternative implementation ofGuido van Rossum2002-08-197-106/+171
| | | | | | | | interning. I modified Oren's patch significantly, but the basic idea and most of the implementation is unchanged. Interned strings created with PyString_InternInPlace() are now mortal, and you must keep a reference to the resulting string around; use the new function PyString_InternImmortal() to create immortal interned strings.
* Add a warning comment to the LOAD_GLOBAL inline code.Guido van Rossum2002-08-191-1/+3
|
* Another ugly inlining hack, expanding the two PyDict_GetItem() callsGuido van Rossum2002-08-191-1/+25
| | | | | | | | | | | | | | | in LOAD_GLOBAL. Besides saving a C function call, it saves checks whether f_globals and f_builtins are dicts, and extracting and testing the string object's hash code is done only once. We bail out of the inlining if the name is not exactly a string, or when its hash is -1; because of interning, neither should ever happen. I believe interning guarantees that the hash code is set, and I believe that the 'names' tuple of a code object always contains interned strings, but I'm not assuming that -- I'm simply testing hash != -1. On my home machine, this makes a pystone variant with new-style classes and slots run at the same speed as classic pystone! (With new-style classes but without slots, it is still a lot slower.)
* Call me anal, but there was a particular phrase that was speading toGuido van Rossum2002-08-197-9/+9
| | | | | | | comments everywhere that bugged me: /* Foo is inlined */ instead of /* Inline Foo */. Somehow the "is inlined" phrase always confused me for half a second (thinking, "No it isn't" until I added the missing "here"). The new phrase is hopefully unambiguous.