Cleanup.
Add closed attribute.
Support int argument to open() -- wrapping a file descriptor.
For b/w compat, support readline(n).
Support readlines() and readlines(n).
Flush on __del__.
Added some XXX comments.
Add some backwards compatibility stuff.
This now appears to work when io.open is substituted for the real open
in fileinput.py -- at least the latter's unit tests pass.
Collin Winter [Wed, 28 Mar 2007 21:44:53 +0000 (21:44 +0000)]
Make readonly members defined in C throw an AttributeError on modification. This brings them into sync with Python-level attributes. Fixes bug #1687163.
Guido van Rossum [Wed, 28 Mar 2007 21:02:43 +0000 (21:02 +0000)]
Fix errors in bsddb3 tests due to removal of exception slicing.
(There was also a segfault but it disappeared when the tests
stopped erroring out; I presume the segfault is a pre-existing
problem somewhere in a destructor.)
Brett Cannon [Wed, 21 Mar 2007 22:26:20 +0000 (22:26 +0000)]
When removing indexing/slicing on exceptions some places were changed
inappropriately from ``e[0]`` to ``e.message`` instead of ``e.args[0]``. The
reason it needs to be the last option is the dichotomy of 'message' and 'args':
'message' can be the empty string but args[0] can have a value if more than one
argument was passed.
Neal Norwitz [Wed, 21 Mar 2007 04:45:04 +0000 (04:45 +0000)]
Little fixes:
* make some module variables static to prevent name pollution
* Add some comments to clarify what's going on and some XXXs to address
* Add a space after "for" before (
* exc_value and tb can be NULL in some cases
* Get working on Windows (I think)
Guido van Rossum [Mon, 19 Mar 2007 22:26:27 +0000 (22:26 +0000)]
Make test_socket_ssl.py pass by fixing some code that was
incorrectly assuming that err.message was the Py3k way of
writing err[0] in 2.x. The correct spelling is err.args[0].
Guido van Rossum [Sun, 18 Mar 2007 15:41:51 +0000 (15:41 +0000)]
Implement PEP 3115 -- new metaclass syntax and semantics.
The compiler package hasn't been updated yet; test_compiler.py fails.
Otherwise all tests seem to be passing now. There are no occurrences
of __metaclass__ left in the standard library.
Docs have not been updated.
Check in Daniel Stutzbach's _fileio.c and test_fileio.py
(see SF#1671314) with small tweaks.
The io module now uses this instead of its own implementation
of the FileIO class, if it can import _fileio.
Guido van Rossum [Tue, 27 Feb 2007 17:19:33 +0000 (17:19 +0000)]
Mike Verdone's checkpoint, cleaned up.
Also implemented Neal's suggestion (add fileno() to SocketIO)
and some unrelated changes, e.g. remove Google copyright
and make BytesIO a subclass of BufferedIOBase.
Jeremy Hylton [Tue, 27 Feb 2007 06:50:52 +0000 (06:50 +0000)]
Provisional implementation of PEP 3104.
Add nonlocal_stmt to Grammar and Nonlocal node to AST. They both
parallel the definitions for globals. The symbol table treats
variables declared as nonlocal just like variables that are free
implicitly.
This change is missing the language spec changes, but makes some
decisions about what the spec should say via the unittests. The PEP
is silent on a number of decisions, so we should review those before
claiming that nonlocal is complete.
Thomas Wouters made the grammer and ast changes. Jeremy Hylton added
the symbol table changes and the tests. Pete Shinners and Neal
Norwitz helped review the code.
Brett Cannon [Tue, 27 Feb 2007 00:12:43 +0000 (00:12 +0000)]
Tweak the fix for test_traceback since the fix for it to run on its own broke
it under regrtest. 'traceback' likes to strip out the module name if it is
__main__ or __builtin__ but not in other cases.
(1)
Combines the code paths for MAKE_FUNCTION and MAKE_CLOSURE.
Fixes a crash where functions with closures and either annotations or
keyword-only arguments result in MAKE_CLOSURE, but only
MAKE_FUNCTION has the code to handle annotations or keyword-only
arguments.
Includes enough tests to trigger the bug.
(2)
Change peepholer to not bail in the presence of EXTENDED_ARG +
MAKE_FUNCTION.
Enforce the natural 16-bit limit of annotations in compile.c.
Also update Misc/NEWS with the "input = raw_input" change.
Don't use a fixed temporary name (gdbm).
Don't use our own temp name creation (dbm).
Should be backported to 2.5.
........
r53935 | georg.brandl | 2007-02-26 14:51:29 +0100 (Mon, 26 Feb 2007) | 2 lines
Backport from Py3k branch: fix refleak in PyString_Format.
........
r53943 | jeremy.hylton | 2007-02-26 17:14:51 +0100 (Mon, 26 Feb 2007) | 2 lines
Reformat long lines.
........
r53947 | neal.norwitz | 2007-02-26 18:01:08 +0100 (Mon, 26 Feb 2007) | 1 line
Add Steven Bethard to help out with patches.
........
r53949 | georg.brandl | 2007-02-26 18:09:03 +0100 (Mon, 26 Feb 2007) | 3 lines
Fix a couple of problems in generating the AST code:
* use %r instead of backticks since backticks are going away in Py3k
* PyArena_Malloc() already sets PyErr_NoMemory so we don't need to do it again
* the signature for ast2obj_int incorrectly used a bool, rather than a long
........
Guido van Rossum [Mon, 26 Feb 2007 15:59:50 +0000 (15:59 +0000)]
Change a test to be more predictable.
The problem with using random.random is that several modules and tests do
"from random in random" which confuses pickle.whichmodule().
Guido van Rossum [Mon, 26 Feb 2007 07:07:02 +0000 (07:07 +0000)]
Fix a bizarre error where test_pickletools fails if preceded by test_pyclbr.
The fix is in neither, but in pickle.py where a loop over sys.modules.items()
could modify sys.modules, occasionally.