M Debugger.py
M EditorWindow.py
M PyShell.py
0. Polish PyShell.linecache_checkcache()
1. Move break clearing code to PyShell.PyShellEditorWindow from
EditorWindow.
2. Add PyShellEditorWindow.breakpoints attribute to __init__, a list of
line numbers which are breakpoints for that edit window.
3. Remove the code in Debugger which removes all module breakpoints when
debugger is closed. Want to be able to reload into debugger when
restarted.
4. Moved the code which sets EditorWindow.text breakpoints from Debugger
to PyShell.PyShellEditorWindow and refactored.
5. Implement reloading subprocess debugger with breakpoints from all open
PyShellEditorWindows when debugger is opened or subprocess restarted.
6. Eliminate the break_set attribute, use the breakpoint list instead.
Replaces the _center function in the calendar
module with the center method for strings.
For situations with uneven padding, the behavior is
slightly different in that the center method puts the
extra space on the right instead of the left.
classes was called with three arguments. This makes no sense, there's
no way to pass in the "modulo" 3rd argument as for __pow__, and
classic classes don't do this. [SF bug 620179]
I don't want to backport this to 2.2.2, because it could break
existing code that has developed a work-around. Code in 2.2.2 that
wants to use __ipow__ and wants to be forward compatible with 2.3
should be written like this:
def __ipow__(self, exponent, modulo=None):
...
Ben. If s is a byte string, make sure it can be converted to unicode
with the input codec, and from unicode with the output codec, or raise
a UnicodeError exception early. Skip this test (and the unicode->byte
string conversion) when the charset is our faux 8bit raw charset.
must be a Charset instance, not a string. The bug here was that
self._charset wasn't being converted to a Charset instance so later
.append() calls which used the default charset would break.
_split(): If the charset of the chunk is '8bit', return the chunk
unchanged. We can't safely split it, so this is the avenue of least
harm.
8-bit data, we cannot split it safely, so return the original string
unchanged.
_is8bitstring(): Helper function which returns True when we have a
byte string that contains non-ascii characters (i.e. mysterious 8-bit
data).
Also, it fixes a really egregious error in Header.encode() (really
in Header._encode_chunks()) that could cause a header to grow and
grow each time encode() was called if output_codec was different
from input_codec.
Also, fix a typo.
refactor a bit and clean up.
M PyShell.py Cosmetic changes, delete blank lines, add # on some
blank lines.
M rpc.py Add more debugging capability
M run.py Add support for getting calltip from subprocess
Move import statements
initializing GNU readline, setlocale(LC_CTYPE, "") is called, which
changes the <ctype.h> macros to use the "default" locale (which isn't
the *initial* locale -- the initial locale is the "C" locale in which
only ASCII characters are printable). When the default locale is e.g.
Latin-1, the repr() of string objects can include 8-bit characters
with the high bit set; I believe this is due to the recent
PRINT_MULTIBYTE_STRING changes to stringobject.c. This in turn screws
up test_pyexpat and test_rotor, which depend on the repr() of 8-bit
strings with high bit characters.
The solution (for now) is to force the LC_CTYPE locale to "C" after
importing rlcompleter. This is the locale required by the test suite
anyway.
imported on systems other than Windows, and in particular is imported
by test___all__; the compile farm reported that all Linux tests failed
due to this; isn't anyone in PythonDevLand running CVS on Linux?!).
ths "should be" skipped depends on os.path.supports_unicode_filenames,
not really on the platform. Fiddled the expected-skip constructor
appropriately.
list(xrange(sys.maxint / 4))
test. Changed 4 to 2.
The belief is that this test intended to trigger a bit of code in
listobject.c's NRESIZE macro that's looking for arithmetic overflow. As
written, it doesn't achieve that, though, and leaves it up to the platform
realloc() as to whether it wants to allocate 2 gigabytes. Some platforms
say "sure!", although they don't appear to mean it, and disaster ensues.
Changing 4 to 2 (just barely) manages to trigger the arithmetic overflow
test instead, leaving the platform realloc() out of it.
I'll backport this to the 2.2 branch next.
sys.getwindowsversion() on Windows (new enahanced Tim-proof <wink>
version), and fix test_pep277.py in a few minor ways.
Including doc and NEWS entries.
the change in revision 1.11 (test_email.py) in response to SF bug
#609988. We now think that was the wrong fix and that WinZip was the
real culprit there.
get_type(). Also, one of the regular expressions is constant so might
as well make it a module global. And, when splitting up digests,
handle lineseps that are longer than 1 character in length
(e.g. \r\n).
[ 617097 ] EditorWindow.py: underline recent files
Added a couple of mods to reduce the indentation level.
Note that the recent files menu doesn't update until
Idle is restarted, pre-existing bug, at least on Linux.
patch #617312, both on the trunk and the 22-maint branch.
Also added a test case, and ported the test_trace I wrote for HEAD
to 2.2.2 (with all those horrible extra 'line' events ;-).
Strangely, two out of three patches there seem already committed; but
the essential one (get rid of the assert in object_filenames in
ccompiler.py) was not yet applied.
This makes the build procedure for Twisted work again.
This is *not* a backport candidate despite the fact that identical
code appears to exist in 2.2.2; Twisted builds fine there, so there
must have been a change elsewhere.
semantics of header chunks using byte and Unicode strings.
Specifically,
append(): When the given string is a byte string, charset (whether
specified explicitly in the argument list or implicitly via the
constructor default) is the encoding of the byte string, and a
UnicodeError will be raised if the string cannot be decoded with that
charset. If s is a Unicode string, then charset is a hint specifying
the character set of the characters in the string. In this case, when
producing an RFC 2822 compliant header using RFC 2047 rules, the
Unicode string will be encoded using the following charsets in order:
us-ascii, the charset hint, utf-8.
__init__(): Use the global USASCII Charset instance when the charset
argument is None. Also, clarification in the docstring.
Also, use True/False where appropriate.
Python 2.1.3. However it's required by the email tests suite, so poke
it into the encodings aliases if it's missing. The is apparently the
approved API for doing so.
Now we can remove the hexversion shortcircuits in the test suite.
encoding flag SHORTEST means to return the shortest encoding between
base64 and qp. This is used for the header_enc for utf-8. SHORTEST
isn't legal for body_enc.
Also some code cleanup:
- use True/False everywhere
- use == instead of `is' in a few places
- added _unicode() and make consistent the "is unicode" checks
- update docstrings
Closes SF bug #561822.
Integrate the "code cleanup and general bug fix patch" (SF bug #545096),
contributed by Gustavo Niemeyer. This is the portion of that patch that
does not add new functionality.
"Merge Py Idle changes:
Rev 1.7 [Python-idle] loewis
Convert characters from the locale's encoding on output.
Reject characters outside the locale's encoding on input."
Not compatible with Python 2.2.1. Forwardport as a SF patch.
(cut vs. Cut etc.)
Fix Bug 613006 Ctrl-x Unix Binding Clears Selection
(do-nothing does something :)
Leave some debugging prints behind, commented out
M EditorWindow.py
M config-keys.def
M configHandler.py
project, and with assistance from Oleg Broytmann. Specifically,
added some new tests to make sure we handle RFC 2231 encoded
parameters correctly. Two new data files were added which contain RFC
2231 encoded parameters.
project, and with assistance from Oleg Broytmann. Specifically,
get_param(), get_params(): Document that these methods may return
parameter values that are either strings, or 3-tuples in the case of
RFC 2231 encoded parameters. The application should be prepared to
deal with such return values.
get_boundary(): Be prepared to deal with RFC 2231 encoded boundary
parameters. It makes little sense to have boundaries that are
anything but ascii, so if we get back a 3-tuple from get_param() we
will decode it into ascii and let any failures percolate up.
get_content_charset(): New method which treats the charset parameter
just like the boundary parameter in get_boundary(). Note that
"get_charset()" was already taken to return the default Charset
object.
get_charsets(): Rewrite to use get_content_charset().
Move the imports of Parser and Message inside the
message_from_string() and message_from_file() functions. This way
just "import email" won't suck in most of the submodules of the
package.
Note: this will break code that relied on "import email" giving you a
bunch of the submodules, but that was never documented and should not
have been relied on.
A possibility to deadlock (on the hidden import lock) was created here
in 2.3, seemingly when tempfile.py started to call functions in
random.py. The cure is "the usual": don't spawn threads as a side
effect of importing, when the spawned threads themselves do imports
(directly or indirectly), and the code that spawned the threads is
waiting for the threads to finish (they can't finish, because they're
waiting for the import lock the spawner still holds). Worming around
this is why the "test_main" mechanism was introduced in regrest, so
it's a straightforward fix.
NOT a bugfix candidate; the problem was introduced in 2.3.
module used in the Zope TAL implementation. The bug was already fixed
in the Python standard library, but the regression test would be good
to keep around.
This adds new methods heading(), setheading(), position(),
window_width(), window_height(), setx(), and sety(), to make this more
functionality-compatible with Logo turtle graphics (Attila's last
words, not mine :-). I had to fix the sety() code which was broken in
Attila's patch.
I'm not adopting the functionality change that Attila claimed was a
bugfix (no output without tracing), because I disagree that it's a
bug.
This fixes the charming, but unhelpful error message for
>>> pickle.dumps(type.__new__)
Can't pickle <built-in method __new__ of type object at 0x812a440>: it's not the same object as datetime.math.__new__
Bugfix candidate.
Rev 1.6 GvR
Finally fix SF bug #441172, using a variant of patch ##443626:
canceling an edit operation would not revert the value of the field.
The fix takes care to destroy the Entry object, as suggested in the
patch.
Rev 1.7 Geiger Ho / GvR
(previously applied - Idlefork Rev 1.3)
Rev 1.8 doerwalter
(string methods)
Rev 1.11 GvR
Fix for SF bug #448835.
Fix this to work with the new (still undocumented) tabnanny API.
I'm afraid Stephen will have to add this fix to the IDLE fork code
base as well.
Rev 1.12 rhettinger
(skip, done differently in Idlefork)
Rev 1.13 time_one
(skip, NA)
Rev 1.35 fdrake
Use string.ascii_letters instead of string.letters (SF bug #226706).
Move computation of sets of characters out of the body of the function
that uses them.
Rev 1.36 tim_one
Convert a pile of obvious "yes/no" functions to return bool
Rev 1.37
(skip, done differently in Idlefork)
Rev 1.38 loewis
Patch #590913: PEP 263 support.
Rev 1.39 loewis
Convert characters from the locale's encoding on output.
Reject characters outside the locale's encoding on input.
Rev 1.40 doerwalter
(string methods)
Rev 1.41
(skipped, done by GvR in rpc)
Rev 1.5 tim_one
Convert a pile of obvious "yes/no" functions to return bool.
Rev 1.6 gvanrossum
(partially merged previously, move line outside try: block)
Provisional fix for writefile() [SF bug # 541730].
The problem was that an exception can occur in the text.get() call or
in the write() call, when the text buffer contains non-ASCII
characters. This causes the previous contents of the file to be lost.
The provisional fix is to call str(self.text.get(...)) *before*
opening the file, so that if the exception occurs, we never open the
file.
Two orthogonal better solutions have to wait for policy decisions:
1. We could try to encode the data as Latin-1 or as UTF-8; but that
would require IDLE to grow a notion of file encoding which requires
more thought.
2. We could make backups before overwriting a file. This requires
more thought because it needs to be fast and cross-platform and
configurable.
Rev 1.7 gvanrossum
(previously merged with modifications by Stephen M. Gava)
Add primitive printing support for Unix and Windows.
Rev 1.8 loewis
Patch #590913: PEP 263 support.
Rev 1.9 gvanrossum
(tempfile.py interface -- deferred)
Rev 1.10 tim_one
whitespace normalization
Rev 1.11 nnorwitz
(deferred pending 1.9 integration)
Rev 1.39 GvR
Properly fix SF bug #507298 (Gregor Lingl): shellpython2.2 -Qnew smart
indent error
Use // where int division is intended. (This breaks IDLE for use with
previous Python versions -- I don't care.)
Rev 1.40 tim_one
Convert a pile of obvious "yes/no" functions to return bool.
Rev 1.41 foffani/loewis
(already merged) - MS html help
Rev 1.42
(skip, done differently in Idlefork)
Rev 1.43 tzot/rhettinger
Extended IDLE's open module menu item to handle hierarchical module names.
Will look at doing something similar in import.c so that the effort won't
have to be repeated elsewhere.
Closes SF patch 600152.
Rev 1.44 doerwalter
(string methods)
Rev 1.16
(skip. The Edward K. Ream breakpoint fix has been added to bdb.py
and idlefork Debugger.py no longer overrides Bdb.set_break() )
Rev 1.17
Remove unnecessary imports
Rev 1.9
Improve handling of docstrings. I had feared this was a case of
introspection incompatibility, but in fact it's just that calltips
always gave up on a docstring that started with a newline (but
didn't realize they were giving up <wink>).
Rev 1.10
(already merged)
Rev 1.11
(whitespace normalization, skip this time)
Rev 1.12
Remove unnecessary imports
Rev 1.4
SF bug 546078: IDLE calltips cause application error.
Assorted crashes on Windows and Linux when trying to display a very
long calltip, most likely a Tk bug. Wormed around by clamping the
calltip display to a maximum of 79 characters (why 79? why not ...).
Bugfix candidate, for all Python releases.
Rev 1.5
Remove unnecessary imports
EditorWindow has incorporated AutoIndent
Rev 1.17
classifyws(): Fix a "/" to work under -Qnew (as well as without it).
Bugfix candidate!
Rev 1.18
(Already merged)
Rev 1.19
smart_backspace_event(): remove now-pointless int() call.
Bugfix candidate: the current state of AutoIdent.py should be in 2.2.1.
Rev 1.20
Apply diff2.txt from SF patch http://www.python.org/sf/572113
(with one small bugfix in bgen/bgen/scantools.py)
This replaces string module functions with string methods
for the stuff in the Tools directory. Several uses of
string.letters etc. are still remaining.
Using the suggestion there: add_module() forces __builtin__ back; this
fixes r_exec, r_eval, r_execfile. The interactive console had to be
fixed separately, because it doesn't use r_exec, but relies on the
'locals' dict having the right __builtins__. Fixed this by
subclassing InteractiveConsole and overriding runcode(), which does
the exec. This changes the banner output slightly: instead of
starting with *** RESTRICTED ***, a subtler (RestrictedConsole) is
printed before the first >>> prompt.
Also import readline (if it exists) when the interactive console is
used, for more convenient input editing and history.
This does not mean that rexec is now considered safe! But for those
willing to take the risk, it's safer than before. (Note that a safety
analysis of the code module would be wise if you plan to use the
interactive console for real -- I've only ever used it to play with
restricted mode.)
This should be backported to 2.2 and 2.1.
PyShell.py
don't track Py Idle patch 543222 - disable script bindings in shell
since it was done differently in MAIN
Remove "binding comments" 05 Aug 1.13.2.2 to 1.13.2.3
EditorWindow.py
don't track Py Idle patch 543222 - disable script bindings in shell
since it was done differently in MAIN
Remove "binding comments" 05 Aug 1.23.2.3 to 1.23.2.4
Remove last dependencies to old config backend 06Aug to 1.23.2.5
attribute to the (stringized) message number (if this attribute is
settable). This is useful so users of this class can report the
correct message number (e.g. when classifying spam).
Also added a blank line before the first method of each class.
routines. I got some errors "dictionary changed size during
iteration" when running ZEO tests on machine while doing heavy
forground work in another window, and thinking about it, I believe
that it should be okay if readable() or writable() modifies the map.
I also finally made all the spacing conform to the Python style guide:
no space between a function/method name and the following left
parenthesis (fixed lots of occurrences), spaces around assignment
operators (fixed a few, always of the form "map=..."), and a blank
line between the class statement and the first method definition (a
few).
Because ob_size is a 32-bit int but sys.maxint is LONG_MAX which is a
64-bit value, there's no way to make this test succeed on a 64-bit
platform. So just skip it when sys.maxint isn't 0x7fffffff.
Backport candidate.
exception occurred so it should only be closed in the else clause.
Without this change we can an UnboundLocalError on Linux:
Traceback (most recent call last):
File "Lib/test/test_mmap.py", line 304, in ?
test_both()
File "Lib/test/test_mmap.py", line 208, in test_both
m.close()
UnboundLocalError: local variable 'm' referenced before assignment
with a size larger than the underlying file worked on Windows. It
does <wink>. However, merely creating an mmap that way has the side
effect of growing the file on disk to match the specified size. A
*later* test assumed that the file on disk was still exactly as it was
before the new "size too big" test was added, but that's no longer true.
So added a hack at the end of the "size too big" test to truncate the
disk file back to its original size on Windows.
_handle_text(): Use _isstring() for stringiness test.
_handle_multipart(): Add a test before the ListType test, checking for
stringiness of the payload. String payloads for multitypes means a
message with broken MIME chrome was parsed by a lax parser. Instead
of raising a BoundaryError in those cases, the entire body is assigned
to the message payload (but since the content type is still
multipart/*, the Generator needs to be updated too).
the same. Added check to verify the two names are not the same. Does not
check the actual files to see if there is a symbolic link.
Closes SF bug 490165 and Tzot's patch 604600.
Add read(), write(), and readwrite() helper functions to shorten poll
functions. Use get() instead of try/except KeyError for lookup.
XXX How could the lookup ever fail?
Remove module-level DEBUG flag.
Use iteritems() instead of items() when walking the socket map.
Reformat the functions I touched so that are consistently Pythonic.
from SF patch http://www.python.org/sf/554192
This adds two new functions to mimetypes:
guess_all_extensions() which returns a list of all known
extensions for a mime type, and add_type() which adds one
mapping between a mime type and an extension.
Broytmann in SF patch #600096. Specifically, the former function now
encodes the triplets, while the latter adds optional charset and
language arguments.
M RemoteDebugger.py
M ScriptBinding.py
Restart the execution server with a clean environment and execute the
active module from scratch upon activation of Run/F5.
Add functionality to PyShell.py to restart the execution server in a new
subprocess. The server makes a connection to the Idle client which sends a
block of code to be executed.
Modify ScriptBinding.py to restart the subprocess upon Run/F5, assuming that
an execution is not currently in progress. Remove Import Module functionality,
not required now that the code is executed in a clean environment.
If the Debugger is active, also restart the subprocess side of the split
debugger. Add functionality to RemoteDebugger.py to support this.
At this time breakpoints will be lost in the subprocess if Run/F5 is activated.
A subsequent checkin of PyShell.py will implement reloading of the breakpoints
into the subprocess debugger. I'm keeping this separate as the design may
change.
The problem was that it expected rfc822.parseaddr() to return None
upon a parse failure. The actual, documented return value for a
parse failure is (None, None).
Closes SF bug 602029.
Unicode strings (with arbitrary length) are allowed
as entries in the unicode.translate mapping.
Add a test case for multicharacter replacements.
(Multicharacter replacements were enabled by the
PEP 293 patch)
to fix it. (It fails when the day of the month is a 1-digit number,
because %c produces space+digit there, while strptime seems to expect
zero+digit somehow.)
The new execvpe code would sometimes do the wrong thing when a
non-executable file existed earlier in the path and an executable file
of the same name existed later in the path. This patch restores the
proper behavior (which is to execute the second file). When only a
non-executable file exists, the correct error is still reported.
of PyString_DecodeEscape(). This prevents a call to
_PyString_Resize() for the empty string, which would
result in a PyErr_BadInternalCall(), because the
empty string has more than one reference.
This closes SF bug http://www.python.org/sf/603937
Use a slightly different strategy to determine when not to call the line
trace function. This removes the need for the RETURN_NONE opcode, so
that's gone again. Update docs and comments to match.
Thanks to Neal and Armin!
Also add a test suite. This should have come with the original patch...
because it added it to 12 PM too. 12 PM should be hour 12 not hour
24.
Also cleaned up a minor style nit. There are more style problems in
this file that I'll clean up next (but I didn't want them to overwhelm
the substance of this fix).
localtime, which in -0400 is 12 noon GMT. The bug boiled down to
broken conversion of 12 PM to hour 12 for the '%I %p' format string.
Added a test for this specific condition: Strptime12AMPMTests. Fix to
_strptime.py coming momentarily.
the tokenize module by test_tokenize.py. The FutureWarnings only
appeared during installation, and I've figured out a way to suppress
those in a different way.
sure these are the best fixes.
- Test maxint-1 against the negative octal constant -020000000000
- Comment out the tests for oct -1 and hex -1, since 037777777777 and
0xffffffff raise FutureWarnings now and in Python 2.4 those
constants will produce positive values, not negative values. So the
existing test seems to test something that won't be true in 2.4.
instead.
2. Preserve the Idle client's listening socket for reuse with the
fresh subprocess.
3. Remove some unused rpc code, comment out additional unused code.
Modified Files:
ScriptBinding.py rpc.py run.py
underlying dictionaries, there were no reasonable use cases (lexicographic
sorting of a list of sets is somewhat esoteric). Frees the operators
for other uses (such as strict subset and superset comparisons).
Updated documentation and test suite accordingly.
the inplace operators. The strategy is to have the operator overloading
code do the work and then to define equivalent method calls which rely on
the operators. The changes facilitate proper application of TypeError
and NonImplementedErrors.
Added corresponding tests to the test suite to make sure both the operator
and method call versions get exercised.
Add missing tests for difference_update().
immediately after the comparison, there in no use in caching the hashcode.
The test, 'if self._hashcode is None', never fails. Removing the caching
saves a few lines and a little time.
2. Replaced calls to Set([]) with Set() -- Timbot's suggestion
3. Fixed subtle bug in sets of sets:
The following code did not work (will add to test suite):
d = Set('d')
s = Set([d]) # Stores inner set as an ImmutableSet
s.remove(d) # For comparison, wraps d in _TemporarilyImmutableSet
The comparison proceeds by computing the hash of the
_TemporarilyImmutableSet and finding it in the dictionary.
It then verifies equality by calling ImmutableSet.__eq__()
and crashes from the binary sanity check.
The problem is that the code assumed equality would be checked
with _TemporarilyImmutableSet.__eq__().
The solution is to let _TemporarilyImmutableSet derive from BaseSet
so it will pass the sanity check and then to provide it with the
._data element from the wrapped set so that ImmutableSet.__eq__()
will find ._data where it expects.
Since ._data is now provided and because BaseSet is the base class,
_TemporarilyImmutableSet no longer needs .__eq__() or .__ne__().
Note that inheriting all of BaseSet's methods is harmless because
none of those methods (except ones starting with an underscore)
can mutate the .data element. Also _TemporarilyImmutableSet is only
used internally as is not otherwise visible.
wrong thing for a unicode subclass when there were zero string
replacements. The example given in the SF bug report was only one way
to trigger this; replacing a string of length >= 2 that's not found is
another. The code would actually write outside allocated memory if
replacement string was longer than the search string.
(I wonder how many more of these are lurking? The unicode code base
is full of wonders.)
Bugfix candidate; this same bug is present in 2.2.1.
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'.
<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.
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.
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.
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.
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.
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.
Jeremy reported that this is not allowed by RFC 2396; however,
other tools support unescaped @'s so we should also.
Apply SF patch 596581 closing bug 581529.
Also, don't call gettempdir() in the default expression for the 'dir'
argument to various functions; use 'dir=None' for the default and
insert 'if dir is None: dir = gettemptir()' in the bodies. That way
the work done by gettempdir is postponed until needed.
Loosened the acceptable 'start' and 'stop' arguments so that any
Python (bounded) ints can be used. So, e.g., randrange(-sys.maxint-1,
sys.maxint) no longer blows up.
[ 587993 ] SET_LINENO killer
Remove SET_LINENO. Tracing is now supported by inspecting co_lnotab.
Many sundry changes to document and adapt to this change.
binary=True
to
text=False
by BDFL Pronouncement. All other changes follow from this. The change
to the docs is ready to go, but blocked by another JackMacLock in the
doc directory.
Although Cygwin attempts to be as Posix compliant
as possible, it has difficulties unlinking open
files. This is not surprising given that Cygwin is
dependent on Win32 which in turn has this problem
itself.
The attached tempfile patch acknowledges this
Cygwin limitation. Without this patch, Cygwin
fails test_tempfile (i.e., test_has_no_name) as
follows:
$ ./python -E -tt ../Lib/test/regrtest.py -l test_tempfile
test_tempfile
test test_tempfile failed -- Traceback (most recent call last):
File "/home/jt/src/PythonCvs/Lib/test/test_tempfile.py", line 689, in test_has_no_name
self.failOnException("rmdir", ei)
File "/home/jt/src/PythonCvs/Lib/test/test_tempfile.py", line 33, in failOnException
self.fail("%s raised %s: %s" % (what, ei[0], ei[1]))
File "/home/jt/src/PythonCvs/Lib/unittest.py", line 260, in fail
raise self.failureException, msg
AssertionError: rmdir raised exceptions.OSError: [Errno 90] Directory not empty: '/mnt/c/DOCUME~1/jatis/LOCALS~1/Temp/tmpM_z8nj'
do bizarre things to get a temp file, I changed it to use mkstemp instead
of NamedTemporaryFile. This tried to leave the file open while passing
its name to execfile(). On Win2K (but not Win9X), though, a file created
with O_TEMPORARY cannot be opened again, so the test failed with a
permission error when execfile tried to open it. Closer to the truth:
a file created with O_TEMPORARY can be opened again, but only if the
file is also created with SHARE_DELETE access via the Win32 CreateFile()
function. There's no way to get at that from MS's version of libc, though
(we'd have to ditch the "std" C file functions in favor of Win32 API
calls).
Close the bug report again -- this time for Cygwin due to a newlib bug.
See the following for the details:
http://sources.redhat.com/ml/newlib/2002/msg00369.html
Note that this commit is only a documentation (i.e., comment) change.
test was written. So boosted the number of "digits" this generates, and
also beefed up the "* / divmod" test to tickle numbers big enough to
trigger the Karatsuba algorithm. It takes about 2 seconds now on my box.
rewrite, by Zack Weinberg). This replaces most code in tempfile.py
(please review!!!) and adds extensive unit tests for it.
This will cause some warnings in the test suite; I'll check those in
soon, and also the docs.
least on OS/2 (see note on SF patch 555085 by A I MacIntyre) but
looks like the test *could* fail on any other platform too -- there's
no guarantee that recv() reads all data.
to delete the reference to self._sock, and the regular destructor will
do that just fine. This made some hacks in close() unnecessary.
The _fileobject class still has a __del__ method, because it must flush.
observation that _rbuf could never have more than one string in it.
So make _rbuf a string. The code branches for size<0 and size>=0
are completely separate now, both in read() and in readline().
I checked for tabs this time. :-)