Commit Graph

2572 Commits

Author SHA1 Message Date
David Hewitt f36fb4a08b
Merge pull request #1192 from PyO3/davidhewitt-patch-5
Fix link in changelog
2020-09-16 07:27:36 +01:00
David Hewitt 07f9ae2498
Fix link in changelog
Looks like this just got out of date at some point.
2020-09-15 22:33:30 +01:00
Matthew Treinish a0960f8918
Fix compilation on platforms that don't use i8 for c_char (#1182)
* Fix compilation on platforms that don't use i8 for c_char

This commit changes the cast of an c_char to be a c_char type instead of
i8. On x86 platforms i8 == c_char, but it can also be u8 on other
platforms. [1][2] This should fix compilation on those platforms by just
using the c_char type so that we're casting as the right type regardless
of which platform PyO3 is being built for.

Fixes #1181

[1] https://doc.rust-lang.org/std/os/raw/type.c_char.html
[2] https://github.com/rust-lang/rust/blob/master/library/std/src/os/raw/mod.rs#L55-L99

* Add changelog entry
2020-09-14 11:27:38 +01:00
Yuji Kanagawa 448f0bb738
Merge pull request #1179 from alex/patch-1
Don't consider it cross-compilation when building for 32-bit Windows on 64-bit windows
2020-09-13 15:08:35 +09:00
Alex Gaynor 10f8c24931
Update CHANGELOG.md 2020-09-12 19:41:02 -04:00
Alex Gaynor 8c011620fe
Merge branch 'master' into patch-1 2020-09-12 19:39:54 -04:00
David Hewitt 00a87008dc
Merge pull request #1178 from davidhewitt/fix-changelog-date
Fix date in changelog
2020-09-13 00:35:18 +01:00
Alex Gaynor d530e462f9
Update CHANGELOG.md 2020-09-12 19:19:33 -04:00
Alex Gaynor 62ad53f9fc
Don't consider it cross-compilation when building for 32-bit Windows on 64-bit windows 2020-09-12 19:10:02 -04:00
David Hewitt b7f45c4fbf
Merge pull request #1173 from PyO3/release-0.12
Release 0.12
2020-09-13 00:00:58 +01:00
David Hewitt 5ad89de170 Fix date in changelog 2020-09-12 14:45:20 +01:00
David Hewitt 32be8d9a3c Release 0.12 2020-09-12 14:13:45 +01:00
David Hewitt e3408e802a
Merge pull request #1175 from thatcr/thatcr-fix-anaconda-python
Fix cargo test with Anaconda python, and divergent gcc versions.
2020-09-11 22:00:46 +01:00
Rob Thatcher 118646dd4a update changelog 2020-09-11 17:31:41 +01:00
Rob Thatcher b66a92579c treat Anaconda python as shared 2020-09-11 16:58:33 +01:00
David Hewitt 1489ca2e8d
Merge pull request #1171 from davidhewitt/fix-new-err
Fix build for new apis
2020-09-10 21:59:25 +01:00
David Hewitt c519b4de76 Fix build for new apis 2020-09-10 21:34:00 +01:00
David Hewitt 151af7a0b7
Merge pull request #1115 from davidhewitt/std-py-err
Implement std::error::Error for PyErr
2020-09-10 21:17:11 +01:00
David Hewitt 73507dbf5e
Merge pull request #1163 from sebpuetz/pyfunction
Add native Function types.
2020-09-10 19:05:57 +01:00
David Hewitt b9e95dc7c9 Implement std::error::Error for PyErr 2020-09-10 19:04:24 +01:00
Yuji Kanagawa 53e33aab3c
Merge pull request #1170 from alex/run-code-abi3
Use limited APIs for Py::run_code
2020-09-10 00:01:55 +09:00
Alex Gaynor 97dde18d45 Use limited APIs for Py::run_code 2020-09-09 08:25:40 -04:00
Sebastian Pütz 22881a3c2f Change add_function, ensure static docstrings.
Change add_function to take `&PyCFunction` instead of a wrapper
fn and ensure that dostrings of functions are `&'static str`.
2020-09-09 12:37:37 +02:00
Yuji Kanagawa cc6d266c47
Merge pull request #1168 from alex/set-iter-bench
Added a benchmark for set iter
2020-09-09 16:48:47 +09:00
Alex Gaynor c54b35f297 Added a benchmark for set iter 2020-09-08 17:47:49 -04:00
Sebastian Pütz be877d133f Add constructor for PyCFunction. 2020-09-08 14:26:08 +02:00
Yuji Kanagawa b2ba83a62f
Merge pull request #1133 from birkenfeld/string-apis
Avoid using CString where unnecessary
2020-09-08 17:57:26 +09:00
Georg Brandl 466ffeaf9f Avoid using CString where unnecessary
Use APIs that take a Python string instead of those taking a C string,
which are a convenience in C but require an unncessary allocation
for us.
2020-09-08 10:34:33 +02:00
Sebastian Pütz 2e8010b5df Add native Function native types.
Add bindings for PyCFunction, PyFunction, PyClassMethod and
PyStaticMethod.
2020-09-08 09:51:31 +02:00
David Hewitt 16fe583b82
Merge pull request #1143 from sebpuetz/pyfunction-modules
PyModule in #[pyfunction]
2020-09-06 20:55:29 +01:00
David Hewitt 05d86b76f8
Merge pull request #1159 from alex/patch-1
Don't run a test of PyFloat_AS_DOUBLE when using the limited API
2020-09-06 20:52:56 +01:00
David Hewitt a1d6c7a838
Merge pull request #1157 from davidhewitt/conversion-detail
docs: add detail to wrapper type conversions
2020-09-06 20:52:34 +01:00
Alex Gaynor 049a8c297b
Don't run a test of PyFloat_AS_DOUBLE when using the limited API 2020-09-06 10:32:19 -04:00
Yuji Kanagawa 6a2d4f2ac0
Merge pull request #1150 from davidhewitt/changelog-in-guide
Add CHANGELOG to the guide
2020-09-06 22:55:10 +09:00
David Hewitt 4ba30cf174
Merge pull request #1155 from PyO3/dependabot/cargo/hashbrown-0.9
Update hashbrown requirement from 0.8 to 0.9
2020-09-06 10:26:26 +01:00
David Hewitt 192c2c2b2c docs: add detail to wrapper type conversions 2020-09-06 10:21:08 +01:00
dependabot[bot] 6f80a8eaa3
Update hashbrown requirement from 0.8 to 0.9
Updates the requirements on [hashbrown](https://github.com/rust-lang/hashbrown) to permit the latest version.
- [Release notes](https://github.com/rust-lang/hashbrown/releases)
- [Changelog](https://github.com/rust-lang/hashbrown/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/hashbrown/compare/v0.8.0...v0.9.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-06 04:50:18 +00:00
Matthew Treinish c830a7cc57
Add dependabot config (#1148)
* Add dependabot config

This commit adds a dependabot config to automatically open pull requests
with version bumps for dependencies. This will configure dependabot to
check daily if any pyo3 dependency versions are out of date and if they
are it will open a PR for each dependency. You can find more details on
the dependabot configuration and usage in in the github
documentation. [1]

[1] https://docs.github.com/en/github/administering-a-repository/enabling-and-disabling-version-updates

* Switch to weekly update interval
2020-09-06 13:49:36 +09:00
Sebastian Pütz 64b06ea9ec Change `add_submodule()` to take `&PyModule`.
The C-exported wrapper generated through `#[pymodule]` is only
required for the top-level module.
2020-09-05 15:54:57 +02:00
David Hewitt 2b0b853912 Add CHANGELOG to the guide 2020-09-05 14:44:39 +01:00
Sebastian Pütz 06cd7c7d5a Fix some more docs. 2020-09-05 11:24:12 +02:00
Sebastian Pütz e65b849ab6 Doc fixes, changelog and rename. 2020-09-05 10:20:22 +02:00
Sebastian Pütz 9137855e81 Add documentation for accessing PyModule in #[pyfunction]s. 2020-09-04 10:02:40 +02:00
Sebastian Pütz 4aae523e54 Rename add_module to add_submodule, documentation fixes. 2020-09-04 09:02:49 +02:00
Sebastian Pütz 795c054511 Possible to pass PyModule as first arg.
This commit makes it possible to access the module of a function
by passing the `need_module` argument to the pyfn and pyfunction
macros.
2020-09-04 09:01:21 +02:00
David Hewitt 313ad656f6
Merge pull request #1147 from sebpuetz/feature-gate-getnameobject
Gate PyModuleGetNameObject on PyPy.
2020-09-03 18:27:40 +01:00
Sebastian Pütz 3214249010 Make python function wrapper creation fallible.
Wrapping a function can fail if we can't get the module name.

Based on suggestion by @kngwyu
2020-09-03 15:48:32 +02:00
Sebastian Pütz 1f017b66fb Move py fn wrapper argument expansion to associated function.
Suggestion by @kngwyu.

Additionally replace some `expect` calls with error handling.
2020-09-03 15:21:33 +02:00
Sebastian Pütz 5bbca1a052 Set the module of `#[pyfunction]`s.
Previously neither the module nor the name of the module of
pyfunctions were registered. This commit passes the module and
its name when creating a new pyfunction.

PyModule::add_function and PyModule::add_module have been added and are
set to replace `add_wrapped` in a future release. `add_wrapped` is kept
for compatibility reasons during the transition.

Depending on whether a `PyModule` or `Python` is the argument for the
Python function-wrapper, the module will be registered with the function.
2020-09-03 14:49:28 +02:00
Sebastian Pütz acbb3eed60 Replace PyFunction_New with extern C function.
PyFunction_New was previously implemented as a Rust function
wrapper around a call to the extern C function PyFunction_NewExt
with a hard-coded third argument. This commit removes the Rust
wrapper and directly exposes the function from the CPython API.
2020-09-03 14:49:28 +02:00