Commit Graph

394 Commits

Author SHA1 Message Date
Alex Gaynor 9e1960ea34
Update MSRV to 1.63 (#4129)
* Bump MSRV to 1.63

* Drop parking_lot in favor of std::sync

* Make portable-atomic dep conditional

* Remove no longer required cfg
2024-04-28 16:11:28 +00:00
David Matos c66ed292ec
Disable PyUnicode_DATA on PyPy (#4116)
* Disable PYUNICODE_DATA on PyPy

* Add newsfragment

* Adjust import on PyString
2024-04-26 06:00:13 +00:00
Georg Brandl c2ac9a98e2
fix vectorcall argument handling (#4104)
Fixes #4093

- Make PY_VECTORCALL_ARGUMENTS_OFFSET a size_t like on CPython
- Remove the assert in PyVectorcall_NARGS and use checked cast
2024-04-22 08:56:39 +00:00
David Hewitt 947b372dcc
change `PyAnyMethods::dir` to be fallible (#4100) 2024-04-19 19:35:52 +00:00
David Hewitt cd28e1408e
add `#[track_caller]` to all `Py`/`Bound`/`Borrowed` methods which panic (#4098) 2024-04-19 11:44:36 +00:00
dependabot[bot] b11174e96d
Update heck requirement from 0.4 to 0.5 (#3966)
* Update heck requirement from 0.4 to 0.5

---
updated-dependencies:
- dependency-name: heck
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* newsfragment

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
2024-04-18 10:22:34 +00:00
David Hewitt 2c205d4586
release notes for 0.21.2 (#4091) 2024-04-18 08:59:02 +00:00
dependabot[bot] e64eb72903
build(deps): update chrono-tz requirement from >= 0.6, < 0.9 to >= 0.6, < 0.10 (#4061)
* build(deps): update chrono-tz requirement from >= 0.6, < 0.9 to >= 0.6, < 0.10

Updates the requirements on [chrono-tz](https://github.com/chronotope/chrono-tz) to permit the latest version.
- [Release notes](https://github.com/chronotope/chrono-tz/releases)
- [Changelog](https://github.com/chronotope/chrono-tz/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono-tz/compare/v0.6.0...v0.9.0)

---
updated-dependencies:
- dependency-name: chrono-tz
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* newsfragment

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
2024-04-18 08:58:51 +00:00
Jacob Zhong 03c50a1839
Change the types of `PySliceIndices` and `PySlice::indices (#3761)
* Change the type of `PySliceIndices::slicelength` and `PySlice::indices()`

* Fix example

* Fix fmt
2024-04-18 07:33:07 +00:00
Icxolu 03f59eaf45
fix declarative module compile error with `create_exception!` (#4086)
* fix declarative module compile error with `create_exception!`

* add newsfragment
2024-04-16 20:12:18 +00:00
David Hewitt a5201c04af
Deprecate the `PySet::empty` gil-ref constructor (#4082)
* Deprecate the `PySet::empty` gil-ref constructor

* add newsfragment
2024-04-14 21:38:40 +00:00
David Matos 8ed5c17b93
Allow use of scientific notation on rust decimal (#4079)
* Allow use of scientific notation on rust decimal

* Add newsfragment

* Pull out var

* Fix clippy warning

* Modify let bindings location
2024-04-14 20:07:17 +00:00
messense 30348b4d3f
Link libpython for AIX target (#4073) 2024-04-13 07:43:06 +00:00
Icxolu ee5216f406
fix declarative-modules compile error (#4054)
* fix declarative-modules compile error

* add newsfragment
2024-04-12 06:34:27 +00:00
Icxolu c8b59d7117
add `#[doc(hidden)]` to the Rust module created by `#[pymodule]` (#4067)
* add `#[doc(hidden)]` to the Rust module created by `#[pymodule]`

* add newsfragment
2024-04-12 06:34:08 +00:00
Icxolu 7a00b4d357
add descriptive error msg for `__traverse__` receivers other than `&self` (#4045)
* add descriptive error msg for `__traverse__` receivers other than `self`

* add newsfragment

* improve error message
2024-04-04 19:08:51 +00:00
David Hewitt a4aea230ed
fix compile error for multiple async method arguments (#4035) 2024-04-02 17:43:51 +00:00
David Hewitt c1f11fb4bd
release: 0.21.1 (#4032) 2024-04-01 18:51:58 +00:00
Icxolu 63ba371db0
added various std traits for `PyBackedStr` and `PyBackedBytes` (#4020)
* added various std traits for `PyBackedStr` and `PyBackedBytes`

* add newsfragment

* add tests
2024-04-01 07:10:40 +00:00
David Hewitt 336b1c982b
add `import_exception_bound!` macro (#4027)
* add `import_exception_bound!` macro

* newsfragment and tidy up
2024-03-31 19:55:31 +00:00
David Hewitt 9d932c1061
add `#[inline]` hints on many `Bound` and `Borrowed` methods (#4024) 2024-03-30 22:10:21 +00:00
Weijie Guo 74d9d23ba0
async method should allow args not only receiver (#4015)
* async method should allow args not only receiver

* add changelog md
2024-03-30 08:48:19 +00:00
Alex Gaynor ae3ac7d872
Fixed error string when failing to import an exception (#4012) 2024-03-29 15:49:50 +00:00
David Hewitt cf74624de9
refactor to remove add_to_module functions from generated code (#4009)
* refactor to remove add_to_module functions from generated code

* mrsv, newsfragment

* clippy
2024-03-29 11:54:33 +00:00
David Hewitt b053e83c08
implement `Send` and `Sync` for `PyBackedStr` and `PyBackedBytes` (#4007) 2024-03-29 11:28:42 +00:00
Icxolu dd1710256d
use `extract_argument` for `#[setter]` extraction (#3998)
* use `extract_argument` for `#[setter]` extraction

* add newsfragment
2024-03-27 15:41:04 +00:00
Icxolu 35faeff6f1
handle `#[pyo3(from_py_with = "")]` in `#[setter]` methods (#3995)
* handle `#[pyo3(from_py_with = "")]` in `#[setter]` methods

* add newsfragment
2024-03-26 18:53:11 +00:00
David Hewitt 1be2fad9bf
release: 0.21.0 (#3983) 2024-03-25 23:36:08 +00:00
Tim Felgentreff 9a38e709bb
Basic GraalPy Support (#3247)
* graalpy: recognize graalpy implementation when building

* graalpy: global Ellipse, None, NotImplemented, True, and False are only available as pointers

* graalpy: PyObject struct is opaque, use functions for everything

* graalpy: missing many of the same functions as pypy

* graalpy: do not have 128bit conversion functions

* graalpy: add functions for datetime accessor macros

* graalpy: add implementations for list macro functions

* graalpy: skip tuple macros

* graalpy: always use extern Py_CompileString function

* graalpy: disable assertion that does not apply to graalpy

* graalpy: floatobject structure is opaque on graalpy

* graalpy: ignore gc dependent test

* graalpy: add CI config

* graalpy: run rust fmt

* graalpy: add changelog entry

* graalpy: discover interpreter on PATH

* graalpy: interpreter id is not applicable to graalpy (just like pypy)

* graalpy: skip tests that cannot work on GraalPy

* graalpy: fix constructing normalized Err instances

Co-authored-by: David Hewitt <mail@davidhewitt.dev>

* graalpy: correct capi library name, but skip rust tests due to missing symbols

* graalpy: no support for C extensions on windows in latest release

* graalpy: declare support versions

* graalpy: frame, code, method, and function objects access from C API is mostly missing

* graalpy: take care only to expose C structure that GraalPy allocates

* graalpy: Bail out if graalpy version is less than what we support

---------

Co-authored-by: David Hewitt <mail@davidhewitt.dev>
2024-03-25 18:54:52 +00:00
Icxolu 54ffaecd65
add `AsRef` impls for `PyBackedStr` and `PyBackedBytes` (#3991)
* add `AsRef` impls for `PyBackedStr` and `PyBackedBytes`

* add newsfragment
2024-03-25 16:21:27 +00:00
Lily Foote 009cd32a44
Add into_mapping and into_sequence methods to Bound types (#3982)
* Add Bound<'py, PyDict>.into_mapping method

* Add Bound<'py, PyTuple>.into_sequence method

* Add Bound<'py, PyList>.into_sequence method

* Add newsfragment

* Add tests for into_mapping and into_sequence
2024-03-23 01:13:24 +00:00
David Hewitt caf80eca66
handle clippy `new_without_default` warnings (#3971)
* handle clippy `new_without_default` warnings

* add newsfragment
2024-03-19 21:41:27 +00:00
Icxolu da24f0cf93
exposes `Borrowed::to_owned` as public API (#3963)
* exposes `Borrowed::to_owned` as public API

* add newsfragment
2024-03-17 09:17:09 +00:00
David Hewitt dcba984b51
deprecate `GILPool` (#3947)
* deprecate `GILPool`

* review: adamreichold

* fix deprecation warnings in tests
2024-03-15 10:25:27 +00:00
David Hewitt 67b1b35013
release: 0.21.0-beta.0 (#3944) 2024-03-10 22:16:18 +00:00
David Hewitt 770d9b7f01
add `FromPyObjectBound` trait for extracting `&str` without GIL Refs (#3928)
* add `FromPyObjectBound` adjustment for `&str` without GIL Refs

* review: alex, Icxolu feedback

* add newsfragment

* add newsfragment for `FromPyObject` trait change

* make some examples compatible with abi3 < 3.10

* seal `FromPyObjectBound`

* fixup chrono_tz conversion
2024-03-08 07:43:48 +00:00
Thomas Tanon 0f7ddb19a5
PyPy: remove PyCode (PyCode_Type does not exist) (#3934) 2024-03-06 18:19:43 +00:00
David Hewitt 57bbc32e7c
add `experimental-async` feature (#3931)
* add `experimental-async` feature

* gate async doctests on feature
2024-03-06 00:54:45 +00:00
Matthew Neeley a15e4b1a11
Allow pymodule functions to take a single Bound<'_, PyModule> arg (#3905) 2024-02-27 22:24:14 +00:00
David Hewitt 8e2219b0d9
silence non-local-definitions nightly lint (#3901)
* silence non-local-definitions nightly lint

* add newsfragment

* add FIXMEs for `non_local_definitions`

* also allow `non_local_definitions` in doctests
2024-02-26 20:28:04 +00:00
Thomas Tanon e0e3981e17
#[pymodule] mod some_module { ... } v3 (#3815)
* #[pymodule] mod some_module { ... } v3

Based on #2367 and #3294

Allows to export classes, native classes, functions and submodules and provide an init function

See test/test_module.rs for an example

Future work:
- update examples, README and guide
- investigate having #[pyclass] and #[pyfunction] directly in the #[pymodule]

Co-authored-by: David Hewitt <mail@davidhewitt.dev>
Co-authored-by: Georg Brandl <georg@python.org>

* tests: group exported imports

* Consolidate pymodule macro code to avoid duplicates

* Makes pymodule_init take Bound<'_, PyModule>

* Renames #[pyo3] to #[pymodule_export]

* Gates #[pymodule] mod behind the experimental-declarative-modules feature

* Properly fails on functions inside of declarative modules

---------

Co-authored-by: David Hewitt <mail@davidhewitt.dev>
Co-authored-by: Georg Brandl <georg@python.org>
2024-02-24 13:50:18 +00:00
David Hewitt 11d143d0c9
release: 0.20.3 (#3890) 2024-02-23 12:30:38 +00:00
David Hewitt c4f66657c5
fix `either` feature conditional compilation, again (#3834)
* fix `either` feature conditional compilation, again

* test feature powerset in CI

* install `rust-src` for feature powerset tests

* review: adamreichold feedback

* Fix one more case of redundant imports.

* just check feature powerset for now

---------

Co-authored-by: Adam Reichold <adam.reichold@t-online.de>
2024-02-22 08:05:37 +00:00
Juniper Tyree 885883bf68
Add `Py::drop_ref` method (#3871)
* add Py::drop_ref method

* add changelog entry

* fix ffi import

* integrate review feedback

* Add a test

* Fix some build errors

* Fix some more build errors
2024-02-21 22:56:03 +00:00
David Hewitt eb90b81d44
always use a Python iterator for sets and frozensets (#3849)
* always use a Python iterator for sets and frozensets

* add newsfragment
2024-02-17 10:57:53 +00:00
David Hewitt dc8b948201
add `PyBackedStr` and `PyBackedBytes` (#3802)
* add `PyBackedStr` and `PyBackedBytes`

* review: adamreichold feedback

* use `NonNull<[u8]>`

* clippy and newsfragment

* drop binding unused after refactoring

---------

Co-authored-by: Adam Reichold <adam.reichold@t-online.de>
2024-02-15 07:58:20 +00:00
David Hewitt f5eafe23f2
add maximum Python version check (#3821)
* add maximum Python version check

* restore dependency of `pyo3-macros-backend` on `pyo3-build-config`

* fix clippy-all noxfile job
2024-02-13 21:52:53 +00:00
David Hewitt 55488d3880
Merge pull request #3818 from davidhewitt/datetime-segv
fix segmentation fault when `datetime` module is invalid
2024-02-11 09:04:32 +00:00
David Hewitt 5b1104131f fix segmentation fault when `datetime` module is invalid 2024-02-11 02:44:31 +00:00
David Hewitt 662eecfb44 add `PyStringMethods::encode_utf8` 2024-02-05 13:28:46 +00:00