Commit Graph

3712 Commits

Author SHA1 Message Date
Alex Gaynor 117f60bed0 Make PyType::name abi3 compatible
The implementation is more complex, because there's no equivalent to tp_name in the limited API
2020-09-08 12:22:59 -04:00
Yuji Kanagawa 679326edbc
Merge pull request #1165 from alex/abi3-fill-dict
Fill tp_dict on types in an abi3-friendly way
2020-09-08 22:44:35 +09:00
Sebastian Pütz be877d133f Add constructor for PyCFunction. 2020-09-08 14:26:08 +02:00
Alex Gaynor 0709a02310 Fill tp_dict on types in an abi3-friendly way
I think this might technically be backwards incompatible if you had a custom metaclass with fancy behavior, but pyo3 doesn't seem to have any native support for those.
2020-09-08 08:18:52 -04: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
Yuji Kanagawa e8936be3ce
Merge pull request #1162 from alex/disable-buffer-more
Complete the process of disabling buffers with Py_LIMITED_API
2020-09-08 15:04:54 +09:00
Yuji Kanagawa 4325a59ede
Merge pull request #1164 from alex/abi3-no-free-func
Properly mark a function as limited API only
2020-09-08 15:04:09 +09:00
Alex Gaynor 71a7b1a6b6 Properly mark a funtion as limited API only 2020-09-07 12:25:08 -04:00
Alex Gaynor 80e2497c4c Complete the process of disabling buffers with Py_LIMITED_API 2020-09-07 07:49:24 -04:00
Yuji Kanagawa 3b61df25c9
Merge pull request #1161 from alex/abi3-fix-errors
Fixed a few compilation errors on the abi3 branch
2020-09-07 17:32:46 +09:00
Alex Gaynor 4cd6d4c772 Fixed a few compilation errors on the abi3 branch 2020-09-06 17:35:05 -04: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
kngwyu e0f75f80b1 Fix missing PyGetSetDef_INIT and Adress clippy warnings 2020-09-06 17:37:59 +09:00
kngwyu 1941f4daef Rename all-apis with unstable-api 2020-09-06 17:37:55 +09: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
kngwyu c2f10e2185 Restructure protcol-table initialization 2020-09-06 01:50:39 +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
kngwyu d2a10b688f Introduce all-apis feature to support abi3 2020-09-05 17:52:41 +09:00
Sebastian Pütz e65b849ab6 Doc fixes, changelog and rename. 2020-09-05 10:20:22 +02:00
Yuji Kanagawa 62a175e398
Merge pull request #1132 from alex/abi3-class-creation
Use PyType_Spec for creating new types in Rust
2020-09-05 16:11:10 +09: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
Sebastian Pütz 6395c86de4 Gate PyModuleGetNameObject on PyPy. 2020-09-03 14:47:13 +02:00
David Hewitt 74f981120d
Merge pull request #1146 from programmerjake/fix-snake-case-warning
Add #[allow(non_snake_case)] to function with generated name
2020-09-03 08:27:43 +01:00
Jacob Lifshay 7acf8d9f57 Add #[allow(non_snake_case)] to function with generated name
Fixes #1145
2020-09-02 20:32:51 -07:00
Alex Gaynor 400462063d Proof of concept of using PEP384s PyType_Spec 2020-09-02 16:54:39 -04:00
David Hewitt 3c24d27a66
Merge pull request #1141 from davidhewitt/guide-subchapters
Start splitting long guide pages into subchapters
2020-09-02 19:44:48 +01:00
Yuji Kanagawa e2fcd8f5a5
Merge pull request #1137 from davidhewitt/tidy-proc-macros
Refactor proc_macro optional / python detection
2020-09-03 00:14:08 +09:00
Yuji Kanagawa 9ecd9892aa
Merge pull request #1138 from davidhewitt/ci-no-fail-fast
Disable fail-fast in CI test
2020-09-03 00:04:17 +09:00
Yuji Kanagawa 1c696714e7
Merge pull request #1139 from davidhewitt/ci-color
Enable colored cargo output in CI
2020-09-03 00:03:30 +09:00
Yuji Kanagawa 1b2095140d
Merge pull request #1142 from davidhewitt/reduce-coverage-noise
Allow tiny coverage drop in PR to reduce "failure" noise
2020-09-02 23:57:58 +09:00
David Hewitt 6a6ce3f9f7 Allow tiny coverage drop in PR to reduce "failure" noise 2020-09-02 08:10:51 +01:00
David Hewitt 3e86e4c247 Refactor proc_macro optional / python detection 2020-09-02 08:01:21 +01:00