Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
3fdd71a9
Commit
3fdd71a9
authored
Sep 13, 2017
by
scoder
Committed by
GitHub
Sep 13, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1871 from rlamy/pypy3-fixes
PyPy 3 fixes
parents
e6315294
d6f0b23a
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
38 additions
and
28 deletions
+38
-28
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+1
-1
Cython/Utility/AsyncGen.c
Cython/Utility/AsyncGen.c
+2
-2
Cython/Utility/Coroutine.c
Cython/Utility/Coroutine.c
+4
-4
Cython/Utility/ModuleSetupCode.c
Cython/Utility/ModuleSetupCode.c
+13
-2
Cython/Utility/ObjectHandling.c
Cython/Utility/ObjectHandling.c
+0
-3
Cython/Utility/Optimize.c
Cython/Utility/Optimize.c
+12
-10
tests/build/cythonize_script.srctree
tests/build/cythonize_script.srctree
+3
-3
tests/build/cythonize_script_package.srctree
tests/build/cythonize_script_package.srctree
+1
-1
tests/build/package_compilation.srctree
tests/build/package_compilation.srctree
+2
-2
No files found.
Cython/Compiler/ModuleNode.py
View file @
3fdd71a9
...
...
@@ -1408,7 +1408,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
if
not
is_final_type
:
# in Py3.4+, call tp_finalize() as early as possible
code
.
putln
(
"#if
PY_VERSION_HEX >= 0x030400a1
"
)
code
.
putln
(
"#if
CYTHON_USE_TP_FINALIZE
"
)
if
needs_gc
:
finalised_check
=
'!_PyGC_FINALIZED(o)'
else
:
...
...
Cython/Utility/AsyncGen.c
View file @
3fdd71a9
...
...
@@ -387,13 +387,13 @@ PyTypeObject __pyx_AsyncGenType_type = {
0
,
/* tp_cache */
0
,
/* tp_subclasses */
0
,
/* tp_weaklist */
#if
PY_VERSION_HEX >= 0x030400a1
#if
CYTHON_USE_TP_FINALIZE
0
,
/*tp_del*/
#else
__Pyx_Coroutine_del
,
/*tp_del*/
#endif
0
,
/* tp_version_tag */
#if
PY_VERSION_HEX >= 0x030400a1
#if
CYTHON_USE_TP_FINALIZE
__Pyx_Coroutine_del
,
/* tp_finalize */
#endif
};
...
...
Cython/Utility/Coroutine.c
View file @
3fdd71a9
...
...
@@ -1553,13 +1553,13 @@ static PyTypeObject __pyx_CoroutineType_type = {
0
,
/*tp_cache*/
0
,
/*tp_subclasses*/
0
,
/*tp_weaklist*/
#if
PY_VERSION_HEX >= 0x030400a1
#if
CYTHON_USE_TP_FINALIZE
0
,
/*tp_del*/
#else
__Pyx_Coroutine_del
,
/*tp_del*/
#endif
0
,
/*tp_version_tag*/
#if
PY_VERSION_HEX >= 0x030400a1
#if
CYTHON_USE_TP_FINALIZE
__Pyx_Coroutine_del
,
/*tp_finalize*/
#endif
};
...
...
@@ -1653,13 +1653,13 @@ static PyTypeObject __pyx_GeneratorType_type = {
0
,
/*tp_cache*/
0
,
/*tp_subclasses*/
0
,
/*tp_weaklist*/
#if
PY_VERSION_HEX >= 0x030400a1
#if
CYTHON_USE_TP_FINALIZE
0
,
/*tp_del*/
#else
__Pyx_Coroutine_del
,
/*tp_del*/
#endif
0
,
/*tp_version_tag*/
#if
PY_VERSION_HEX >= 0x030400a1
#if
CYTHON_USE_TP_FINALIZE
__Pyx_Coroutine_del
,
/*tp_finalize*/
#endif
};
...
...
Cython/Utility/ModuleSetupCode.c
View file @
3fdd71a9
...
...
@@ -51,8 +51,12 @@
#define CYTHON_USE_TYPE_SLOTS 0
#undef CYTHON_USE_PYTYPE_LOOKUP
#define CYTHON_USE_PYTYPE_LOOKUP 0
#undef CYTHON_USE_ASYNC_SLOTS
#define CYTHON_USE_ASYNC_SLOTS 0
#if PY_VERSION_HEX < 0x03050000
#undef CYTHON_USE_ASYNC_SLOTS
#define CYTHON_USE_ASYNC_SLOTS 0
#elif !defined(CYTHON_USE_ASYNC_SLOTS)
#define CYTHON_USE_ASYNC_SLOTS 1
#endif
#undef CYTHON_USE_PYLIST_INTERNALS
#define CYTHON_USE_PYLIST_INTERNALS 0
#undef CYTHON_USE_UNICODE_INTERNALS
...
...
@@ -73,6 +77,8 @@
#define CYTHON_FAST_PYCALL 0
#undef CYTHON_PEP489_MULTI_PHASE_INIT
#define CYTHON_PEP489_MULTI_PHASE_INIT 0
#undef CYTHON_USE_TP_FINALIZE
#define CYTHON_USE_TP_FINALIZE 0
#elif defined(PYSTON_VERSION)
#define CYTHON_COMPILING_IN_PYPY 0
...
...
@@ -110,6 +116,8 @@
#define CYTHON_FAST_PYCALL 0
#undef CYTHON_PEP489_MULTI_PHASE_INIT
#define CYTHON_PEP489_MULTI_PHASE_INIT 0
#undef CYTHON_USE_TP_FINALIZE
#define CYTHON_USE_TP_FINALIZE 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
...
...
@@ -168,6 +176,9 @@
#ifndef CYTHON_PEP489_MULTI_PHASE_INIT
#define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
#endif
#ifndef CYTHON_USE_TP_FINALIZE
#define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
#endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
...
...
Cython/Utility/ObjectHandling.c
View file @
3fdd71a9
...
...
@@ -116,7 +116,6 @@ static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
return
0
;
#if CYTHON_COMPILING_IN_PYPY
bad:
Py_XDECREF
(
iter
);
Py_XDECREF
(
value1
);
Py_XDECREF
(
value2
);
if
(
decref_tuple
)
{
Py_XDECREF
(
tuple
);
}
...
...
@@ -187,12 +186,10 @@ static PyObject *__Pyx_PyIter_Next2Default(PyObject* defval) {
return
NULL
;
}
#if CYTHON_USE_TYPE_SLOTS
static
void
__Pyx_PyIter_Next_ErrorNoIterator
(
PyObject
*
iterator
)
{
PyErr_Format
(
PyExc_TypeError
,
"%.200s object is not an iterator"
,
Py_TYPE
(
iterator
)
->
tp_name
);
}
#endif
// originally copied from Py3's builtin_next()
static
CYTHON_INLINE
PyObject
*
__Pyx_PyIter_Next2
(
PyObject
*
iterator
,
PyObject
*
defval
)
{
...
...
Cython/Utility/Optimize.c
View file @
3fdd71a9
...
...
@@ -294,18 +294,20 @@ static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_di
// On PyPy3, we need to translate manually a few method names.
// This logic is not needed on CPython thanks to the fast case above.
static
PyObject
*
py_items
=
NULL
,
*
py_keys
=
NULL
,
*
py_values
=
NULL
;
const
char
*
name
=
PyUnicode_AsUTF8
(
method_name
);
PyObject
**
pp
=
NULL
;
if
(
strcmp
(
name
,
"iteritems"
)
==
0
)
pp
=
&
py_items
;
else
if
(
strcmp
(
name
,
"iterkeys"
)
==
0
)
pp
=
&
py_keys
;
else
if
(
strcmp
(
name
,
"itervalues"
)
==
0
)
pp
=
&
py_values
;
if
(
pp
)
{
if
(
!*
pp
)
{
*
pp
=
PyUnicode_FromString
(
name
+
4
);
if
(
!*
pp
)
return
NULL
;
if
(
method_name
)
{
const
char
*
name
=
PyUnicode_AsUTF8
(
method_name
);
if
(
strcmp
(
name
,
"iteritems"
)
==
0
)
pp
=
&
py_items
;
else
if
(
strcmp
(
name
,
"iterkeys"
)
==
0
)
pp
=
&
py_keys
;
else
if
(
strcmp
(
name
,
"itervalues"
)
==
0
)
pp
=
&
py_values
;
if
(
pp
)
{
if
(
!*
pp
)
{
*
pp
=
PyUnicode_FromString
(
name
+
4
);
if
(
!*
pp
)
return
NULL
;
}
method_name
=
*
pp
;
}
method_name
=
*
pp
;
}
#endif
}
...
...
tests/build/cythonize_script.srctree
View file @
3fdd71a9
'''
PYTHON -m Cython.Build.Cythonize -i '**/*_test.py'
PYTHON -c "import cy_test; assert cy_test.TEST == 'cy_test', cy_test.TEST; assert
'.py' not in cy_test.__file__
, cy_test.__file__"
PYTHON -c "import pkg.cy_test; assert pkg.cy_test.TEST == 'pkg.cy_test', pkg.cy_test.TEST; assert
'.py' not in pkg.cy_test.__file__
, pkg.cy_test.__file__"
PYTHON -c "import pkg.sub.cy_test; assert pkg.sub.cy_test.TEST == 'pkg.sub.cy_test', pkg.sub.cy_test.TEST; assert
'.py' not in pkg.sub.cy_test.__file__
, pkg.cy_test.__file__"
PYTHON -c "import cy_test; assert cy_test.TEST == 'cy_test', cy_test.TEST; assert
not cy_test.__file__.rstrip('oc').endswith('.py')
, cy_test.__file__"
PYTHON -c "import pkg.cy_test; assert pkg.cy_test.TEST == 'pkg.cy_test', pkg.cy_test.TEST; assert
not pkg.cy_test.__file__.rstrip('oc').endswith('.py')
, pkg.cy_test.__file__"
PYTHON -c "import pkg.sub.cy_test; assert pkg.sub.cy_test.TEST == 'pkg.sub.cy_test', pkg.sub.cy_test.TEST; assert
not pkg.sub.cy_test.__file__.rstrip('oc').endswith('.py')
, pkg.cy_test.__file__"
'''
######## cy_test.py ########
...
...
tests/build/cythonize_script_package.srctree
View file @
3fdd71a9
...
...
@@ -11,7 +11,7 @@ if sys.version_info[0] < 3 or sys.version_info >= (3,3):
# __init__.py compilation isn't supported in Py 3.[012]
import pkg.sub.test
assert pkg.sub.test.TEST == 'pkg.sub.test'
assert
'.py' not in pkg.sub.test.__file__
assert
not pkg.sub.test.__file__.rstrip('oc').endswith('.py')
######## test.py ########
...
...
tests/build/package_compilation.srctree
View file @
3fdd71a9
PYTHON setup.py build_ext --inplace
PYTHON -c "import toppkg; assert
'.py' not in toppkg.__file__
; assert toppkg.PACKAGE == 1"
PYTHON -c "import toppkg.subpkg; assert
'.py' not in toppkg.__file__; assert '.py' not in toppkg.subpkg.__file__
; assert toppkg.subpkg.PACKAGE == 2"
PYTHON -c "import toppkg; assert
not toppkg.__file__.rstrip('oc').endswith('.py')
; assert toppkg.PACKAGE == 1"
PYTHON -c "import toppkg.subpkg; assert
not toppkg.__file__.rstrip('oc').endswith('.py'); assert not toppkg.subpkg.__file__.rstrip('oc').endswith('.py')
; assert toppkg.subpkg.PACKAGE == 2"
PYTHON -c "import toppkg.a; assert toppkg.a.MODULE == 'a'"
PYTHON -c "from toppkg.subpkg import a; assert a.MODULE == 'subpkg.a'"
...
...
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