Commit Graph

152 Commits

Author SHA1 Message Date
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
Adam Reichold e6293a9608
Merge pull request #3405 from davidhewitt/debug-3.11
fix compile warning on pre-3.12 debug builds
2023-08-19 05:25:57 +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 eba2c59778 tidy up some file locations after dual licensing 2023-08-16 08:22:51 +01:00
David Hewitt ff823ac3df
Merge pull request #3390 from puradox/fix/ffi-license
Replace pyo3-ffi LICENSE with ACKNOWLEDGEMENTS
2023-08-15 23:07:55 +00:00
Sam Balana 0607905771
Replace pyo3-ffi LICENSE with ACKNOWLEDGEMENTS
Replace the Python license from pyo3-ffi/LICENSE with an
ACKNOWLEDGEMENTS file. Relicense under the parent Apache 2.0 license.

pyo3-ffi contains a Rust reproduction of the CPython header files, only
copying what is absolutely necessary for binary compatibility. As such,
it is unnecessary to include the Python license.

Fixes #3124
2023-08-15 15:29:53 -07:00
DataTriny 3c3e9401a3 Dual-license 2023-08-15 23:39:45 +02: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 284c42d840 release: 0.19.2 2023-08-01 07:29:04 +01: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
David Hewitt 6666c335e6 add PyState_*Module definitions for PyPy 2023-07-04 08:57:50 +01:00
David Hewitt 7d357ad992 release: 0.19.1 2023-07-03 16:18:24 +01:00
David Hewitt db91642bae add `PyDict::get_item_with_error` for PyPy 2023-06-25 19:26:08 +01:00
ijl 9e9a6e9ebd Add PyErr_GetRaisedException(), PyErr_SetRaisedException() to FFI
These are new and part of the stable API as of v3.12.0a6.

PyErr_Fetch(), PyErr_Restore(), and PyErr_NormalizeException()
were simultaneously deprecated in favor of these.

python/cpython@feec49c407
2023-06-16 14:49:22 +00:00
Adam Reichold a053489c8b
Merge pull request #2709 from davidhewitt/py3.12
ci: add Python 3.12-dev jobs
2023-06-12 08:59:35 +00:00
David Hewitt 621898b07d ci: add Python 3.12-dev jobs 2023-06-11 21:57:17 +01:00
David Hewitt 46942b9a14 docs: remove workarounds for `#[doc = concat!(...)]` following msrv bump 2023-06-08 21:04:49 +01:00
David Hewitt 72d1805109 fix pypy 3.10 ffi definitions 2023-06-08 07:51:10 +01:00
Adam Reichold 0d30bb7d3d Bump Rust edition to 2021 and make current Clippy happy. 2023-06-07 21:15:38 +02:00
Adam Reichold 6f987263c1 Remove cfg addr_of made unnecessary by MSRV bump. 2023-06-05 11:12:06 +02:00
Adam Reichold eb04f54683 Remove cfg min_const_generics made unnecessary by MSRV bump. 2023-06-05 09:42:40 +02:00
Adam Reichold 5738edfdd4 Bump MSRV to 1.56 2023-06-04 23:02:30 +01:00
David Hewitt 2500e22e13 release: 0.19.0 2023-05-31 13:53:37 +01:00
Adrian Garcia Badaracco 16d333f9d0
Add BaseExceptionGroup for Python >= 3.11 2023-05-07 15:08:43 -05:00
David Hewitt bfcc1f8c27 update release notes for 0.18.3 2023-04-13 22:47:55 +01:00
ijl 88b46a7029 PEP 623: wstr, wstr_length, state changes
https://peps.python.org/pep-0623/

	Following members are removed from the Unicode structures:

	    wstr
	    wstr_length
	    state.compact
	    state.ready

Note state.compact is still present as of v3.12.0a7.

state.interned has changed width from 2 to 1 bits.
2023-04-11 12:51:42 +00:00
ijl 6ee2174fec Define _PyDict_Contains_KnownHash() FFI for CPython 3.10 or later 2023-04-09 14:36:42 +00:00
bors[bot] ba6261c8e7
Merge #3015
3015: Implement wrapper for `PyASCIIObject.state` bitfield accesses r=davidhewitt a=decathorpe

This is a first draft of my attempt to fix #1824 "properly" by writing a C wrapper for the `PyASCIIObject.state` bitfield accesses, as proposed here: https://github.com/PyO3/pyo3/issues/1824#issuecomment-1406909504

---

The original argument for making these functions `unsafe` is still valid, though - bitfield memory layout is not guaranteed to be stable across different C compilers, as it is "implementation defined" in the C standard. However, short of having CPython upstream provide non-inlined public functions to access this bitfield, this is the next best thing, as far as I can tell.

I've removed the `#[cfg(target_endian = "little")]` attributes from all things that are un-blocked by fixing this issue on big-endian systems, except for three tests, which look like expected failures considering that they do not take bit/byte order into account (for example, when writing to the bitfield).

- `ffi::tests::ascii_object_bitfield`
- `types::string::tests::test_string_data_ucs2_invalid`
- `types::string::tests::test_string_data_ucs4_invalid`

All other tests now pass on both little-endian and big-endian systems.

---

I am aware that some parts of this PR are probably not in a state that's acceptable for merging as-is, which is why I'm filing this as a draft. Feedback about how to better integrate this change with pyo3-ffi would be great. :)

In particular, I'm unsure whether the `#include` statements in the C files are actually correct across different systems. I have only tested this on Fedora Linux so far.

I'm also open to changing the names of the C functions that are implemented in the wrapper. For now I chose the most obvious names that shouldn't cause collisions with other symbols.

Co-authored-by: Fabio Valentini <decathorpe@gmail.com>
2023-03-28 07:27:02 +00:00
Fabio Valentini 40d6d4797f
Add wrapper for PyASCIIObject state bitfield accesses based on bindgen 2023-03-26 17:11:01 +02:00