Skip to content

Commit 58074af

Browse files
committed
Merged revisions 4419-4422 via svnmerge from
https://jython.svn.sourceforge.net/svnroot/jython/trunk/jython ........ r4419 | pjenvey | 2008-05-17 19:09:27 -0400 (Sat, 17 May 2008) | 1 line match CPython's error message ........ r4420 | pjenvey | 2008-05-18 17:54:16 -0400 (Sun, 18 May 2008) | 1 line use String.format ........ r4421 | pjenvey | 2008-05-18 18:51:09 -0400 (Sun, 18 May 2008) | 1 line move the thread module into its own package ........ r4422 | pjenvey | 2008-05-18 19:00:22 -0400 (Sun, 18 May 2008) | 1 line small cleanup ........
1 parent 3630198 commit 58074af

8 files changed

Lines changed: 29 additions & 20 deletions

File tree

CoreExposed.includes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ org/python/core/PySuper.class
3131
org/python/core/PyTuple.class
3232
org/python/core/PyType.class
3333
org/python/core/PyUnicode.class
34-
org/python/modules/PyLocal.class
3534
org/python/modules/collections/PyDefaultDict.class
3635
org/python/modules/collections/PyDeque.class
3736
org/python/modules/random/PyRandom.class
37+
org/python/modules/thread/PyLocal.class
3838
org/python/modules/time/PyTimeTuple.class
3939
org/python/modules/zipimport/zipimporter.class
4040
org/python/modules/PyTeeIterator.class

src/org/python/core/PyModule.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,9 @@ final String module_toString() {
177177
name = new PyString("?");
178178
}
179179
if (filename == null) {
180-
filename = new PyString("(built-in)");
181-
} else {
182-
filename = new PyString("from '" + filename + "'");
180+
return String.format("<module '%s' (built-in)>", name);
183181
}
184-
return "<module '" + name + "' " + filename + ">";
182+
return String.format("<module '%s' from '%s'>", name, filename);
185183
}
186184

187185
public PyObject __dir__() {

src/org/python/core/PySet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public int hashCode() {
208208

209209
@ExposedMethod
210210
final int set___hash__() {
211-
throw Py.TypeError("Can't hash a Set, only an FrozenSet.");
211+
throw Py.TypeError("set objects are unhashable");
212212
}
213213

214214
@ExposedMethod

src/org/python/modules/Setup.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class Setup
2727
public static String[] builtinModules = {
2828
"jarray",
2929
"math",
30-
"thread",
30+
"thread:org.python.modules.thread.thread",
3131
"operator",
3232
"time:org.python.modules.time.Time",
3333
"_py_compile",

src/org/python/modules/PyLocal.java renamed to src/org/python/modules/thread/PyLocal.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.python.modules;
1+
package org.python.modules.thread;
22

33
import org.python.core.Py;
44
import org.python.core.PyDictionary;

src/org/python/modules/PyLocalDerived.java renamed to src/org/python/modules/thread/PyLocalDerived.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.python.modules;
1+
package org.python.modules.thread;
22

33
import org.python.core.*;
44

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
// Copyright (c) Corporation for National Research Initiatives
2-
package org.python.modules;
2+
package org.python.modules.thread;
33

4-
import org.python.core.*;
4+
import org.python.core.Py;
5+
import org.python.core.PyObject;
56

67
public class PyLock extends PyObject {
7-
private boolean locked=false;
8-
//private Object lock = new Object();
8+
9+
private boolean locked = false;
910

1011
public boolean acquire() {
1112
return acquire(true);
@@ -34,7 +35,8 @@ public synchronized boolean acquire(boolean waitflag) {
3435

3536
public synchronized void release() {
3637
if (locked) {
37-
locked = false; notifyAll();
38+
locked = false;
39+
notifyAll();
3840
} else {
3941
throw Py.ValueError("lock not acquired");
4042
}
Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
// Copyright (c) Corporation for National Research Initiatives
2-
package org.python.modules;
3-
import org.python.core.*;
2+
package org.python.modules.thread;
3+
4+
import org.python.core.ClassDictInit;
5+
import org.python.core.FunctionThread;
6+
import org.python.core.Py;
7+
import org.python.core.PyException;
8+
import org.python.core.PyInteger;
9+
import org.python.core.PyObject;
10+
import org.python.core.PyString;
11+
import org.python.core.PyType;
12+
import org.python.core.PyTuple;
13+
14+
public class thread implements ClassDictInit {
415

5-
public class thread implements ClassDictInit
6-
{
716
public static PyString __doc__ = new PyString(
817
"This module provides primitive operations to write multi-threaded "+
918
"programs.\n" +
@@ -12,7 +21,7 @@ public class thread implements ClassDictInit
1221

1322
public static void classDictInit(PyObject dict) {
1423
dict.__setitem__("LockType", PyType.fromClass(PyLock.class));
15-
dict.__setitem__("_local", PyLocal.TYPE);
24+
dict.__setitem__("_local", PyLocal.TYPE);
1625
}
1726

1827
public static PyObject error = new PyString("thread.error");
@@ -34,7 +43,7 @@ public static void start_new_thread(PyObject func, PyTuple args) {
3443
}
3544
pt.start();
3645
}
37-
46+
3847
public static PyLock allocate_lock() {
3948
return new PyLock();
4049
}

0 commit comments

Comments
 (0)