diff --git a/guide/src/SUMMARY.md b/guide/src/SUMMARY.md index 24bc9689..64515c6e 100644 --- a/guide/src/SUMMARY.md +++ b/guide/src/SUMMARY.md @@ -8,5 +8,6 @@ - [Python Class](class.md) - [Parallelism](parallelism.md) - [Debugging](debugging.md) +- [Advanced Topics](advanced.md) - [Building and Distribution](building-and-distribution.md) - [Appendix: Pyo3 and rust-cpython](rust-cpython.md) diff --git a/guide/src/advanced.md b/guide/src/advanced.md new file mode 100644 index 00000000..7c47505a --- /dev/null +++ b/guide/src/advanced.md @@ -0,0 +1,7 @@ +# Advanced topics + +## ffi + +pyo3 exposes much of python's c api through the `ffi`. + +The c api is naturually unsafe and requires you to manage reference counts, errors and specific invariants yourself. Please refer to the [C API Reference Manual](https://docs.python.org/3/c-api/) and [The Rustonomicon](https://doc.rust-lang.org/nightly/nomicon/ffi.html) before using any function from that api. \ No newline at end of file diff --git a/guide/src/debugging.md b/guide/src/debugging.md index b268a155..c1699922 100644 --- a/guide/src/debugging.md +++ b/guide/src/debugging.md @@ -29,3 +29,12 @@ Activate an environment with the debug interpreter and recompile. If you're on l [Download the suppressions file for cpython](https://raw.githubusercontent.com/python/cpython/master/Misc/valgrind-python.supp). Run valgrind with `valgrind --suppressions=valgrind-python.supp ./my-command --with-options` + +## Getting a stacktrace + +The best start to investigate a crash such as an segmentation fault is a backtrace. + + * Link against a debug build of python as described in the previous chapter + * Run `gdb ` + * Enter `r` to run + * After the crash occured, enter `bt` or `bt full` to print the stacktrace \ No newline at end of file