Commit Graph

139 Commits

Author SHA1 Message Date
David Hewitt 388d1760b5
ci: start testing on 3.13-dev (#4184)
* ci: start testing on 3.13-dev

* ffi fixes for 3.13 beta 1

* support 3.13

* move gevent to be binary-only

* adjust for div_ceil

* fixup pytests
2024-05-25 22:41:26 +00:00
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
Adam Reichold 721100a9e9
Suppress non_local_definitions lint as we often want the non-local effects in macro code (#4074)
* Resolve references to legacy numerical constants and use the associated constants instead

* Suppress non_local_definitions lint as we often want the non-local effects in macro code
2024-04-13 12:59:44 +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
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
David Hewitt 75af678f43
docs: use kebab-case instead of snake_case for guide URLs (#3942)
* guide: use kebab-case instead of snake_case

* fixup doctest names

Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>

* review: Icxolu

* fix relative url

* also remap latest pyo3

* fixup python_from_rust

---------

Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
2024-03-09 20:10:58 +00:00
Thomas Tanon 0f7ddb19a5
PyPy: remove PyCode (PyCode_Type does not exist) (#3934) 2024-03-06 18:19:43 +00:00
David Hewitt 11b5ae7f5f update ffi structures for PyPy 7.3.15 2024-01-23 20:34:19 +00:00
jadedpasta 83f0f22efe ffi: Add definition for PyType_GetModuleByDef
This API is available starting in 3.11. It is not part of the Stable ABI.

PyType_GetModuleByDef searches the MRO of the given type for a module
matching the given module spec. It can be useful for users use that
`pyo3_ffi` directly and want to support multiple interpreters/per
interpreter GIL. It is useful to obtain access to the module state from
special methods like `tp_new` that can't use the METH_METHOD calling
convention.

This API is not supported on PyPy yet, but guess the symbol name for the future.
2024-01-12 22:13:33 -06:00
David Hewitt 8fef7a5848 fix size of pypy private fields in Py_buffer definition 2024-01-12 15:59:14 +00:00
messense 28dda997f9
Add additional definitions for `_PyImport_Frozen*` 2023-12-03 21:47:00 +08:00
David Hewitt 41842f9e4b fix pyo3-ffi beta clippy warnings 2023-11-28 07:29:45 +00:00
David Hewitt 29ad73b6d5 ci: updates for rust 1.74 2023-11-16 16:06:01 +00:00
David Hewitt 572a27d2d3 ci: fix nightly unused import warnings 2023-10-25 23:30:14 +01:00
messense dca18b3e41
Fix `PyMemoryView_FromBuffer` cfg 2023-10-15 22:24:58 +08:00
messense 5b94241bd7
Add `PyMemoryView` type 2023-10-15 17:32:09 +08:00
Erle Carrara 0e0e6623f3
fix _PyFrameEvalFunction. Since python 3.11 it receives a `_PyInterpreterFrame` 2023-10-09 23:36:01 -03:00
mejrs 0cccb9f64b add PyInterpreterConfig api 2023-10-08 22:38:11 +02:00
messense 2d3dc65428
Merge pull request #3497 from davidhewitt/ci-3.12-debug
bump test-debug to 3.12
2023-10-05 03:14:05 +00:00
David Hewitt cbd7370b20
Merge pull request #3490 from davidhewitt/ffi-marshal-limited
disable `marshal.rs` on `Py_LIMITED_API`
2023-10-04 19:05:01 +00:00
David Hewitt 6c6c607ad3 bump test-debug to 3.12 2023-10-04 19:58:27 +01:00
mejrs aa011f4a9d Update PyModuleDef_Slot types 2023-10-03 23:25:45 +02:00
David Hewitt c80a61ee30 disable `marshal.rs` on `Py_LIMITED_API` 2023-10-02 21:36:17 +01:00
David Hewitt bcb01049cc
Merge pull request #3404 from davidhewitt/fix-dealloc
call PyObject_GC_Untrack before deallocating
2023-09-11 05:18:34 +00:00
David Hewitt fc6e22a554 Fix name of `_Py_LocalMonitors` in latest 3.12 RCs 2023-09-10 22:14:29 +02:00
David Hewitt e28403e772 call PyObject_GC_Untrack before deallocating 2023-09-09 22:29:58 +01:00
David Hewitt ad042f3bae add comments to ffi def structures
Co-authored-by: Bruno Kolenbrander <59372212+mejrs@users.noreply.github.com>
2023-09-06 08:56:51 +01:00
David Hewitt 9336e5b605
Merge pull request #3403 from davidhewitt/ffi-objimpl
update definitions for objimpl.h
2023-08-19 12:02:32 +00:00
David Hewitt 69475b0a83 update definitions for objimpl.h 2023-08-18 22:17:53 +01:00
David Hewitt 7fce07935c fix compile warning on pre-3.12 debug builds 2023-08-18 22:15:29 +01:00
David Hewitt b0f5901ce3 update structmember.rs for Python 3.12 2023-08-11 11:54:16 +01:00
David Hewitt acb1bf7c0a update fileobject.rs for Python 3.12 2023-08-11 11:54:16 +01:00
David Hewitt 5d7dfe2e95 update pydebug.rs for Python 3.12 2023-08-11 11:54:16 +01:00
Adam Reichold 1df7270e15
Merge pull request #3374 from Tpt/pathlike
Makes PathBuf FromPyObject implementation work on all os.PathLike
2023-08-09 14:50:28 +00:00
Tpt dd04d2c4cc Fixes linking of `PyOS_FSPath` on PyPy. 2023-08-09 16:19:17 +02:00
Alex Gaynor 51fdf3afef
Update constants for py3.12, which fixes struct sizes
See 766d2518ae8384c6bd7f82727defeb86847ccf64
2023-08-08 15:07:59 -04:00
David Hewitt 4e957e8bd4 update object.h definitions for Python 3.12 2023-07-30 15:37:06 +01:00
David Hewitt e2c88d5a4e optimize `float` -> `f64` conversions on non-abi3 2023-07-28 20:45:37 +01:00
David Hewitt 7a2fc86186
Merge pull request #3342 from davidhewitt/3.12-ffi-check-fixes
fix ffi check failures for 3.12.0b4
2023-07-25 11:59:55 +00:00
David Hewitt 655de94749 fix ffi check failures for 3.12.0b4 2023-07-25 08:25:34 +01:00
David Hewitt 3fa705a3c6 remove PyUnicode_WCHAR_KIND from docs on Py_3_12 2023-07-25 07:35:57 +01:00
Adam Reichold 8ce6c26c81
Merge pull request #3334 from davidhewitt/pyerr-display
add PyErr::display
2023-07-25 05:56:21 +00:00
David Hewitt a15614844d add PyErr::display 2023-07-24 22:14:55 +01:00
Marc Mueller f8ca456f5f Add PyType_GetDict for Python 3.12 2023-07-23 17:00:50 +02:00
David Hewitt 45ff25cd2a clippy: deny / fix used-underscope-binding lint 2023-07-16 20:49:45 +01:00
Adam Reichold bd7aed4b12 Add implementation of Iterator::size_hint for PyIterator
When the Python iterator backing `PyIterator` has a `__length_hint__` special
method, we can use this as a lower bound for Rust's `Iterator::size_hint` to
e.g. support pre-allocation of collections.

This is implemented using `PyObject_LengthHint` which is not available in the
stable ABI and hence so is `Iterator::size_hint`. This should be fine since this
is an optimization in any case and the stable ABI is expected to have slightly
worse performance overall.
2023-07-09 10:16:20 +02:00
David Hewitt f7f3ff8820 fix FFI definition `Py_EnterRecursiveCall` 2023-07-05 22:52:41 +01:00
David Hewitt 82712aed32 fix `SystemError` raised from `PyUnicodeDecodeError_Create` on PyPy 3.10 2023-07-05 11:10:02 +01:00