Commit graph

108 commits

Author SHA1 Message Date
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
David Hewitt e7e58ba51e update release notes for 0.18.2 2023-03-24 20:40:06 +00:00
Matti Picus a7cc5952c7
Conditionally mangle the function name
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2023-03-14 09:21:35 +11:00
Matti Picus 0f1ff1d852 mangle exported functions for PyPy 2023-03-12 08:40:12 +11:00
David Hewitt fbebc285c0 fix const-ness of some FFI name & doc members 2023-03-10 16:02:52 +00:00
Matti Picus 8446414f3b mangle exported functions for PyPy 2023-03-10 07:27:38 +11:00
David Hewitt 92cca896de release notes for 0.18.1 2023-02-07 21:38:07 +00:00
David Hewitt 5bab0e9409 use simplified PyIter_Check on CPython 3.7 2023-02-03 07:55:44 +00:00
David Hewitt f4953224d8 correct ffi definition of PyIter_Check 2023-01-29 19:43:33 +00:00
Samuel Colvin 3c9ace03d8 add Ellipsis() and is_ellipsis() methods, fix #2906 2023-01-27 06:40:02 +00:00
David Hewitt 224a4160b4 release: 0.18.0 2023-01-17 19:04:30 +00:00
bors[bot] cedb5aecb2
Merge #2843
2843: remove functionality deprecated in 0.16 r=davidhewitt a=davidhewitt

Simple cleanup to remove all functionality marked deprecated in the 0.16 releases.

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-12-28 12:24:59 +00:00
David Hewitt f2608a923c remove functionality deprecated in 0.16 2022-12-28 12:23:53 +00:00
bors[bot] 31c42cc2c8
Merge #2838
2838: pypy: re-enable PyFunction on 3.8+ r=davidhewitt a=davidhewitt

PyPy [fixed the crashes associated with `PyFunction](https://foss.heptapod.net/pypy/pypy/-/issues/3776#note_191626)  in PyPy 7.3.10 (for 3.8+) - which I think is to be released shortly. So I think we should re-enable this API and treat it as a PyPy bug which users can mitigate by updating their PyPy.

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-12-27 21:40:57 +00:00
mejrs faa578a7c5 fix PyUnicodeDecodeError_Create 2022-12-27 16:13:32 +00:00
David Hewitt 24032fe110 pypy: re-enable PyFunction on 3.8+ 2022-12-27 14:32:43 +00:00
David Hewitt 4a6b24ea07 adjust vectorcall symbols for pypy 2022-12-17 11:07:30 +00:00
ijl d5a31706c6 Define _PyErr_ChainExceptions() FFI for CPython
This appears to be the only way to chain exceptions via the FFI. It
was introduced prior to CPython 3.7. It has some description of usage
in PEP 490. There was a discussion of whether it should be made stable
in BPO 44938.
2022-12-01 15:25:56 +00:00
David Hewitt 97487ffbb5 add abi3-py311 feature 2022-11-23 08:08:12 +00:00
Georg Brandl 4a2e6bd51a ffi: fixup bytesobject/dictobject on PyPy
Fixes #2758
2022-11-20 11:31:24 +01:00
Georg Brandl 68e82ec962 ffi: link to _PyPyBytes_Resize
Fixes #2737
2022-11-19 12:25:11 +01:00
Georg Brandl 1d20f2a531
Export warning classes and add PyErr::warn_explicit() (#2742) 2022-11-17 19:30:48 +01:00
Adam Reichold 694ef1ea39 Make Clippy happy again by removing supposedly unnecessary casts. 2022-11-15 21:50:29 +01:00
Itamar Turner-Trauring 6746ff8216
Python 3.7 support for PyCodeObject. (#2726)
* Python 3.7 support for PyCodeObject.

Co-authored-by: Itamar Turner-Trauring <itamar@pythonspeed.com>
2022-11-08 21:06:05 +00:00
David Hewitt 548e90fcec release: 0.17.3 2022-11-01 20:47:46 +00:00
messense 736e97556d
Disable PyModule::filename on PyPy 2022-10-31 15:45:50 +08:00
David Hewitt bd40011e93 release: 0.17.2 2022-10-04 08:13:53 +01:00
David Hewitt 8102ad1a1b rust: updates for 1.64 2022-09-22 21:03:34 +02:00
David Hewitt caaf7bbda7 release: 0.17.1 2022-08-28 08:27:56 +01:00
David Hewitt 04c1ac87f1 release: 0.17.0 2022-08-23 21:21:19 +01:00
mejrs 26fe75e9b5 Also update the readme 2022-08-23 13:54:11 +02:00
mejrs 5b845d3b1a Improve pyo3-ffi example 2022-08-22 22:27:05 +02:00
mejrs 3845e3fe33 Make a way to make const zeroed PyMethodDef 2022-08-22 22:25:02 +02:00
David Hewitt 88ad288345 ffi: swap field order in PyCodeObject for 3.11 2022-08-19 09:28:57 +01:00
David Hewitt 218ef6cd83 ffi: more fixes for Python 3.11 rc1 2022-08-16 18:17:50 +01:00
David Hewitt 1e73ef67f2 ffi: fixes to 3.11 bindings 2022-08-14 14:23:24 +01:00
David Hewitt c58ff7758c pypy: disable PyFunction 2022-08-13 17:51:10 +01:00
messense 3c0520da83
Add FFI definitions for Py_EnterRecursiveCall and Py_LeaveRecursiveCall (#2511)
* Add FFI definitions for `Py_EnterRecursiveCall` and
`Py_LeaveRecursiveCall`

* Update pyo3-ffi/src/ceval.rs

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-07-15 15:45:15 +08:00
David Hewitt 7babd13830 datetime: support timezone bindings 2022-07-13 22:05:17 +01:00
Andrew Burkett 3fd0c0e142
Fix PyObject_CallNoArgs python version cfg (#2476)
* Fix PyObject_CallNoArgs python version cfg

PyObject_CallNoArgs was added to python 3.9 but not to limited api until 3.10 per https://docs.python.org/3/c-api/call.html#c.PyObject_CallNoArgs

* Update change log

* Fix uses of PyObject_CallNoArgs

Co-authored-by: Andrew Burkett <andrew.burkett@crowdstrike.com>
2022-06-23 21:31:44 +01:00
David Hewitt 866ddaca8a ffi: tidy descrobject.rs 2022-06-07 19:45:36 +01:00
Alex Gaynor 9cfbdeca78 ffi: fixes for field names/presence
pyo3-ffi-check now passes for me on 3.9
2022-06-05 07:39:17 -04:00
David Hewitt 6f4e84f25f ffi: more pypy fixes 2022-06-05 09:24:46 +01:00
David Hewitt 9300bff551 ffi: field fixes from pyo3-ffi-check 2022-06-05 08:17:14 +01:00
Alex Gaynor e1c8bda4ee
fixed name of initfunc field on _inittab 2022-06-04 22:15:51 -04:00