Commit Graph

567 Commits

Author SHA1 Message Date
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
David Hewitt 1df68e852e allow_threads: switch from `catch_unwind` to guard pattern 2021-11-15 12:25:53 +00:00
David Hewitt 8e41483bad
Merge pull request #1991 from messense/pypy-abi3
Don't emit `Py_LIMITED_API` cfg for PyPy
2021-11-15 10:13:23 +00:00
David Hewitt 9ae7e31e9c
Merge pull request #1977 from davidhewitt/traceback-type
types: add PyTraceback
2021-11-15 09:04:15 +00:00
messense 73c3911748 Don't emit `Py_LIMITED_API` cfg for PyPy 2021-11-15 15:40:27 +08:00
David Hewitt 88ca6bbbab types: add PyTraceback 2021-11-15 07:25:57 +00:00
messense 2325c283b0 Fix mingw platform detection 2021-11-15 15:15:16 +08:00
Moriyoshi Koizumi ae05020b13 Support Py::as_ref() and Py::into_ref() for PySequence, PyIterator and PyMapping. 2021-11-13 08:23:40 +00:00
David Hewitt 23778f5386 pymethods: test and document opt-out of protos 2021-11-10 23:28:01 +00:00
David Hewitt 47747444c7 release: 0.15.0 2021-11-03 23:00:38 +00:00
David Hewitt f801c19efe err: add `PyErr::take` 2021-11-02 23:12:36 +00:00
David Hewitt 6b1afa4040 pypy: support 3.8 2021-10-27 22:17:45 +01:00
Gregory Szorc a5f804e817 ffi: restore _PyImport_FindExtensionObject on Python 3.10
This symbol was initially removed from 3.10. But it was restored
late in the 3.10 development cycle in time for 3.10.0. See
https://bugs.python.org/issue45307. It is slated for removal in
3.11.
2021-10-23 15:24:52 -07:00
David Hewitt 4b2345fe80 pymethods: support __call__ proto 2021-10-23 00:06:46 +01:00
Azat Ibrakov 7349513f5b
Add fallback for `__mod__` magic method (#1934)
* Add fallback for `__mod__` magic method

* Add 'CHANGELOG' entry

* Complete tests
2021-10-19 23:14:26 +01:00
Ashley Anderson bf26daec2d
Positional-only args (#1925)
* Add support for positional-only args

* Update changelog. Add a few more tests. Run rust-fmt.

* Fix test.

* Fix tests again.

* Update CHANGELOG.md to link PR instead of issue

* Update guide to mention positional-only params

* Add unreachable!() per code review

* Update and expand tests for pos args.

* Fix tests, lint, add UI tests.

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2021-10-19 23:13:27 +01:00
laurent 2042906832 pycfunction: add PyCFunction::new_closure rust defined closures 2021-10-17 07:59:50 +01:00
Chris Laplante 3b94f4b70c
Add `anyhow-integration` feature which implements From<anyhow::Error> for PyErr (#1822)
* Add 'anyhow' feature which provides simple From<anyhow::Error> for PyErr impl

This makes it possible to use anyhow::Result<T> as the return type for
methods and functions exposed to Python.

The current implementation just stringifies the anyhow::Error before
shoving it into a PyRuntimeError. Conversion back to the anyhow::Error
is not possible, but it is better than nothing.

Signed-off-by: Chris Laplante <chris.laplante@agilent.com>

* Document `anyhow` feature in the guide

Signed-off-by: Chris Laplante <chris.laplante@agilent.com>

* update changelog to document anyhow feature

* WIP adding tests

* Finish up anyhow feature

* Fix formatting

* Fix tests

* Fix tests

* Apply review suggestions

Co-authored-by: Bruno Kolenbrander <59372212+mejrs@users.noreply.github.com>
Co-authored-by: mejrs <brunokolenbrander@hotmail.com>
2021-10-17 07:54:29 +01:00
Bruno Kolenbrander ae873698d4
Implement `eyre` feature (#1893)
* Implement `eyre` feature

* Punctuation

* Add `eyre` entry in changelog

* Add `eyre` feature entry to guide

* Set eyre upper bound and move comment back

* Add eyre feature to docs.rs metadata

* Finish up review suggestions

* Update CHANGELOG.md

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2021-10-13 22:36:06 +00:00
Giovanni Barillari c06058888f review sysconfigdata filename match rules to support cp37m 2021-10-12 23:41:26 +01:00
David Hewitt c986b5d4ae
Merge pull request #1889 from davidhewitt/py310
packaging: formal support for Python 3.10
2021-09-29 19:36:52 +01:00
David Hewitt 7c4503e0ca ffi: updates for Python 3.10
Co-authored-by: Bruno Kolenbrander <59372212+mejrs@users.noreply.github.com>
2021-09-29 08:02:08 +01:00
David Hewitt a5d0aa777c py310: add abi3-py310 feature 2021-09-26 16:21:35 +01:00
David Hewitt 16ac7d481d
Merge pull request #1844 from davidhewitt/mapping-type
types: add PyMapping
2021-09-26 14:55:59 +01:00
David Hewitt d929916071 types: add PyMapping 2021-09-26 13:57:33 +01:00
Mo Mirza 4a34cc63a6
Remove use of unwrap (#1888)
* Remove use of unwrap

* Update changelog

* Update CHANGELOG.md

Co-authored-by: Mo Mirza <mo.mirza@iwoca.co.uk>
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2021-09-26 09:01:23 +01:00
Dean Li c72033751e
update changelog 2021-09-25 21:02:06 +08:00
Sergey Kvachonok 2f74ab0d23 build-config: Always pass `abi3` flag to `default_lib_name_windows()`
Hardcoding `false` here leads to an incorrect abi3 DLL name
when cross-compiling to Windows.
2021-09-22 07:30:21 +01:00
Alex Touchet 2a09583b28 Update various links and formatting 2021-09-18 11:48:45 -07:00
David Hewitt 70d829de66 gil: try to initialize threads on Python 3.6 if possible 2021-09-17 08:48:21 +01:00
David Hewitt 097d7e09cb pyo3-build-config: fix location for conda interpreter on windows 2021-09-16 23:38:46 +01:00
David Hewitt dca02a92ce changelog: updates for 0.14.5 backports 2021-09-05 15:19:36 +01:00
Georg Brandl 7cb4faf21c PyList/PyTuple: add as_sequence()
Fixes #1845
2021-09-03 08:09:19 +02:00
Gregory Szorc 1e951d5d8b pyo3-build-config: add a crate feature to control build script
I have a use case in PyOxidizer where I want to use the
pyo3-build-config crate as a library crate so I can access the
`InterpreterConfig` struct so I can read/write config files without
reinventing the wheel.

This is doable before this commit. But it requires that the
build environment have a Python interpreter. This is undesirable
for library usage.

This commit introduces a cargo feature flag to control whether the
build script does anything. The feature flag must be present for
the build script to resolve a config. The feature flag is enabled
by default for backwards compatibility. The pyo3 and pyo3-macros-backend
crates use this feature by default, for backwards compatibility and
because it is the reasonable default.

This is probably room to conditionalize some APIs and other behavior
based on this feature flag. But we stop short of doing that for
the time being.
2021-09-01 19:44:54 -07:00