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