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.
Neal Norwitz [Sun, 25 Feb 2007 20:55:47 +0000 (20:55 +0000)]
Change all the function attributes from func_* -> __*__. This gets rid
of func_name, func_dict and func_doc as they already exist as __name__,
__dict__ and __doc__.
Thomas Wouters [Sun, 25 Feb 2007 20:39:11 +0000 (20:39 +0000)]
Merged revisions 53875-53911 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r53899 | neal.norwitz | 2007-02-25 16:52:27 +0100 (Sun, 25 Feb 2007) | 1 line
Add more details when releasing interned strings
........
r53900 | neal.norwitz | 2007-02-25 16:53:36 +0100 (Sun, 25 Feb 2007) | 1 line
Whitespace only changes
........
r53901 | jeremy.hylton | 2007-02-25 16:57:45 +0100 (Sun, 25 Feb 2007) | 8 lines
Fix crash in exec when unicode filename can't be decoded.
I can't think of an easy way to test this behavior. It only occurs
when the file system default encoding and the interpreter default
encoding are different, such that you can open the file but not decode
its name.
........
r53902 | jeremy.hylton | 2007-02-25 17:01:58 +0100 (Sun, 25 Feb 2007) | 2 lines
Put declarations before code.
........
r53910 | fred.drake | 2007-02-25 18:56:27 +0100 (Sun, 25 Feb 2007) | 3 lines
- SF patch #1657613: add documentation for the Element interface
- clean up bogus use of the {datadescni} environment everywhere
........
r53911 | neal.norwitz | 2007-02-25 20:44:48 +0100 (Sun, 25 Feb 2007) | 17 lines
Variation of patch # 1624059 to speed up checking if an object is a subclass
of some of the common builtin types.
Use a bit in tp_flags for each common builtin type. Check the bit
to determine if any instance is a subclass of these common types.
The check avoids a function call and O(n) search of the base classes.
The check is done in the various Py*_Check macros rather than calling
PyType_IsSubtype().
All the bits are set in tp_flags when the type is declared
in the Objects/*object.c files because PyType_Ready() is not called
for all the types. Should PyType_Ready() be called for all types?
If so and the change is made, the changes to the Objects/*object.c files
can be reverted (remove setting the tp_flags). Objects/typeobject.c
would also have to be modified to add conditions
for Py*_CheckExact() in addition to each the PyType_IsSubtype check.
........