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
0ebe7b6d
Commit
0ebe7b6d
authored
Jul 05, 2016
by
Marius Wachtler
Committed by
GitHub
Jul 05, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1283 from undingen/use_cpython_macros
capi: add the direct access macros back
parents
20cb1ccb
58c1fddf
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
19 deletions
+5
-19
from_cpython/Include/floatobject.h
from_cpython/Include/floatobject.h
+2
-3
from_cpython/Include/intobject.h
from_cpython/Include/intobject.h
+1
-3
from_cpython/Include/stringobject.h
from_cpython/Include/stringobject.h
+2
-7
src/runtime/str.cpp
src/runtime/str.cpp
+0
-6
No files found.
from_cpython/Include/floatobject.h
View file @
0ebe7b6d
...
...
@@ -56,9 +56,8 @@ PyAPI_FUNC(PyObject *) PyFloat_FromDouble(double) PYSTON_NOEXCEPT;
/* Extract C double from Python float. The macro version trades safety for
speed. */
PyAPI_FUNC
(
double
)
PyFloat_AsDouble
(
PyObject
*
)
PYSTON_NOEXCEPT
;
// Pyston changes: these aren't direct macros any more [they potentially could be though]
#define PyFloat_AS_DOUBLE(op) PyFloat_AsDouble((PyObject*)op)
//#define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval)
#define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval)
/* Write repr(v) into the char buffer argument, followed by null byte. The
buffer must be "big enough"; >= 100 is very safe.
...
...
from_cpython/Include/intobject.h
View file @
0ebe7b6d
...
...
@@ -55,9 +55,7 @@ PyAPI_FUNC(unsigned PY_LONG_LONG) PyInt_AsUnsignedLongLongMask(PyObject *) PYSTO
PyAPI_FUNC
(
long
)
PyInt_GetMax
(
void
)
PYSTON_NOEXCEPT
;
/* Macro, trading safety for speed */
// Pyston changes: these aren't direct macros any more [they potentially could be though]
#define PyInt_AS_LONG(op) PyInt_AsLong((PyObject*)op)
//#define PyInt_AS_LONG(op) (((PyIntObject *)(op))->ob_ival)
#define PyInt_AS_LONG(op) (((PyIntObject *)(op))->ob_ival)
/* These aren't really part of the Int object, but they're handy; the protos
* are necessary for systems that need the magic of PyAPI_FUNC and that want
...
...
from_cpython/Include/stringobject.h
View file @
0ebe7b6d
...
...
@@ -93,21 +93,16 @@ PyAPI_FUNC(void) _Py_ReleaseInternedStrings(void) PYSTON_NOEXCEPT;
PyAPI_FUNC
(
char
)
PyString_GetItem
(
PyObject
*
,
Py_ssize_t
)
PYSTON_NOEXCEPT
;
/* Use only if you know it's a string */
// Pyston changes: these aren't direct macros any more [they potentially could be though]
//#define PyString_CHECK_INTERNED(op) (((PyStringObject *)(op))->ob_sstate)
PyAPI_FUNC
(
int
)
_PyString_CheckInterned
(
PyObject
*
)
PYSTON_NOEXCEPT
;
#define PyString_CHECK_INTERNED(op) _PyString_CheckInterned((PyObject*)op)
#define PyString_CHECK_INTERNED(op) (((PyStringObject *)(op))->ob_sstate)
/* Macro, trading safety for speed */
// Pyston changes: these aren't direct macros any more [they potentially could be though]
#define PyString_AS_STRING(op) PyString_AsString((PyObject*)op)
// Note: there are buggy extension modules (unicodedata.c) that rely on the fact that
// PyString_GET_SIZE does *not* have the same behavior as PyString_Size. In particular,
// you can get away with calling PyString_GET_SIZE on a unicode object and getting the
// length of the unicode string, not the length of the bytes it encodes to in the default
// encoding.
// So, set up a different function for those callers to use.
//
#define PyString_AS_STRING(op) (((PyStringObject *)(op))->ob_sval)
#define PyString_AS_STRING(op) (((PyStringObject *)(op))->ob_sval)
#define PyString_GET_SIZE(op) Py_SIZE(op)
/* _PyString_Join(sep, x) is like sep.join(x). sep must be PyStringObject*,
...
...
src/runtime/str.cpp
View file @
0ebe7b6d
...
...
@@ -423,12 +423,6 @@ extern "C" void _Py_ReleaseInternedStrings() noexcept {
interned_strings
.
clear
();
}
extern
"C"
int
_PyString_CheckInterned
(
PyObject
*
p
)
noexcept
{
RELEASE_ASSERT
(
PyString_Check
(
p
),
""
);
BoxedString
*
s
=
(
BoxedString
*
)
p
;
return
s
->
interned_state
;
}
/* Format codes
* F_LJUST '-'
* F_SIGN '+'
...
...
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