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
Gwenaël Samain
cython
Commits
6ff3b8e2
Commit
6ff3b8e2
authored
Aug 05, 2011
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More Py2.3 cleanup.
parent
517c36d5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
86 deletions
+11
-86
Cython/Compiler/Builtin.py
Cython/Compiler/Builtin.py
+8
-72
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+1
-1
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+1
-8
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-5
No files found.
Cython/Compiler/Builtin.py
View file @
6ff3b8e2
...
...
@@ -127,14 +127,6 @@ bad:
pyexec_utility_code
=
UtilityCode
(
proto
=
"""
#if PY_VERSION_HEX < 0x02040000
#ifndef Py_COMPILE_H
#include "compile.h"
#endif
#ifndef Py_EVAL_H
#include "eval.h"
#endif
#endif
static PyObject* __Pyx_PyRun(PyObject*, PyObject*, PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyRun2(PyObject*, PyObject*);
"""
,
...
...
@@ -234,12 +226,7 @@ static PyObject* __Pyx_Intern(PyObject* s) {
}
'''
)
def
put_py23_set_init_utility_code
(
code
,
pos
):
code
.
putln
(
"#if PY_VERSION_HEX < 0x02040000"
)
code
.
putln
(
code
.
error_goto_if_neg
(
"__Pyx_Py23SetsImport()"
,
pos
))
code
.
putln
(
"#endif"
)
py23_set_utility_code
=
UtilityCode
(
py_set_utility_code
=
UtilityCode
(
proto
=
"""
#if PY_VERSION_HEX < 0x02050000
#ifndef PyAnySet_CheckExact
...
...
@@ -282,64 +269,13 @@ static CYTHON_INLINE int PySet_Add(PyObject *set, PyObject *key) {
}
#endif /* PyAnySet_CheckExact (<= Py2.4) */
#if PY_VERSION_HEX < 0x02040000
#ifndef Py_SETOBJECT_H
#define Py_SETOBJECT_H
static PyTypeObject *__Pyx_PySet_Type = NULL;
static PyTypeObject *__Pyx_PyFrozenSet_Type = NULL;
#define PySet_Type (*__Pyx_PySet_Type)
#define PyFrozenSet_Type (*__Pyx_PyFrozenSet_Type)
#define PyAnySet_Check(ob)
\
\
(PyAnySet_CheckExact(ob) ||
\
\
PyType_IsSubtype((ob)->ob_type, &PySet_Type) ||
\
\
PyType_IsSubtype((ob)->ob_type, &PyFrozenSet_Type))
#define PyFrozenSet_CheckExact(ob) ((ob)->ob_type == &PyFrozenSet_Type)
static int __Pyx_Py23SetsImport(void) {
PyObject *sets=0, *Set=0, *ImmutableSet=0;
sets = PyImport_ImportModule((char *)"sets");
if (!sets) goto bad;
Set = PyObject_GetAttrString(sets, (char *)"Set");
if (!Set) goto bad;
ImmutableSet = PyObject_GetAttrString(sets, (char *)"ImmutableSet");
if (!ImmutableSet) goto bad;
Py_DECREF(sets);
__Pyx_PySet_Type = (PyTypeObject*) Set;
__Pyx_PyFrozenSet_Type = (PyTypeObject*) ImmutableSet;
return 0;
bad:
Py_XDECREF(sets);
Py_XDECREF(Set);
Py_XDECREF(ImmutableSet);
return -1;
}
#else
static int __Pyx_Py23SetsImport(void) { return 0; }
#endif /* !Py_SETOBJECT_H */
#endif /* < Py2.4 */
#endif /* < Py2.5 */
"""
,
init
=
put_py23_set_init_utility_code
,
cleanup
=
"""
#if PY_VERSION_HEX < 0x02040000
Py_XDECREF(__Pyx_PySet_Type); __Pyx_PySet_Type = NULL;
Py_XDECREF(__Pyx_PyFrozenSet_Type); __Pyx_PyFrozenSet_Type = NULL;
#endif /* < Py2.4 */
"""
)
)
builtin_utility_code
=
{
'set'
:
py
23
_set_utility_code
,
'frozenset'
:
py
23
_set_utility_code
,
'set'
:
py_set_utility_code
,
'frozenset'
:
py_set_utility_code
,
}
...
...
@@ -529,13 +465,13 @@ builtin_types_table = [
# ("file", "PyFile_Type", []), # not in Py3
(
"set"
,
"PySet_Type"
,
[
BuiltinMethod
(
"clear"
,
"T"
,
"r"
,
"PySet_Clear"
,
utility_code
=
py
23
_set_utility_code
),
utility_code
=
py_set_utility_code
),
BuiltinMethod
(
"discard"
,
"TO"
,
"r"
,
"PySet_Discard"
,
utility_code
=
py
23
_set_utility_code
),
utility_code
=
py_set_utility_code
),
BuiltinMethod
(
"add"
,
"TO"
,
"r"
,
"PySet_Add"
,
utility_code
=
py
23
_set_utility_code
),
utility_code
=
py_set_utility_code
),
BuiltinMethod
(
"pop"
,
"T"
,
"O"
,
"PySet_Pop"
,
utility_code
=
py
23
_set_utility_code
)]),
utility_code
=
py_set_utility_code
)]),
(
"frozenset"
,
"PyFrozenSet_Type"
,
[]),
]
...
...
Cython/Compiler/ExprNodes.py
View file @
6ff3b8e2
...
...
@@ -4720,7 +4720,7 @@ class SetNode(ExprNode):
self
.
compile_time_value_error
(
e
)
def
generate_evaluation_code
(
self
,
code
):
code
.
globalstate
.
use_utility_code
(
Builtin
.
py
23
_set_utility_code
)
code
.
globalstate
.
use_utility_code
(
Builtin
.
py_set_utility_code
)
self
.
allocate_temp_result
(
code
)
code
.
putln
(
"%s = PySet_New(0); %s"
%
(
...
...
Cython/Compiler/ModuleNode.py
View file @
6ff3b8e2
...
...
@@ -483,8 +483,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code
.
putln
(
'#include "%s"'
%
filename
)
code
.
putln
(
"#ifndef Py_PYTHON_H"
)
code
.
putln
(
" #error Python headers needed to compile C extensions, please install development version of Python."
)
code
.
putln
(
"#else"
)
code
.
putln
(
"#if PY_VERSION_HEX < 0x02040000"
)
code
.
putln
(
"#elif PY_VERSION_HEX < 0x02040000"
)
code
.
putln
(
" #error Cython requires Python 2.4+."
)
code
.
putln
(
"#else"
)
code
.
globalstate
[
"end"
].
putln
(
"#endif /* Py_PYTHON_H */"
)
...
...
@@ -518,12 +517,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
#define PY_LONG_LONG LONG_LONG
#endif
#if PY_VERSION_HEX < 0x02040000
#define METH_COEXIST 0
#define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
#define PyDict_Contains(d,o) PySequence_Contains(d,o)
#endif
#if PY_VERSION_HEX < 0x02050000
typedef int Py_ssize_t;
#define PY_SSIZE_T_MAX INT_MAX
...
...
Cython/Compiler/Nodes.py
View file @
6ff3b8e2
...
...
@@ -7920,11 +7920,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
force_init_threads_utility_code
=
UtilityCode
(
proto
=
"""
#ifndef __PYX_FORCE_INIT_THREADS
#if PY_VERSION_HEX < 0x02040200
#define __PYX_FORCE_INIT_THREADS 1
#else
#define __PYX_FORCE_INIT_THREADS 0
#endif
#define __PYX_FORCE_INIT_THREADS 0
#endif
"""
)
...
...
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