Skip to content

Commit

Permalink
Merge pull request #1209 from kmod/cpython_descr2
Browse files Browse the repository at this point in the history
Switch to CPython's descrobject.c
  • Loading branch information
kmod committed May 25, 2016
2 parents c9cab0e + a11ffa7 commit 7974eb8
Show file tree
Hide file tree
Showing 41 changed files with 2,068 additions and 1,284 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ nosearch_check_%: %.py pyston_dbg check-deps
$(call make_search,check_%)

nosearch_dbgpy_% nosearch_pydbg_%: %.py ext_pythondbg
export PYTHON_VERSION=$$(python2.7-dbg -V 2>&1 | awk '{print $$2}'); PYTHONPATH=test/test_extension/build/lib.linux-x86_64-2.7-pydebug $(GDB) --ex "dir $(DEPS_DIR)/python-src/python2.7-$$PYTHON_VERSION/debian" $(GDB_CMDS) --args python2.7-dbg $<
export PYTHON_VERSION=$$(python2.7-dbg -V 2>&1 | awk '{print $$2}'); PYTHONPATH=test/test_extension/build/lib.linux-x86_64-2.7-pydebug $(GDB) --ex "dir $(DEPS_DIR)/python-src/python2.7-$$PYTHON_VERSION/debian" $(GDB_CMDS) --args python2.7-dbg $(ARGS) $<
$(call make_search,dbgpy_%)
$(call make_search,pydbg_%)

Expand Down
2 changes: 1 addition & 1 deletion from_cpython/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ file(GLOB_RECURSE STDOBJECT_SRCS Objects
capsule.c
cobject.c
complexobject.c
descrobject.c
dictobject.c
dictproxy.c
errors.c
exceptions.c
floatobject.c
Expand Down
31 changes: 15 additions & 16 deletions from_cpython/Include/descrobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args,
typedef PyObject *(*wrapperfunc_kwds)(PyObject *self, PyObject *args,
void *wrapped, PyObject *kwds);

// Pyston addition: faster CC
typedef PyObject *(*wrapperfunc_1arg)(PyObject *self, void *wrapped);
typedef PyObject *(*wrapperfunc_2arg)(PyObject *self, PyObject* arg, void *wrapped);

struct wrapperbase {
char *name;
const char *name;
int offset;
void *function;
wrapperfunc wrapper;
char *doc;
const char *doc;
int flags;
PyObject *name_strobj;
};
Expand All @@ -45,8 +47,6 @@ struct wrapperbase {

/* Various kinds of descriptor objects */

// Pyston change: these are not our object layouts
#if 0
#define PyDescr_COMMON \
PyObject_HEAD \
PyTypeObject *d_type; \
Expand Down Expand Up @@ -76,21 +76,11 @@ typedef struct {
struct wrapperbase *d_base;
void *d_wrapped; /* This can be any function pointer */
} PyWrapperDescrObject;
#endif
// (Pyston TODO: add opaque definitions of those names)

// Pyston change: these are not static objects any more
#if 0
PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type;
PyAPI_DATA(PyTypeObject) PyDictProxy_Type;
PyAPI_DATA(PyTypeObject) PyGetSetDescr_Type;
PyAPI_DATA(PyTypeObject) PyMemberDescr_Type;
#else
PyAPI_DATA(PyTypeObject) PyDictProxy_Type;
#endif
// (Pyston TODO: add #defines to our names)
PyAPI_DATA(PyTypeObject*) wrapperdescr_cls;
#define PyWrapperDescr_Type (*wrapperdescr_cls)

PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *) PYSTON_NOEXCEPT;
Expand All @@ -106,8 +96,17 @@ PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *) PYSTON_NOEXCEPT;


// Pyston change: this is no longer a static object
//PyAPI_DATA(PyTypeObject) PyProperty_Type;
PyAPI_DATA(PyTypeObject) PyProperty_Type;

// Pyston change: exposed these
typedef struct {
PyObject_HEAD
PyWrapperDescrObject *descr;
PyObject *self;
} wrapperobject;
PyAPI_DATA(PyTypeObject) wrappertype;
PyAPI_DATA(PyTypeObject) PyMethodDescr_Type;
PyAPI_DATA(PyTypeObject) PyClassMethodDescr_Type;

#ifdef __cplusplus
}
Expand Down
2 changes: 1 addition & 1 deletion from_cpython/Include/structmember.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct memberlist {

typedef struct PyMemberDef {
/* Current version, use this */
char *name;
const char *name;
int type;
Py_ssize_t offset;
int flags;
Expand Down
Loading

0 comments on commit 7974eb8

Please sign in to comment.