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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
cb43ff30
Commit
cb43ff30
authored
Dec 23, 2014
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #349 from larsmans/cleanup
Minor cleanup (2.5 compat, mostly)
parents
77c43a1d
dc7684e0
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
6 additions
and
84 deletions
+6
-84
Cython/Utility/CythonFunction.c
Cython/Utility/CythonFunction.c
+0
-4
Cython/Utility/TypeConversion.c
Cython/Utility/TypeConversion.c
+1
-1
docs/src/reference/special_methods_table.rst
docs/src/reference/special_methods_table.rst
+1
-1
docs/src/userguide/debugging.rst
docs/src/userguide/debugging.rst
+1
-1
runtests.py
runtests.py
+0
-18
setup.py
setup.py
+2
-5
tests/run/generators.pyx
tests/run/generators.pyx
+0
-11
tests/run/unportable_capi_functions.pyx
tests/run/unportable_capi_functions.pyx
+0
-37
tests/run/yield_from_pep380.pyx
tests/run/yield_from_pep380.pyx
+1
-6
No files found.
Cython/Utility/CythonFunction.c
View file @
cb43ff30
...
@@ -403,10 +403,6 @@ static PyGetSetDef __pyx_CyFunction_getsets[] = {
...
@@ -403,10 +403,6 @@ static PyGetSetDef __pyx_CyFunction_getsets[] = {
{
0
,
0
,
0
,
0
,
0
}
{
0
,
0
,
0
,
0
,
0
}
};
};
#ifndef PY_WRITE_RESTRICTED
/* < Py2.5 */
#define PY_WRITE_RESTRICTED WRITE_RESTRICTED
#endif
static
PyMemberDef
__pyx_CyFunction_members
[]
=
{
static
PyMemberDef
__pyx_CyFunction_members
[]
=
{
{(
char
*
)
"__module__"
,
T_OBJECT
,
offsetof
(
__pyx_CyFunctionObject
,
func
.
m_module
),
PY_WRITE_RESTRICTED
,
0
},
{(
char
*
)
"__module__"
,
T_OBJECT
,
offsetof
(
__pyx_CyFunctionObject
,
func
.
m_module
),
PY_WRITE_RESTRICTED
,
0
},
{
0
,
0
,
0
,
0
,
0
}
{
0
,
0
,
0
,
0
,
0
}
...
...
Cython/Utility/TypeConversion.c
View file @
cb43ff30
...
@@ -78,7 +78,7 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) {
...
@@ -78,7 +78,7 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) {
const
char
*
default_encoding_c
;
const
char
*
default_encoding_c
;
sys
=
PyImport_ImportModule
(
"sys"
);
sys
=
PyImport_ImportModule
(
"sys"
);
if
(
!
sys
)
goto
bad
;
if
(
!
sys
)
goto
bad
;
default_encoding
=
PyObject_CallMethod
(
sys
,
(
char
*
)
(
const
char
*
)
"getdefaultencoding"
,
NULL
);
default_encoding
=
PyObject_CallMethod
(
sys
,
(
char
*
)
"getdefaultencoding"
,
NULL
);
Py_DECREF
(
sys
);
Py_DECREF
(
sys
);
if
(
!
default_encoding
)
goto
bad
;
if
(
!
default_encoding
)
goto
bad
;
default_encoding_c
=
PyBytes_AsString
(
default_encoding
);
default_encoding_c
=
PyBytes_AsString
(
default_encoding
);
...
...
docs/src/reference/special_methods_table.rst
View file @
cb43ff30
...
@@ -107,7 +107,7 @@ Numeric conversions
...
@@ -107,7 +107,7 @@ Numeric conversions
+-----------------------+---------------------------------------+-------------+-----------------------------------------------------+
+-----------------------+---------------------------------------+-------------+-----------------------------------------------------+
| __hex__ | self | object | Convert to hexadecimal |
| __hex__ | self | object | Convert to hexadecimal |
+-----------------------+---------------------------------------+-------------+-----------------------------------------------------+
+-----------------------+---------------------------------------+-------------+-----------------------------------------------------+
| __index__
(2.5+ only)
| self | object | Convert to sequence index |
| __index__
| self | object | Convert to sequence index |
+-----------------------+---------------------------------------+-------------+-----------------------------------------------------+
+-----------------------+---------------------------------------+-------------+-----------------------------------------------------+
In-place arithmetic operators
In-place arithmetic operators
...
...
docs/src/userguide/debugging.rst
View file @
cb43ff30
...
@@ -8,7 +8,7 @@ Debugging your Cython program
...
@@ -8,7 +8,7 @@ Debugging your Cython program
Cython
comes
with
an
extension
for
the
GNU
Debugger
that
helps
users
debug
Cython
comes
with
an
extension
for
the
GNU
Debugger
that
helps
users
debug
Cython
code
.
To
use
this
functionality
,
you
will
need
to
install
gdb
7.2
or
Cython
code
.
To
use
this
functionality
,
you
will
need
to
install
gdb
7.2
or
higher
,
built
with
Python
support
(
linked
to
Python
2.
5
or
higher
).
higher
,
built
with
Python
support
(
linked
to
Python
2.
6
or
higher
).
The
debugger
supports
debuggees
with
versions
2.6
and
higher
.
For
Python
3
,
The
debugger
supports
debuggees
with
versions
2.6
and
higher
.
For
Python
3
,
code
should
be
built
with
Python
3
and
the
debugger
should
be
run
with
code
should
be
built
with
Python
3
and
the
debugger
should
be
run
with
Python
2
(
or
at
least
it
should
be
able
to
find
the
Python
2
Cython
Python
2
(
or
at
least
it
should
be
able
to
find
the
Python
2
Cython
...
...
runtests.py
View file @
cb43ff30
...
@@ -292,24 +292,6 @@ def _is_py3_before_32(excluded, version):
...
@@ -292,24 +292,6 @@ def _is_py3_before_32(excluded, version):
VER_DEP_MODULES = {
VER_DEP_MODULES = {
# tests are excluded if 'CurrentPythonVersion OP VersionTuple', i.e.
# tests are excluded if 'CurrentPythonVersion OP VersionTuple', i.e.
# (2,4) : (operator.lt, ...) excludes ... when PyVer < 2.4.x
# (2,4) : (operator.lt, ...) excludes ... when PyVer < 2.4.x
(2,4) : (operator.lt, lambda x: x in ['run.extern_builtins_T258',
'run.builtin_sorted',
'run.reversed_iteration',
]),
(2,5) : (operator.lt, lambda x: x in ['run.any',
'run.all',
'run.yield_from_pep380', # GeneratorExit
'run.generator_frame_cycle', # yield in try-finally
'run.generator_expressions_in_class',
'run.absolute_import',
'run.relativeimport_T542',
'run.relativeimport_star_T542',
'run.initial_file_path', # relative import
'run.pynumber_subtype_conversion', # bug in Py2.4
'build.cythonize_script', # python2.4 -m a.b.c
'build.cythonize_script_excludes', # python2.4 -m a.b.c
'build.cythonize_script_package', # python2.4 -m a.b.c
]),
(2,6) : (operator.lt, lambda x: x in ['run.print_function',
(2,6) : (operator.lt, lambda x: x in ['run.print_function',
'run.language_level', # print function
'run.language_level', # print function
'run.cython3',
'run.cython3',
...
...
setup.py
View file @
cb43ff30
...
@@ -6,11 +6,8 @@ except ImportError:
...
@@ -6,11 +6,8 @@ except ImportError:
import
os
import
os
import
sys
import
sys
try
:
import
platform
import
platform
is_cpython
=
platform
.
python_implementation
()
==
'CPython'
is_cpython
=
not
hasattr
(
platform
,
'python_implementation'
)
or
platform
.
python_implementation
()
==
'CPython'
except
(
ImportError
,
NameError
):
is_cpython
=
True
# CPython < 2.6
if
sys
.
platform
==
"darwin"
:
if
sys
.
platform
==
"darwin"
:
# Don't create resource files on OS X tar.
# Don't create resource files on OS X tar.
...
...
tests/run/generators.pyx
View file @
cb43ff30
# mode: run
# mode: run
# tag: generators
# tag: generators
try
:
from
builtins
import
next
# Py3k
except
ImportError
:
def
next
(
it
):
return
it
.
next
()
if
hasattr
(
__builtins__
,
'GeneratorExit'
):
GeneratorExit
=
__builtins__
.
GeneratorExit
else
:
# < 2.5
GeneratorExit
=
StopIteration
def
very_simple
():
def
very_simple
():
"""
"""
>>> x = very_simple()
>>> x = very_simple()
...
...
tests/run/unportable_capi_functions.pyx
deleted
100644 → 0
View file @
77c43a1d
# mode: run
# tag: portability
# test some C-API functions that Cython replaces for portability reasons
from
cpython.number
cimport
PyNumber_Index
,
PyIndex_Check
def
number_index
(
x
):
"""
>>> number_index(1)
1
>>> try: number_index(1.1)
... except TypeError: pass
... else: print("FAILED")
>>> try: number_index(1j)
... except TypeError: pass
... else: print("FAILED")
>>> try: number_index('abc')
... except TypeError: pass
... else: print("FAILED")
"""
# was not available in Py2.4
return
PyNumber_Index
(
x
)
def
index_check
(
x
):
"""
>>> index_check(1)
True
>>> index_check(1.1)
False
>>> index_check(1j)
False
>>> index_check('abc')
False
"""
# was not available in Py2.4
return
PyIndex_Check
(
x
)
tests/run/yield_from_pep380.pyx
View file @
cb43ff30
...
@@ -9,11 +9,6 @@ see <http://www.cosc.canterbury.ac.nz/greg.ewing/python/yield-from/YieldFrom-Pyt
...
@@ -9,11 +9,6 @@ see <http://www.cosc.canterbury.ac.nz/greg.ewing/python/yield-from/YieldFrom-Pyt
import
sys
import
sys
try
:
_next
=
next
# not in Py<=2.5
except
NameError
:
def
_next
(
it
):
return
it
.
next
()
def
_lines
(
trace
):
def
_lines
(
trace
):
for
line
in
trace
:
for
line
in
trace
:
...
@@ -1018,7 +1013,7 @@ def yield_in_return(x):
...
@@ -1018,7 +1013,7 @@ def yield_in_return(x):
>>> x = yield_in_return(range(3))
>>> x = yield_in_return(range(3))
>>> for _ in range(10):
>>> for _ in range(10):
... try:
... try:
... print(
_
next(x))
... print(next(x))
... except StopIteration:
... except StopIteration:
... if sys.version_info >= (3,3):
... if sys.version_info >= (3,3):
... print(sys.exc_info()[1].value is None)
... print(sys.exc_info()[1].value is None)
...
...
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