Commit 6965934d authored by Stefan Behnel's avatar Stefan Behnel

merge

parents 32b1a50f c37a4543
......@@ -27,6 +27,9 @@ Options:
performing any binary operations.
--cleanup <level> Release interned objects on python exit, for memory debugging.
Level indicates aggressiveness, default 0 releases nothing.
-w, --working <directory> Sets the working directory for Cython (the directory modules
are searched from)
-D, --no-docstrings Remove docstrings.
-a, --annotate Produce an colorized version of the source.
--convert-range Convert for loops using range() function to for...from loops.
......@@ -104,6 +107,8 @@ def parse_command_line(args):
options.include_path.append(get_param(option))
elif option == "--include-dir":
options.include_path.append(pop_arg())
elif option in ("-w", "--working"):
options.working_path = pop_arg()
elif option in ("-o", "--output-file"):
options.output_file = pop_arg()
elif option in ("-p", "--embed-positions"):
......
......@@ -4083,9 +4083,8 @@ bad:
cpp_exception_utility_code = [
"""
static int __Pyx_CppExn2PyErr(); /*proto*/
""","""
void __Pyx_CppExn2PyErr() {
#ifndef __Pyx_CppExn2PyErr
static void __Pyx_CppExn2PyErr() {
try {
if (PyErr_Occurred())
; // let the latest Python exn pass through and ignore the current one
......@@ -4102,6 +4101,7 @@ void __Pyx_CppExn2PyErr() {
PyErr_SetString(PyExc_RuntimeError, "Unknown exception");
}
}
"""]
#endif
""",""]
#------------------------------------------------------------------------------------
......@@ -328,6 +328,8 @@ def main(command_line = 0):
sources = args
if options.show_version:
sys.stderr.write("Cython version %s\n" % Version.version)
if options.working_path!="":
os.chdir(options.working_path)
context = Context(options.include_path)
for source in sources:
try:
......@@ -355,7 +357,8 @@ default_options = dict(
cplus = 0,
output_file = None,
generate_pxi = 0,
transforms = Transform.TransformSet())
transforms = Transform.TransformSet(),
working_path = "")
if sys.platform == "mac":
from Cython.Mac.MacSystem import c_compile, c_link, CCompilerError
......
......@@ -770,13 +770,14 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
"static void %s(PyObject *o) {"
% scope.mangle_internal("tp_dealloc"))
py_attrs = []
weakref_slot = scope.lookup_here("__weakref__")
for entry in scope.var_entries:
if entry.type.is_pyobject and entry.name != "__weakref__":
if entry.type.is_pyobject and entry is not weakref_slot:
py_attrs.append(entry)
if py_attrs or scope.lookup_here("__weakref__"):
if py_attrs or weakref_slot in scope.var_entries:
self.generate_self_cast(scope, code)
self.generate_usr_dealloc_call(scope, code)
if scope.lookup_here("__weakref__"):
if weakref_slot in scope.var_entries:
code.putln("if (p->__weakref__) PyObject_ClearWeakRefs(o);")
for entry in py_attrs:
code.put_xdecref("p->%s" % entry.cname, entry.type)
......
import glob
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
setup(
name = 'Demos',
ext_modules=[
ext_modules=[
Extension("primes", ["primes.pyx"]),
Extension("spam", ["spam.pyx"]),
# Extension("numeric_demo", ["numeric_demo.pyx"]),
Extension("test", ["test.pyx"]),
Extension("func_pointers", ["func_pointers.pyx"]),
# Extension("inplace", ["inplace.pyx"]),
# Extension("withGIL", ["withGIL.pyx"]),
Extension("class_members", ["class_members.pyx"]),
# Extension("inherit_bug", ["inherit_bug.pyx"]),
Extension("override", ["override.pyx"]),
Extension("cond", ["cond.pyx"]),
# Extension("submodule.test", ["submodule/test.pyx"]),
Extension("errors", ["errors.pyx"]),
Extension("cpdef", ["cpdef.pyx"]),
Extension("range", ["range.pyx"]),
Extension("early_temps", ["early_temps.pyx"]),
Extension("ints", ["ints.pyx"]),
Extension("clear", ["clear.pyx"]),
Extension("detect_override", ["detect_override.pyx"]),
Extension("fixes", ["fixes.pyx"]),
],
]
for file in glob.glob("*.pyx"):
if file != "numeric_demo.pyx":
ext_modules.append(Extension(file[:-4], [file]))
setup(
name = 'Demos',
cmdclass = {'build_ext': build_ext},
# include_dirs = "/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3/"
ext_modules = ext_modules,
)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment