Message9556

Author zyasoft
Recipients jfroco, pjenvey, zyasoft
Date 2015-02-24.13:31:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1424784678.85.0.921839862046.issue2272@psf.upfronthosting.co.za>
In-reply-to
Content
A minor change allows the import of Flask, and its dependent library, Werkzeug:

$ hg diff src/org/python/core/PyType.java
diff -r e909a4641731 src/org/python/core/PyType.java
--- a/src/org/python/core/PyType.java	Sun Feb 22 10:40:10 2015 -0700
+++ b/src/org/python/core/PyType.java	Tue Feb 24 07:19:16 2015 -0600
@@ -254,9 +254,9 @@
                 String slotName = confirmIdentifier(slot);

                 if (slotName.equals("__dict__")) {
-                    if (!mayAddDict || wantDict) {
-                        throw Py.TypeError("__dict__ slot disallowed: we already got one");
-                    }
+//                    if (!mayAddDict || wantDict) {
+//                        throw Py.TypeError("__dict__ slot disallowed: we already got one");
+//                    }
                     wantDict = true;
                 } else if (slotName.equals("__weakref__")) {
                     if (!mayAddWeak || wantWeak) {

Testing the current Werkzeug trunk (https://github.com/mitsuhiko/werkzeug) with the above patch, I get 6 failed, 407 passed, 12 skipped (http://bugs.jython.org/file1492/werkzeug-failures.txt). Some of these failures are due to bad test setup: Werkzeug should be using sys.executabe, not python in for example test_monkeypached_sleep. The rest should be looked at on Jython's end, especially:

TypeError: encode(): 1st arg can't be coerced to org.python.core.PyUnicode 

My reading of https://docs.python.org/2/reference/datamodel.html#slots suggests that we are too strict and this is a correct change, and should also be applied to __weakref__. Also all the unit tests continue to work, so there's nothing actually requiring this strictness. But we need to think this change through. Adding pjenvey in case he has an opinion. I'm pretty sure this code has not changed since Phil's commit in 2009 (5921:c1b82fcfd3eb).

Blocker for RC1
History
Date User Action Args
2015-02-24 13:31:18zyasoftsetmessageid: <1424784678.85.0.921839862046.issue2272@psf.upfronthosting.co.za>
2015-02-24 13:31:18zyasoftsetrecipients: + zyasoft, pjenvey, jfroco
2015-02-24 13:31:18zyasoftlinkissue2272 messages
2015-02-24 13:31:17zyasoftcreate