Commit [36659c] pep352 Maximize Restore History

Merged revisions 4326-4415 via svnmerge from

https://jython.svn.sourceforge.net/svnroot/jython/trunk/jython

........
r4327 | pjenvey | 2008-04-08 23:59:40 -0700 (Tue, 08 Apr 2008) | 2 lines

really fix #1501932 this time, catch *any* exception in hasattr. with test
........
r4328 | fwierzbicki | 2008-04-09 06:59:40 -0700 (Wed, 09 Apr 2008) | 4 lines

Try #2 to get the new parser into trunk. Includes fix of antlr_gen task from Tobias
and a conditional antlr.notneeded that should only rebuild the grammar stuff if there
has been a change.
........
r4329 | fwierzbicki | 2008-04-09 07:08:31 -0700 (Wed, 09 Apr 2008) | 2 lines

Make the ast dir only generate the ast files (the grammar building is now in trunk).
........
r4330 | pjenvey | 2008-04-09 17:39:49 -0700 (Wed, 09 Apr 2008) | 1 line

NotImplemented is Trueish
........
r4331 | pjenvey | 2008-04-09 19:45:22 -0700 (Wed, 09 Apr 2008) | 1 line

use array.ArrayType
........
r4332 | fwierzbicki | 2008-04-10 17:09:27 -0700 (Thu, 10 Apr 2008) | 14 lines

The start of an _ast module. It relies on the new antlr parser which is now in trunk.
For now you must put antlr-runtime-3.0.1 (which is in the extlibs dir) in your
classpath to use it. Using it looks like this:

>>> import _ast
>>> compile("a=1", "<unknown>", "exec", _ast.PyCF_ONLY_AST)
tree: (Module (Assign (Target (Name a)) (Value (Num 1))))

Which outputs a tree representation for now.

If you do not use _ast or the PyCF_ONLY_AST flag, you should not need
antlr-runtime-3.0.1.jar in your path.
........
r4333 | pjenvey | 2008-04-11 16:23:41 -0700 (Fri, 11 Apr 2008) | 1 line

support the optional file arg to load_source
........
r4334 | pjenvey | 2008-04-12 13:56:15 -0700 (Sat, 12 Apr 2008) | 1 line

remove the now fully deprecated pieces of xrange, cleanup
........
r4335 | pjenvey | 2008-04-12 13:57:06 -0700 (Sat, 12 Apr 2008) | 1 line

more 'at' in repr
........
r4336 | pjenvey | 2008-04-12 14:48:49 -0700 (Sat, 12 Apr 2008) | 2 lines

make new types use a copy of their class dict instead of the actual dict
........
r4337 | pjenvey | 2008-04-12 14:51:42 -0700 (Sat, 12 Apr 2008) | 1 line

small cleanup
........
r4338 | pjenvey | 2008-04-12 17:11:50 -0700 (Sat, 12 Apr 2008) | 1 line

test_types_jy is testing classes not just types, rename to test_class_jy
........
r4339 | pjenvey | 2008-04-12 18:25:23 -0700 (Sat, 12 Apr 2008) | 23 lines

we use only PyFrame.getf_locals() to get at locals, whereas CPython in general
has two ways of getting them:

o the quicker way: grab the 'current' locals via f_locals directly: this is
what CPython's LOAD/STORE/DELETE_NAME and LOAD_LOCALS do
o the thorough way: first merge fast locals (cellvars and freevars) into
f_locals, then grab the updated f_locals: this is what locals() does, and also
what eval/exec/execfile etc. use

our LOAD_LOCALS equivalent doesn't use the quicker way and that can cause a
difference in the contents of class dicts passed to metaclasses'
__new__(M, name, bases, class_dict) (see the accompanying test)

so I've changed our LOAD_LOCALS to use the quick way, to fix this issue, and
also made our LOAD/STORE/DELETE_NAME equivalents use the quicker way too (which
means closures do a little less work)

Now we have:
o PyFrame.getf_locals -> quick way (and could be deprecated, only the compiler
uses it. just grab f_locals directly instead)
o new PyFrame.getLocals -> thorough way, used everywhere else outside of
PyFrame
........
r4340 | pjenvey | 2008-04-13 11:42:31 -0700 (Sun, 13 Apr 2008) | 1 line

