Commit 4870b92b authored by Kevin Modzelewski's avatar Kevin Modzelewski

os.environ updates should propagate

Just another HAVE_foo define we were missing.
parent a3196dd0
...@@ -124,6 +124,7 @@ ...@@ -124,6 +124,7 @@
#define HAVE_UNISTD_H 1 #define HAVE_UNISTD_H 1
#define HAVE_UTIME_H 1 #define HAVE_UTIME_H 1
#define HAVE_WCHAR_H 1 #define HAVE_WCHAR_H 1
#define HAVE_PUTENV 1
// Added this for some Pyston modifications: // Added this for some Pyston modifications:
#define MAX_PYSTRING_SIZE (PY_SSIZE_T_MAX/2 - (1<<20)) #define MAX_PYSTRING_SIZE (PY_SSIZE_T_MAX/2 - (1<<20))
......
...@@ -9451,7 +9451,7 @@ INITFUNC(void) ...@@ -9451,7 +9451,7 @@ INITFUNC(void)
#ifdef HAVE_PUTENV #ifdef HAVE_PUTENV
if (posix_putenv_garbage == NULL) if (posix_putenv_garbage == NULL)
posix_putenv_garbage = PyDict_New(); posix_putenv_garbage = PyGC_AddRoot(PyDict_New());
#endif #endif
if (!initialized) { if (!initialized) {
......
...@@ -1103,6 +1103,8 @@ void setupList() { ...@@ -1103,6 +1103,8 @@ void setupList() {
"index", new BoxedFunction(boxRTFunction((void*)listIndex, BOXED_INT, 4, 2, false, false), { NULL, NULL })); "index", new BoxedFunction(boxRTFunction((void*)listIndex, BOXED_INT, 4, 2, false, false), { NULL, NULL }));
list_cls->giveAttr("remove", new BoxedFunction(boxRTFunction((void*)listRemove, NONE, 2))); list_cls->giveAttr("remove", new BoxedFunction(boxRTFunction((void*)listRemove, NONE, 2)));
list_cls->giveAttr("reverse", new BoxedFunction(boxRTFunction((void*)listReverse, NONE, 1))); list_cls->giveAttr("reverse", new BoxedFunction(boxRTFunction((void*)listReverse, NONE, 1)));
list_cls->giveAttr("__hash__", None);
list_cls->freeze(); list_cls->freeze();
CLFunction* hasnext = boxRTFunction((void*)listiterHasnextUnboxed, BOOL, 1); CLFunction* hasnext = boxRTFunction((void*)listiterHasnextUnboxed, BOOL, 1);
......
...@@ -2113,6 +2113,10 @@ extern "C" BoxedInt* hash(Box* obj) { ...@@ -2113,6 +2113,10 @@ extern "C" BoxedInt* hash(Box* obj) {
return static_cast<BoxedInt*>(boxInt((i64)obj)); return static_cast<BoxedInt*>(boxInt((i64)obj));
} }
if (hash == None) {
raiseExcHelper(TypeError, "unhashable type: '%s'", obj->cls->tp_name);
}
Box* rtn = runtimeCall0(hash, ArgPassSpec(0)); Box* rtn = runtimeCall0(hash, ArgPassSpec(0));
if (rtn->cls != int_cls) { if (rtn->cls != int_cls) {
raiseExcHelper(TypeError, "an integer is required"); raiseExcHelper(TypeError, "an integer is required");
......
...@@ -195,3 +195,5 @@ l.sort(cmp=mycmp, key=str) ...@@ -195,3 +195,5 @@ l.sort(cmp=mycmp, key=str)
print types_seen print types_seen
print l print l
""" """
print repr(list.__hash__)
...@@ -23,8 +23,13 @@ print e.strerror ...@@ -23,8 +23,13 @@ print e.strerror
print e.filename print e.filename
print OSError(1, 2).filename print OSError(1, 2).filename
# This part needs sys.exc_info() and the three-arg raise statement try:
# try: os.execvp("aoeuaoeu", ['aoeuaoeu'])
# os.execvp("aoeuaoeu", ['aoeuaoeu']) except OSError, e:
# except OSError, e: print e
# print e
# Changes to os.environ should show up in subprocesses:
import subprocess
env = os.environ
env["PYTHONPATH"] = "."
subprocess.check_call("echo PYTHONPATH is $PYTHONPATH", shell=1)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment