Commit Graph

700 Commits

Author SHA1 Message Date
Adam Reichold f777372eed Limit the intern! macro to strings and intern the string contents in addition to the reference. 2022-04-04 10:11:52 +02:00
Adam Reichold db109867d3 Add intern! macro which can be used to amortize the cost of creating Python objects by storing them inside a GILOnceCell. 2022-04-03 21:16:42 +02:00
Adam Reichold d3dcbd72ba
Add PyString::intern to enable access to Python's built-in string interning. (#2268) 2022-04-03 21:07:58 +02:00
David Hewitt c16cc35b30 pyclass: mapping flag 2022-04-02 16:15:44 +01:00
Sergey Kvachonok 2d2b9f5c33 Update the user guide and add a ChangeLog entry
Update Architecture.md to reflect the current cross compilation
support state.
2022-04-01 11:32:46 +03:00
Sergey Kvachonok 9b45a19161 pyo3-build-config: Replace `TargetInfo` with `target_lexicon::Triple`
Add a new public crate function `cross_compile_from_to()` using
`target_lexicon::Triple` arguments instead of plain strings
used in `cross_compile()`.

Deprecate `pyo3_build_config::cross_compile()` since v0.17.

Attempt to extract common code patterns into methods and standalone
helper functions. Add docstrings to the new private items.
Make some of the new helper functions public within the PyO3 crate
and reuse them in the build scripts.

Add PYO3_CROSS_PYTHON_VERSION parsing unit test.

Add a ChangeLog entry mentioning the new `pyo3-build-config` API.
2022-04-01 09:36:49 +03:00
messense 733a2c68f5
Update changelog entry 2022-03-26 21:27:49 +08:00
David Hewitt 2813c87eaf
Merge pull request #2092 from aganders3/export-conf
Add export-config feature to pyo3-build-config
2022-03-23 11:16:04 +00:00
Sergey Kvachonok 5237000317 pyo3-build-config: Fix `abi3-py310` feature
Fix `abi3-py310` feature: use Python 3.10 ABI when available
instead of silently falling back to the 3.9 ABI.
2022-03-23 09:45:25 +03:00
Ashley Anderson 272d2bc0e6
Merge branch 'main' into export-conf 2022-03-22 12:59:54 -04:00
David Hewitt 87c79c0319
Merge pull request #2234 from davidhewitt/pyclass-args-refactor
pyclass: unify pyclass with its pyo3 arguments
2022-03-22 11:38:05 +00:00
David Hewitt 49c1d22606 docs: for #2234 2022-03-22 10:38:36 +00:00
messense ad8ffaad2e
Update changelog for parking_lot supported versions 2022-03-22 13:51:58 +08:00
David Hewitt c734b116f9 macros: fix syn patch version 2022-03-21 23:53:08 +00:00
Ashley Anderson 4a62a62cae Improvements based on code review: API and documentation. 2022-03-21 12:55:39 -04:00
Alex Gaynor 69655454c1 Added an as_bytes method for Py<PyBytes>
This allows for obtaining a slice that's not lexically bound to the GIL which can be helpful to avoid copying.
2022-03-19 13:28:06 -04:00
Ashley Anderson 03e11184ed Add changelog entry.
Rebased on main.
2022-03-17 11:20:34 -04:00
Kevin Phillips 13f13e5ee1 pyo3-build-config: Change for from_sysconfigdata to set the shared property based on PYTHONFRAMEWORK in addition to Py_ENABLE_SHARED in order that a macos Framework build is considered shared just like the logic in from_interpreter 2022-03-17 07:42:29 +01:00
David Hewitt 52d2c78ae1 pyo3-build-config: fix windows "cross-compile" panic 2022-03-16 13:22:00 +01:00
Adam Reichold 922bbfc92d release: 0.16.2 2022-03-15 19:20:00 +01:00
Adam Reichold 0c7a13fbe1 Make pyo3-ffi a build dependency of pyo3 to ensure that its build script has finished before pyo3's build script starts. 2022-03-15 12:19:13 +01:00
Alex Gaynor efc18a4139
fixed formatting in changelog (#2218) 2022-03-09 12:59:37 +00:00
David Hewitt 88cd9152b2 pypy: support 7.3.8 2022-03-08 21:09:16 +00:00
David Hewitt 7056bae21f release: 0.16.1 2022-03-05 16:21:44 +00:00
messense e4c5698671
Fix up changelog entry for `#2197` 2022-03-04 21:02:55 +08:00
messense ad2c1af9f7
Merge pull request #2201 from messense/aarch64-apple-darwin
Add aarch64-apple-darwin test to CI
2022-03-04 17:48:54 +08:00
Adam Reichold c339550a56
Merge pull request #2197 from PyO3/bump-hashbrown
Extend  optional dependency supported versions to include 0.12.
2022-03-04 10:41:50 +01:00
messense afe5221724
Fix cross compiling to aarch64 macOS 2022-03-04 17:22:50 +08:00
Adam Reichold 2fa91ada40 Extend optional dependency supported versions to include 0.12. 2022-03-04 08:30:15 +01:00
Georg Brandl 6bc8943df5 changelog/guide: visibility is also important for wrap_pyfunction! now
Fixes #2202
2022-03-04 07:48:41 +01:00
David Hewitt 84cb8cdb6e add changelog for 2198 2022-03-03 07:34:01 +00:00
David Hewitt 4c434a21bd release: 0.16.0 2022-02-27 20:28:51 +00:00
Georg Brandl dc4f114d67 Address review comments 2022-02-26 20:10:33 +01:00
Georg Brandl 0678f11266 Protocols: implement __getattribute__
converting tp_getattro to a shared slot

Fixes #2186
2022-02-26 20:05:50 +01:00
Georg Brandl 03dc96bff1
Py/PyAny: remove PartialEq impl and add is() (#2183) 2022-02-25 19:39:45 +00:00
Tommaso Thea Cioni 487345979b
Added `eq`, `ne`, `gt` etc. methods. (#2175) 2022-02-25 18:52:20 +01:00
David Hewitt b84309b67d ffi: add missing definition PyCMethod_New 2022-02-25 07:28:52 +00:00
David Hewitt f98f116131 pypy: support released 3.9 2022-02-25 07:28:22 +00:00
David Hewitt 7c865fcc25
Merge pull request #2173 from davidhewitt/deprecate-pyproto
pyproto: deprecate protocol traits
2022-02-24 23:54:40 +00:00
Rico Hageman 1839fc208b Add CHANGELOG.md entry 2022-02-24 00:23:07 +01:00
David Hewitt 24445df633 pyproto: deprecate protocol traits 2022-02-23 07:50:52 +00:00
Rico Hageman 3fbdc863cb Include the causes when throwing a PyTypeError when argument parsing failed 2022-02-22 09:48:41 +01:00
Rico Hageman 333ebb9872 Add changelog entry 2022-02-21 23:22:56 +01:00
David Hewitt 79123b396c pyclass: deprecate gc option 2022-02-15 08:01:46 +00:00
David Hewitt 676295b8de pymethods: support gc protocol 2022-02-15 08:01:23 +00:00
David Hewitt 7851e865ae
Merge pull request #2166 from mejrs/union
Implement ml_meth as an union.
2022-02-15 07:55:24 +00:00
mejrs 59412b06e5 Add to changelog 2022-02-14 15:15:05 +01:00
Jacob Zhong de502f0b08 Update CHANGELOG.md 2022-02-12 13:28:05 -05:00
David Hewitt c5ef24bbea fix: memory leak in Option<T>::as_ptr 2022-02-11 22:18:11 +00:00
David Hewitt c93ee00130 refactor: inline handle_panic into macro output 2022-02-10 20:20:03 +00:00
David Hewitt 0c576964f8 changelog: add 2157 2022-02-09 08:07:14 +00:00
b05902132 78f5afc82e Finish implementation for pyclass enums 2022-02-07 22:17:11 +00:00
James Hilton-Balfe b2f9e28331
Add Mapping::contains (#2133)
* Add Mapping::contains

* Fix typo

* Add a changelog entry

* Use PyAny::contatins instead

* Update mapping.rs
2022-02-06 00:35:43 +00:00
David Hewitt 53c170078d pymethods: seq methods from mapping methods 2022-02-05 15:59:22 +00:00
David Hewitt 71e5a12fa2 pypy: support fast long conversion 2022-02-05 10:14:14 +00:00
David Hewitt 199cc989d4
Merge pull request #2126 from DSPOM2/main
move ffi module to separate crate
2022-01-31 23:27:36 +00:00
DSPOM 6a9a9ba38a
move ffi module to separate crate 2022-01-31 13:27:16 +01:00
mejrs b56cc3d171 Updated changelog 2022-01-25 00:09:11 +01:00
Ashley Anderson 64c09d870c Update changelog. 2022-01-19 21:22:08 -05:00
David Hewitt dc8032a5ff pyfunction: allow required positional after option 2022-01-11 00:44:41 +00:00
David Hewitt de8174684f pyfunction: allow wrap_pyfunction to work on imports (even cross-crate) 2022-01-07 08:43:05 +00:00
David Hewitt 2cee7feaaf
Merge pull request #2083 from aviramha/magic_methods
verify py method args count
2022-01-07 00:13:05 +00:00
David Hewitt be70e5441b
Merge pull request #2085 from davidhewitt/opt-argument-extraction
opt: move fastcall boilerplate out of generated code
2022-01-03 08:13:31 +00:00
Aviram Hassan 50659b6b02
`__ipow__` now supports modulo argument on Python 3.8+.
`pyo3-macros-backend` is now compiled with PyO3 cfgs to enable different magic method definitions based on version.
Add check for correct number of arguments on magic methods.
2022-01-03 09:53:56 +02:00
David Hewitt 1a782ce4db opt: move fastcall boilerplate out of generated code 2022-01-03 00:07:32 +00:00
David Hewitt cf965155f4 pymethods: support buffer protocol 2021-12-30 15:48:55 +00:00
David Hewitt e33b3e6a5b opt: don't emit T::dict_offset and T::weakref_offset without attributes 2021-12-30 14:57:27 +00:00
David Hewitt ff37f24625 macros: accept paths in wrap_x macros 2021-12-30 12:46:57 +00:00
David Hewitt 90479ddae4 opt: make argument extraction code smaller 2021-12-24 01:52:15 +00:00
David Hewitt 33a618914f opt: reduce class creation generated code 2021-12-24 01:12:59 +00:00
David Hewitt 5be5d77589 opt: improve handle_panic generated code 2021-12-24 00:17:04 +00:00
David Hewitt 492b7e4c0f macros: optimize generated code for #[derive(FromPyObject)] 2021-12-22 08:34:05 +00:00
Amanieu d'Antras ed0a6b710a Add changelog entry 2021-12-20 18:34:14 +01:00
Ashley Anderson a6c70164cd Move changelog entry for #1996. 2021-12-16 13:12:03 -05:00
Ashley Anderson c30ca03b60
Expose cross compiling configuration from pyo3-build-config (#1996)
* Initial refactor - expose cross-compiling functions and add necessary fields to InterpreterConfig

* Refactor cross_compiling to take arch/vendor/os separately.

* Address review comments.

* Update changelog with note about pyo3-build-config APIs.

* Fix panic when parsing ABI tag on Windows.

* Update parse_sysconfigdata test to best-guess values for linux.

* Revert added fields in InterpreterConfig.

* Refactor parse_sysconfigdata to return Sysconfigdata (HashMap). Add InterpreterConfig::from_sysconfigdata.

* Update BuildFlags test to use from_sysconfigdata.

* Add tests for from_sysconfigdata. Refactor Sysconfigdata API to be more open.

* Add basic tests for not cross compiling. Add some error handling.

* Address review comments.

* Update search_lib_dir to recurse into lib and pypy dirs.

* Look even harder for sysconfigdata.

* Add skip-build-config feature.

* Revert skip-build-config feature.

* Suppress cargo:rerun-if-env-changed without resolve-config feature.
2021-12-16 00:18:37 +00:00
mejrs bbe478db81 Update changelog 2021-12-14 19:19:31 +01:00
David Hewitt 469d72a001
Merge pull request #2022 from PyO3/pyo3_path
Hygiene: offer a way to set path to pyo3 crate
2021-12-09 20:27:48 +00:00
Juniper Parsons 47cf13239f
Disallow positional args after optional args 2021-12-09 10:01:59 -05:00
Georg Brandl a5b76bc365 pyo3_path, part 4: rename to `crate` to keep consistent with serde 2021-12-09 07:36:48 +01:00
Georg Brandl e4f608f605 pyo3_path, part 2: add pyo3_path options and use them. 2021-12-09 07:24:18 +01:00
David Hewitt 4c8abd1426 rust: support 1.57 2021-12-08 07:10:16 +00:00
David Hewitt b56d492c3b pytype: resurrect (deprecated) PyType::is_instance 2021-11-27 09:05:58 +00:00
David Hewitt 2ac30ec411 err: tweak names, inlining and docs 2021-11-27 08:26:04 +00:00
Gert Hulselmans 5ecc715d10 Map "PyPyObject_HasAttr" to "PyObject_HasAttr" so hasattr works with PyPy.
Map "PyPyObject_HasAttr" to "PyObject_HasAttr" so hasattr works
with PyPy. Solves: "undefined symbol: PyObject_HasAttr" when
importing the library.
2021-11-25 19:32:24 +00:00
David Hewitt a0d3ab0de1
Merge pull request #2019 from davidhewitt/inventory-0.2.0
inventory: update to 0.2
2021-11-23 07:39:05 +00:00
Miles Granger c4147cdde4
Add PyCapsule API (#1980)
Co-authored-by: Georg Brandl <georg@python.org>
2021-11-23 06:57:37 +01:00
David Hewitt f17e0d35cd inventory: update to 0.2 2021-11-22 22:57:58 +00:00
David Hewitt e9b46f76da
Merge pull request #1985 from PyO3/is_instance_of
add PyType::is_subclass_of and PyAny::is_instance_of
2021-11-20 14:56:36 +00:00
David Hewitt ded44eebfb
Merge pull request #2006 from davidhewitt/drop-py36
python: drop support for 3.6
2021-11-20 14:04:31 +00:00
Georg Brandl 43893158b1 switch is_instance/is_instance_of, is_subclass/is_subclass_of 2021-11-20 13:18:43 +00:00
Georg Brandl a83c31a3af add PyType::is_subclass_of and PyAny::is_instance_of
which get the type to check against as an arguments,
as opposed to a compile-time generic type.
2021-11-20 13:16:15 +00:00
David Hewitt cc91a7c574
Merge pull request #2007 from davidhewitt/remove-0.14-deprecations
deprecations: remove items deprecated in PyO3 0.14
2021-11-20 13:09:04 +00:00
David Hewitt 70030f130d python: drop support for 3.6 2021-11-20 13:02:42 +00:00
David Hewitt 0dfe6b0274
Merge pull request #2008 from davidhewitt/build-config-no-resolve-default
pyo3-build-config: don't enable resolve-config by default
2021-11-20 12:56:31 +00:00
David Hewitt c9a4cd1f87 deprecations: remove items deprecated in PyO3 0.14 2021-11-19 16:33:29 +00:00
Vincent Michel 91caa814d0 Add `Py::setattr` method 2021-11-19 16:59:54 +01:00
David Hewitt b9cc10f3fb pyo3-build-config: don't enable resolve-config by default 2021-11-19 14:19:24 +00:00
David Hewitt 6a65f98bd2 msrv: bump to 1.48 2021-11-19 10:10:59 +00:00
David Hewitt eb5059acc7 release: 0.15.1 2021-11-18 07:34:22 +00:00
David Hewitt 26ccc1ab37 macros: fix panic in __get__ implementation 2021-11-15 16:02:59 +00:00