Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
f1a3d284
Commit
f1a3d284
authored
Nov 03, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
it builds
parent
7ae5501a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
1 deletion
+45
-1
from_cpython/Include/Python.h
from_cpython/Include/Python.h
+5
-1
src/capi/object.cpp
src/capi/object.cpp
+38
-0
src/core/types.h
src/core/types.h
+2
-0
No files found.
from_cpython/Include/Python.h
View file @
f1a3d284
...
...
@@ -18,7 +18,11 @@
// Cython depends on having this define set:
#define Py_PYTHON_H
#define PYSTON_VERSION "0.3"
#define PYSTON_VERSION "0.5"
#ifndef NDEBUG
#define Py_REF_DEBUG
#endif
// These include orders come from CPython:
#include "patchlevel.h"
...
...
src/capi/object.cpp
View file @
f1a3d284
...
...
@@ -1070,4 +1070,42 @@ extern "C" int PyObject_RichCompareBool(PyObject* v, PyObject* w, int op) noexce
Py_DECREF
(
res
);
return
ok
;
}
#ifdef Py_REF_DEBUG
extern
"C"
{
Py_ssize_t
_Py_RefTotal
;
}
extern
"C"
Py_ssize_t
_Py_GetRefTotal
(
void
)
noexcept
{
PyObject
*
o
;
Py_ssize_t
total
=
_Py_RefTotal
;
/* ignore the references to the dummy object of the dicts and sets
* because they are not reliable and not useful (now that the
* hash table code is well-tested) */
// Pyston change: not sure what these are
#if 0
o = _PyDict_Dummy();
if (o != NULL)
total -= o->ob_refcnt;
o = _PySet_Dummy();
if (o != NULL)
total -= o->ob_refcnt;
#endif
return
total
;
}
#endif
/* Py_REF_DEBUG */
#ifdef Py_REF_DEBUG
/* Log a fatal error; doesn't return. */
extern
"C"
void
_Py_NegativeRefcount
(
const
char
*
fname
,
int
lineno
,
PyObject
*
op
)
noexcept
{
char
buf
[
300
];
PyOS_snprintf
(
buf
,
sizeof
(
buf
),
"%s:%i object at %p has negative ref count "
"%"
PY_FORMAT_SIZE_T
"d"
,
fname
,
lineno
,
op
,
op
->
ob_refcnt
);
Py_FatalError
(
buf
);
}
#endif
/* Py_REF_DEBUG */
}
src/core/types.h
View file @
f1a3d284
...
...
@@ -624,6 +624,8 @@ public:
void
*
operator
new
(
size_t
size
,
BoxedClass
*
cls
)
__attribute__
((
visibility
(
"default"
)));
void
operator
delete
(
void
*
ptr
)
__attribute__
((
visibility
(
"default"
)))
{
abort
();
}
Py_ssize_t
ob_refcnt
;
// Note: cls gets initialized in the new() function.
BoxedClass
*
cls
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment