Commit 2c6722be authored by Kevin Modzelewski's avatar Kevin Modzelewski

Some misc features for importing test.test_support

parent 5a0a0ba4
......@@ -1384,6 +1384,10 @@ _pypy_sys_version_parser = re.compile(
'\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*'
'\[PyPy [^\]]+\]?')
_pyston_sys_version_parser = re.compile(
r'([\w.+]+)\s*'
'\[Pyston ([^\]]+)\]?')
_sys_version_cache = {}
def _sys_version(sys_version=None):
......@@ -1454,6 +1458,17 @@ def _sys_version(sys_version=None):
version, buildno, builddate, buildtime = match.groups()
compiler = ""
elif "Pyston" in sys_version:
# Pyston
name = "Pyston"
match = _pyston_sys_version_parser.match(sys_version)
if match is None:
raise ValueError("failed to parse Pyston sys.version: %s" %
repr(sys_version))
version, buildno = match.groups()
builddate = ""
compiler = ""
else:
# CPython
match = _sys_version_parser.match(sys_version)
......
# Dummy file to make this directory a package.
This diff is collapsed.
......@@ -297,6 +297,7 @@ void setupSys() {
boxInt(PYTHON_VERSION_MICRO), boxStrConstant("beta"), boxInt(0) }));
sys_module->giveAttr("maxint", boxInt(PYSTON_INT_MAX));
sys_module->giveAttr("maxsize", boxInt(PY_SSIZE_T_MAX));
sys_flags_cls = new BoxedHeapClass(object_cls, BoxedSysFlags::gcHandler, 0, 0, sizeof(BoxedSysFlags), false,
new BoxedString("flags"));
......
......@@ -1987,7 +1987,8 @@ extern "C" bool nonzero(Box* obj) {
if (func == NULL) {
ASSERT(isUserDefined(obj->cls) || obj->cls == classobj_cls || obj->cls == type_cls
|| isSubclass(obj->cls, Exception) || obj->cls == file_cls || obj->cls == traceback_cls
|| obj->cls == instancemethod_cls || obj->cls == module_cls || obj->cls == capifunc_cls,
|| obj->cls == instancemethod_cls || obj->cls == module_cls || obj->cls == capifunc_cls
|| obj->cls == builtin_function_or_method_cls,
"%s.__nonzero__", getTypeName(obj)); // TODO
// TODO should rewrite these?
......
import platform
print type(platform.python_implementation())
# print platform._sys_version()
......@@ -7,3 +7,4 @@ print sys.copyright[-200:]
print sys.byteorder
print sys.getdefaultencoding()
print sys.getfilesystemencoding()
print type(sys.maxsize)
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