Commit f44f2eff authored by Kevin Modzelewski's avatar Kevin Modzelewski

Give up on implementing all of types.py for now

parent fe565665
......@@ -33,7 +33,8 @@ try:
except NameError:
StringTypes = (StringType,)
BufferType = buffer
# Pyston change: 'buffer' is not implemented yet
# BufferType = buffer
TupleType = tuple
ListType = list
......@@ -42,12 +43,15 @@ DictType = DictionaryType = dict
def _f(): pass
FunctionType = type(_f)
LambdaType = type(lambda: None) # Same as FunctionType
CodeType = type(_f.func_code)
# Pyston change: there is no concept of a "code object" yet:
# CodeType = type(_f.func_code)
def _g():
yield 1
GeneratorType = type(_g())
# Pyston change: we do not support old-style classes yet
"""
class _C:
def _m(self): pass
ClassType = type(_C)
......@@ -55,6 +59,7 @@ UnboundMethodType = type(_C._m) # Same as MethodType
_x = _C()
InstanceType = type(_x)
MethodType = type(_x._m)
"""
BuiltinFunctionType = type(len)
BuiltinMethodType = type([].append) # Same as BuiltinFunctionType
......@@ -63,6 +68,8 @@ ModuleType = type(sys)
FileType = file
XRangeType = xrange
# Pyston change: we don't support sys.exc_info yet
"""
try:
raise TypeError
except TypeError:
......@@ -70,15 +77,20 @@ except TypeError:
TracebackType = type(tb)
FrameType = type(tb.tb_frame)
del tb
"""
SliceType = slice
EllipsisType = type(Ellipsis)
# Pyston change: don't support this yet
# EllipsisType = type(Ellipsis)
DictProxyType = type(TypeType.__dict__)
# Pyston change: don't support this yet
# DictProxyType = type(TypeType.__dict__)
NotImplementedType = type(NotImplemented)
# For Jython, the following two types are identical
GetSetDescriptorType = type(FunctionType.func_code)
MemberDescriptorType = type(FunctionType.func_globals)
# Pyston change: don't support these yet
# GetSetDescriptorType = type(FunctionType.func_code)
# MemberDescriptorType = type(FunctionType.func_globals)
del sys, _f, _g, _C, _x # Not for export
# Pyston change: had to change this to match above changes
del sys, _f, _g, #_C, _x # Not for export
......@@ -52,6 +52,8 @@ public:
} else if (ml_flags == METH_VARARGS) {
assert(kwargs->d.size() == 0);
rtn = (Box*)self->method->ml_meth(obj, varargs);
} else if (ml_flags == (METH_VARARGS | METH_KEYWORDS)) {
rtn = (Box*)((PyCFunctionWithKeywords)self->method->ml_meth)(obj, varargs, kwargs);
} else {
RELEASE_ASSERT(0, "0x%x", ml_flags);
}
......@@ -277,7 +279,7 @@ extern "C" void PyBuffer_Release(Py_buffer* view) {
// Not sure why we need another declaration here:
extern "C" void Py_FatalError(const char* msg) __attribute__((__noreturn__));
extern "C" void Py_FatalError(const char* msg) {
fprintf(stderr, "Fatal Python error: %s\n", msg);
fprintf(stderr, "\nFatal Python error: %s\n", msg);
_printStacktrace();
abort();
}
......@@ -294,8 +296,6 @@ extern "C" PyObject* PyObject_Init(PyObject* op, PyTypeObject* tp) {
}
extern "C" PyVarObject* PyObject_InitVar(PyVarObject* op, PyTypeObject* tp, Py_ssize_t size) {
Py_FatalError("'var' objects not tested yet");
RELEASE_ASSERT(op, "");
RELEASE_ASSERT(tp, "");
Py_TYPE(op) = tp;
......
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