- 25 Jan, 2013 1 commit
-
-
Matěj Laitl authored
For a source: |cdef extern from "<foo>": | cdef void foo_cpp() nogil except + | |cdef call_foo() nogil: | foo_cpp() We used to generate something like this to actually call foo_cpp() in call_foo(): |try{foo_cpp();} |catch(...) { | Py_BLOCK_THREADS; __Pyx_CppExn2PyErr(); Py_UNBLOCK_THREADS | `code.error_goto(self.pos))` |} where Py_BLOCK_THREADS expands to "PyEval_RestoreThread(_save);". __Pyx_CppExn2PyErr() (and alternatives, see SimpleCallNode) calls CPython A API methods so it needs to be guarded in a nogil environment. One problem is that "PyThreadState *_save" is only declared by "with nogil:" block, so a .cpp file that doesn't compile is generated for the above code. However, I think the real issue is that Py_(UN)BLOCK_THREADS is inappropriate here, as it isn't allowed to be called recursively and is valid only directly in a Py_BEGIN_ALLOW_THREADS ... Py_END_ALLOW_THREADS. IMO PyGILState_Ensure() and PyGILState_Release() (through `code.put_ensure_gil()` and a friend) is the correct thing to call here as it is allowed to be called recursively and actually ensures the current thread can call CPython C API. This patch does exactly this (and it breaks the generated code to multiple lines as it would be way too long otherwise), plus it extends the cpp_exceptions_nogil.pyx test with above example that doesn't compile with this fix not applied. Note that we explicitly pass declare_gilstate=True to put_ensure_gil(), as PyGILState_Ensure() docs state that recursive calls to it must not share the PyGILState_STATE. C++-style declaring a variable inside a block should be no-problem here, as try{} .. catch() is obviously valid only in a C++ code.
-
- 22 Jan, 2013 1 commit
-
-
Robert Bradshaw authored
fix indentation error in userguide
-
- 21 Jan, 2013 7 commits
-
-
Lars Buitinck authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
- 20 Jan, 2013 6 commits
-
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
move exception class into shadow function as we may not want to export it under the cython.* namespace at this point
-
- 19 Jan, 2013 4 commits
-
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
removed broken minivect related code from branch since minivect will not be released as part of 0.18
-
- 18 Jan, 2013 13 commits
-
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Robert Bradshaw authored
fix import of pyx modules when '' is in sys.path
-
- 16 Jan, 2013 2 commits
-
-
Steinn Steinsen authored
If '' is in sys.path and a module is found the package_path is relative and breaks the build process.
-
Steinn Steinsen authored
If '' is in sys.path and a module is found the package_path is relative and breaks the build process. --HG-- extra : transplant_source : 9%EA%CC%A6%3D%1B9R%EF%0DmM%CFZ%18%F3%EC%06%3B%B7
-
- 15 Jan, 2013 2 commits
-
-
Robert Bradshaw authored
Use OS-dependent directory separator - a / on windows is interpreted by ...
-
Steven Winfield authored
Use OS-dependent directory separator - a / on windows is interpreted by LINK as a command line switch --HG-- extra : transplant_source : %A8%F23%AF%26%BC%82y1%86S%1Ac%D3%40%089o%DCQ
-
- 18 Jan, 2013 3 commits
-
-
Stefan Behnel authored
--HG-- extra : transplant_source : %E6%CA%F8%11%E8%81u%B9%95%3D%27%C1%0F%F3O%8A%12%3Cnl
-
Stefan Behnel authored
--HG-- extra : transplant_source : U%15%0B%8E%81%02%F2kE%AA%07u%EF%82%3D14%F1C%86
-
Stefan Behnel authored
--HG-- extra : transplant_source : H%91%CF%08t%B1%908%AE%26%81%1B%F9%2C%9A%3Fh%ECWK
-
- 15 Jan, 2013 1 commit
-
-
Steven Winfield authored
Use OS-dependent directory separator - a / on windows is interpreted by LINK as a command line switch
-