whitespace
........
r4341 | pjenvey | 2008-04-13 11:51:14 -0700 (Sun, 13 Apr 2008) | 2 lines

py_compile from
http://svn.python.org/projects/python/branches/release25-maint/Lib/py_compile.py@38987
........
r4342 | pjenvey | 2008-04-13 11:55:39 -0700 (Sun, 13 Apr 2008) | 4 lines

rename our builtin py_compile to _py_compile, and call it from CPython's pure
python py_compile. adds support for compile's doraise option, which by default
swallows exceptions
........
r4343 | pjenvey | 2008-04-13 12:08:52 -0700 (Sun, 13 Apr 2008) | 3 lines

fix re.subx on empty strings with no match: CPython actually returns
pattern[0:0] in this case
........
r4344 | fwierzbicki | 2008-04-14 07:59:19 -0700 (Mon, 14 Apr 2008) | 2 lines

Added null check for compile_flags. Thanks to Georgy Berdyshev for pointing out the bug.
........
r4345 | pjenvey | 2008-04-14 17:07:42 -0700 (Mon, 14 Apr 2008) | 15 lines

o automatically define toString() in derived classes (instead of including it
from object.derived) but allow disabling of it. for PyString/UnicodeDerived;
they need toString() to pass through instead of calling __repr__ as that breaks
the expectation that PyString.toString() returns the real string

this means PyObject.toString() from java code always returns __repr__ *except*
for PyString/Unicode, which return the actual string
(thanks Mehendran)

o update the "should return a <type>" message in derived class descriptors to
match CPython 2.5's
o from the full gderived.py run: removed a useless constructor from
PyUnicodeDerived and updated the collections derives' getattr/setattr to use
interned strings
........
r4346 | pjenvey | 2008-04-14 18:01:18 -0700 (Mon, 14 Apr 2008) | 6 lines

o fix str.__repr__() to match repr(str) and separate it from toString
fixes #1510227, #1782565
mostly from Mehendran's patch in #1785475
o fix str.__str__ on str subclasses not returning a normal str
o rename unicode_toString to unicode___repr__ (that's what it really is)
........
r4347 | pjenvey | 2008-04-14 20:24:23 -0700 (Mon, 14 Apr 2008) | 2 lines

always escape \t \n \r, even for unicode, never escape \b \f
........
r4348 | pjenvey | 2008-04-14 21:11:00 -0700 (Mon, 14 Apr 2008) | 2 lines

fix single quotes not being escaped in unicode repr
........
r4349 | pjenvey | 2008-04-16 11:39:50 -0700 (Wed, 16 Apr 2008) | 9 lines

include the jarjar'd asm ClassReader in our jar and use it to get the
real class name of $py.class files before importing them. Allows us to
import misnamed/mislabeled $py.class files

the import statement has been hacking around this by recompiling the
.py (if it exists) when it happens. more importantly imp.load_module
(and load_compiled when we support it) don't and shouldn't workaround
this, instead load_module has been throwing NoClassDefFoundErrors
........
r4350 | pjenvey | 2008-04-16 16:22:27 -0700 (Wed, 16 Apr 2008) | 5 lines

add a special case to _binop_rule to satisfy CPython's handling of
__add__/__radd__ with str/unicode and str/unicode subclasses. replaces
the broken bandaid for this applied in r4020
Thanks Samuele Pedroni for the solution and test_basic
........
r4351 | pjenvey | 2008-04-16 23:53:27 -0700 (Wed, 16 Apr 2008) | 1 line

allow setDaemon(None) or anything else by filtering it through bool
........
r4352 | pjenvey | 2008-04-17 14:34:50 -0700 (Thu, 17 Apr 2008) | 3 lines

new style classes must define a __call__ to be callable, a __call__ provided by
__getattr__ doesn't count
........
r4353 | zyasoft | 2008-04-17 14:59:21 -0700 (Thu, 17 Apr 2008) | 1 line

Changes to enable dateutil on jython, plus a fix for a potential race on time.clock's initialization
........
r4354 | pjenvey | 2008-04-17 21:05:56 -0700 (Thu, 17 Apr 2008) | 2 lines

core.util is a more appropriate place for ByteSwapper and FileUtil
........
r4355 | fwierzbicki | 2008-04-18 12:03:31 -0700 (Fri, 18 Apr 2008) | 3 lines

Better coverage of _ast. Made AST an interface so that enums (like expr_contextType)
can pass instanceof(x, _ast.AST).
........
r4356 | pjenvey | 2008-04-18 13:45:13 -0700 (Fri, 18 Apr 2008) | 6 lines

o kill the annoying Java version of the os module. if it was actually ever
needed, it's not anymore
o store os.environ in sys so it can survive a reload of the os
module. this was causing a really vague new bug in test_javashell now
that test_import was actually able to reload os via imp.load_module
........
r4357 | pjenvey | 2008-04-18 15:03:25 -0700 (Fri, 18 Apr 2008) | 3 lines

avoid a ClassCastException when an object's __int__ surprises formatInteger by
returning a long
........
r4358 | pjenvey | 2008-04-18 16:40:39 -0700 (Fri, 18 Apr 2008) | 3 lines

utilize the str formatter to make float's repr/str resemble CPython's a little
more
........
r4359 | pjenvey | 2008-04-18 19:46:32 -0700 (Fri, 18 Apr 2008) | 2 lines

fix the default PyDictionary constructor unnecessarily creating two CHMs
........
r4360 | fwierzbicki | 2008-04-19 07:23:21 -0700 (Sat, 19 Apr 2008) | 3 lines

Expose __iter__ on tuple, list, and array types. Still need to do the
same on the Derived types.
........
r4361 | pjenvey | 2008-04-19 14:14:24 -0700 (Sat, 19 Apr 2008) | 7 lines

make the 'g' float formatter closer to CPython's output:
o format as exponent when -4 <= exponent < precision
o handle infinities
o pass the altFlag to the formatters
o fix precision of the exponential formatter's exponent
o don't need the altFlag padding when doing exponential format
........
r4362 | pjenvey | 2008-04-19 14:35:10 -0700 (Sat, 19 Apr 2008) | 3 lines

kill ExtraMath's hypot and log10 for their equivalents in Java 1.5's
java.lang.Math
........
r4363 | fwierzbicki | 2008-04-20 09:05:22 -0700 (Sun, 20 Apr 2008) | 2 lines

Added lineno and col_offset, and some debug info to PythonTree.
........
r4364 | fwierzbicki | 2008-04-20 11:19:34 -0700 (Sun, 20 Apr 2008) | 2 lines

remove debug statement.
........
r4365 | fwierzbicki | 2008-04-20 19:57:33 -0700 (Sun, 20 Apr 2008) | 2 lines

Fixed up to take advantage of Philip's recent improvements.
........
r4366 | fwierzbicki | 2008-04-21 14:58:41 -0700 (Mon, 21 Apr 2008) | 5 lines

took test_ast.py from CPython's release25-maint branch revision 62446. Modified a bit
to "shape" the results of __class__.__name__ since the results are different for Jython
for the moment (and may always differ, we'll see). About 50% of the tests work at the
moment. Also cleaned up the ast folder a bit.
........
r4367 | fwierzbicki | 2008-04-21 19:41:48 -0700 (Mon, 21 Apr 2008) | 3 lines

Better match line numbers and char positions with test_ast. Commented out the failures
for now. Also added support for eval and single_input.
........
r4368 | fwierzbicki | 2008-04-22 08:46:48 -0700 (Tue, 22 Apr 2008) | 2 lines

All but a couple of test_ast tests now pass.
........
r4369 | fwierzbicki | 2008-04-22 17:12:34 -0700 (Tue, 22 Apr 2008) | 2 lines

The rest of the modified test_ast now works.
........
r4370 | pjenvey | 2008-04-22 21:30:28 -0700 (Tue, 22 Apr 2008) | 1 line

expose __iter__ on sets
........
r4371 | pjenvey | 2008-04-24 21:22:43 -0700 (Thu, 24 Apr 2008) | 3 lines

use System.out and friends instead of FileDescriptor.out and friends, which
aren't correct under nailgun
........
r4374 | pjenvey | 2008-04-30 20:59:37 -0700 (Wed, 30 Apr 2008) | 2 lines

small rearrange per coding standards
........
r4379 | fwierzbicki | 2008-05-02 18:20:26 -0700 (Fri, 02 May 2008) | 3 lines

Add warning that Derived classes are generated. No warning added to Derived classes
in org/python/modules yet since they look like they where hand modified a bit.
........
r4391 | pjenvey | 2008-05-13 12:28:35 -0700 (Tue, 13 May 2008) | 1 line

whitespace
........
r4393 | pjenvey | 2008-05-13 14:15:18 -0700 (Tue, 13 May 2008) | 3 lines

update test_funcattrs to the latest 2.5 version, from:
http://svn.python.org/projects/python/branches/release25-maint/Lib/test/test_funcattrs.py@59171
........
r4394 | pjenvey | 2008-05-13 14:34:49 -0700 (Tue, 13 May 2008) | 8 lines

o cleanup PyFunction, use exposed annotations
o copy the new.function arg checking code into PyFunction __new__, so
types.FunctionType supports the same args. add test_func_jy with jek's test
cases
o add cell.cell_contents and an appropriate repr. use exposed annotations
fixes #1034
thanks Jason Kirtland
........
r4395 | pjenvey | 2008-05-13 15:18:05 -0700 (Tue, 13 May 2008) | 1 line

unused import
........
r4396 | pjenvey | 2008-05-13 15:30:47 -0700 (Tue, 13 May 2008) | 3 lines

new.py from:
http://svn.python.org/projects/python/branches/release25-maint/Lib/new.py@27241
........
r4397 | fwierzbicki | 2008-05-13 16:30:08 -0700 (Tue, 13 May 2008) | 3 lines

Extracted from astlib.py -- simple pretty printer that works for
both jython and python.
........
r4398 | fwierzbicki | 2008-05-13 16:31:56 -0700 (Tue, 13 May 2008) | 2 lines

change def name.
........
r4399 | pjenvey | 2008-05-13 18:13:52 -0700 (Tue, 13 May 2008) | 1 line

make types.InstanceType() handle None as second arg
........
r4400 | pjenvey | 2008-05-13 18:14:20 -0700 (Tue, 13 May 2008) | 6 lines

o match types.MethodType() (new PyMethod()) args to CPython's:
(func, self, type) instead of (self, func, type)
o kill most of newmodule for the simpler pure python version. we can't dump it
completely until a better workaround for the new.classobj hack is done; in the
meantime, keep it around at _new.classobj
........
r4401 | pjenvey | 2008-05-13 18:34:54 -0700 (Tue, 13 May 2008) | 1 line

ensure new.classobj can create new style classes
........
r4404 | fwierzbicki | 2008-05-15 12:13:41 -0700 (Thu, 15 May 2008) | 3 lines

Finally found the fix for empty modules. Empty Lexer output causes a null tree to
return. I've fixed by creating an empty Module node by hand for empty inuput.
........
r4406 | pjenvey | 2008-05-15 13:42:23 -0700 (Thu, 15 May 2008) | 3 lines

maintain func_defaults and func_closure as null instead of
Py.EmptyObjects/EmptyTuple, to more closely resemble CPython
........
r4409 | pjenvey | 2008-05-15 16:52:01 -0700 (Thu, 15 May 2008) | 4 lines

let null return values pass thru PyDataDescr get as None instead of triggering
AttributeErrors. usually what we want anyway and makes @ExposedGet
implementations easier
........
r4410 | pjenvey | 2008-05-15 19:03:31 -0700 (Thu, 15 May 2008) | 3 lines

fix isinstance(newstyle_obj, oldstyle_class) always failing when it can be True
via multiple inheritance. make isInstance more closely resemble CPython's
........
r4411 | pjenvey | 2008-05-16 10:55:45 -0700 (Fri, 16 May 2008) | 5 lines

fix sets incorrectly raising a TypeError when asked for superset/subset on
non-set iterables. also fixes a few other tests from 2.5 test_set
fixes #1035
patch from Jonathan Ellis
........
r4412 | pjenvey | 2008-05-16 13:27:52 -0700 (Fri, 16 May 2008) | 1 line

more ExposedGet now translating null for us
........
r4413 | pjenvey | 2008-05-16 14:19:03 -0700 (Fri, 16 May 2008) | 2 lines

cleanup PyMethod, use exposed annotations
........
r4414 | pjenvey | 2008-05-16 16:30:52 -0700 (Fri, 16 May 2008) | 1 line

more appropriate method name
........
r4415 | pjenvey | 2008-05-16 17:07:22 -0700 (Fri, 16 May 2008) | 7 lines

use our Java set implementation only for the builtin sets, and use CPythonLib's
sets module. so we can be more compatible with both versions compared to
CPython, as there's a few differences between the two. moves modules.sets into
core, PyImmutableSet -> PyFrozenSet, and causes test___all__ and CPythonLib's
test_sets to now pass
patch from Jonathan Ellis
........

pjenvey@79b11f02-f210-0410-99aa-fb189b3d1ac4 pjenvey@79b11f02-f210-0410-99aa-fb189b3d1ac4 2008-05-17

1 2 3 .. 10 > >> (Page 1 of 10)
added src/org/python/core/util/ByteSwapper.java
changed src/templates/README.txt
changed src/templates/gderived.py
changed src/templates/gderived-defs
changed src/templates/object.derived
changed src/templates/mappings
changed src/templates/str.derived
changed src/templates/unicode.derived
changed src/org/python/core/util/ExtraMath.java
changed src/org/python/core/PySliceDerived.java
changed src/org/python/core/PyNotImplemented.java
changed src/org/python/core/PyComplexDerived.java
changed src/org/python/core/PyDataDescr.java
changed src/org/python/core/PyFunction.java
changed src/org/python/core/PyBooleanDerived.java
changed src/org/python/core/Py.java
changed src/org/python/core/PyMethod.java
changed src/org/python/core/PyXRange.java
changed src/org/python/core/PyPropertyDerived.java
changed src/org/python/core/PyIntegerDerived.java
changed src/org/python/core/PyArray.java
copied src/templates/immutableset.derived -> src/templates/frozenset.derived
copied src/org/python/core/FileUtil.java -> src/org/python/core/util/FileUtil.java
src/org/python/core/util/ByteSwapper.java Diff Switch to side-by-side view
Loading...
src/templates/README.txt Diff Switch to side-by-side view
Loading...
src/templates/gderived.py Diff Switch to side-by-side view
Loading...
src/templates/gderived-defs Diff Switch to side-by-side view
Loading...
src/templates/object.derived Diff Switch to side-by-side view
Loading...
src/templates/mappings Diff Switch to side-by-side view
Loading...
src/templates/str.derived Diff Switch to side-by-side view
Loading...
src/templates/unicode.derived Diff Switch to side-by-side view
Loading...
src/org/python/core/util/ExtraMath.java Diff Switch to side-by-side view
Loading...
src/org/python/core/PySliceDerived.java Diff Switch to side-by-side view
Loading...
src/org/python/core/PyNotImplemented.java Diff Switch to side-by-side view
Loading...
src/org/python/core/PyComplexDerived.java Diff Switch to side-by-side view
Loading...
src/org/python/core/PyDataDescr.java Diff Switch to side-by-side view
Loading...
src/org/python/core/PyFunction.java Diff Switch to side-by-side view
Loading...
src/org/python/core/PyBooleanDerived.java Diff Switch to side-by-side view
Loading...
src/org/python/core/Py.java Diff Switch to side-by-side view
Loading...
src/org/python/core/PyMethod.java Diff Switch to side-by-side view
Loading...
src/org/python/core/PyXRange.java Diff Switch to side-by-side view
Loading...
src/org/python/core/PyPropertyDerived.java Diff Switch to side-by-side view
Loading...
src/org/python/core/PyIntegerDerived.java Diff Switch to side-by-side view
Loading...
src/org/python/core/PyArray.java Diff Switch to side-by-side view
Loading...
src/templates/immutableset.derived to src/templates/frozenset.derived
--- a/src/templates/immutableset.derived
+++ b/src/templates/frozenset.derived
@@ -1,4 +1,4 @@
-base_class: PyImmutableSet
+base_class: PyFrozenSet
 want_dict: true
 ctr:
 incl: object
src/org/python/core/FileUtil.java to src/org/python/core/util/FileUtil.java
--- a/src/org/python/core/FileUtil.java
+++ b/src/org/python/core/util/FileUtil.java
@@ -1,5 +1,5 @@
 // Copyright (c) 2003 Jython project
-package org.python.core;
+package org.python.core.util;
 
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
1 2 3 .. 10 > >> (Page 1 of 10)