Commit 8effb5a4 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #416 from undingen/fix_pip_search4

Misc fixes for virtualenv / pip
parents 9098ccf1 bbe39d40
......@@ -41,8 +41,11 @@ else:
INSTALL_SCHEMES = {
'unix_prefix': {
'purelib': '$base/lib/python$py_version_short/site-packages',
'platlib': '$platbase/lib/python$py_version_short/site-packages',
# Pyston change
# 'purelib': '$base/lib/python$py_version_short/site-packages',
# 'platlib': '$platbase/lib/python$py_version_short/site-packages',
'purelib': '$base/site-packages',
'platlib': '$base/site-packages',
'headers': '$base/include/python$py_version_short/$dist_name',
'scripts': '$base/bin',
'data' : '$base',
......
......@@ -1177,8 +1177,7 @@ get_module_code(ZipImporter *self, char *fullname,
if (isbytecode) {
// Pyston change: We don't support bytecode archives currently
// mtime = get_mtime_of_source(self, path);
PyErr_Format(ZipImportError, "Pyston can't load bytecode from archives yet. ' '%.200s'", fullname);
return NULL;
continue;
}
if (p_ispackage != NULL)
......
Subproject commit 0a2bbff17a4f8e0270c64423004b5613457e59db
Subproject commit 98d769dcd3a792f70b5e9c9bb9afa7544a50ae4a
......@@ -622,7 +622,10 @@ static void raiseNameForcingSyntaxError(const char* msg, ScopingAnalysis::ScopeN
syntaxElemMsg = "import * is not allowed in function '%s' because it %s";
lineno = usage->nameForcingNodeImportStar->lineno;
} else {
if (PYTHON_VERSION_MAJOR == 2 && PYTHON_VERSION_MINOR == 7 && PYTHON_VERSION_MICRO < 8)
syntaxElemMsg = "unqualified exec is not allowed in function '%.100s' it %s";
else
syntaxElemMsg = "unqualified exec is not allowed in function '%.100s' because it %s";
lineno = usage->nameForcingNodeBareExec->lineno;
}
......
......@@ -669,7 +669,7 @@ void checkAndThrowCAPIException() {
if (_type) {
BoxedClass* type = static_cast<BoxedClass*>(_type);
assert(isInstance(_type, type_cls) && isSubclass(static_cast<BoxedClass*>(type), BaseException)
assert(isSubclass(_type->cls, type_cls) && isSubclass(static_cast<BoxedClass*>(type), BaseException)
&& "Only support throwing subclass of BaseException for now");
Box* value = cur_thread_state.curexc_value;
......@@ -686,7 +686,7 @@ void checkAndThrowCAPIException() {
PyErr_Clear();
// This is similar to PyErr_NormalizeException:
if (!isInstance(value, type)) {
if (!isSubclass(value->cls, type)) {
if (value->cls == tuple_cls) {
value = runtimeCall(type, ArgPassSpec(0, 0, true, false), value, NULL, NULL, NULL, NULL);
} else if (value == None) {
......
......@@ -211,18 +211,8 @@ extern "C" void my_assert(bool b) {
assert(b);
}
bool isInstance(Box* obj, BoxedClass* cls) {
int rtn = _PyObject_RealIsInstance(obj, cls);
if (rtn < 0)
checkAndThrowCAPIException();
return rtn;
}
extern "C" bool isSubclass(BoxedClass* child, BoxedClass* parent) {
int rtn = _PyObject_RealIsSubclass(child, parent);
if (rtn < 0)
checkAndThrowCAPIException();
return rtn;
return PyType_IsSubtype(child, parent);
}
extern "C" void assertFail(BoxedModule* inModule, Box* msg) {
......@@ -4465,7 +4455,7 @@ extern "C" Box* boxedLocalsGet(Box* boxedLocals, const char* attr, BoxedModule*
// TODO should check the exact semantic here but it's something like:
// If it throws a KeyError, then the variable doesn't exist so move on
// and check the globals (below); otherwise, just propogate the exception.
if (!isInstance(e.value, KeyError)) {
if (!isSubclass(e.value->cls, KeyError)) {
throw;
}
}
......
......@@ -84,7 +84,6 @@ extern "C" Box* importStar(Box* from_module, BoxedModule* to_module);
extern "C" Box** unpackIntoArray(Box* obj, int64_t expected_size);
extern "C" void assertNameDefined(bool b, const char* name, BoxedClass* exc_cls, bool local_var_msg);
extern "C" void assertFail(BoxedModule* inModule, Box* msg);
extern "C" bool isInstance(Box* obj, BoxedClass* parent);
extern "C" bool isSubclass(BoxedClass* child, BoxedClass* parent);
extern "C" BoxedClosure* createClosure(BoxedClosure* parent_closure);
......
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