David Hewitt
f17e703167
return existing module on Python 3.9 and up
2023-09-23 11:13:39 +01:00
David Hewitt
1338020511
relax multiple-import check to only prevent subinterpreters
2023-09-23 11:13:39 +01:00
David Hewitt
5798caf1f8
better `Some`-wrapping for default arguments
2023-09-21 21:14:44 +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
e28403e772
call PyObject_GC_Untrack before deallocating
2023-09-09 22:29:58 +01:00
David Hewitt
16728c4da2
move PyDict::get_item_with_error to PyDict::get_item
2023-09-09 12:23:06 +01:00
David Hewitt
e67b283b25
Merge pull request #3358 from alex/ptr-unsafe-trait
...
fixes #3325 -- mark `AsPyPointer` as `unsafe trait`
2023-09-04 05:05:56 +00:00
David Hewitt
9e089a5538
fix chrono deprecation warnings
2023-09-02 20:55:53 +01:00
Ryan Lowe
b3cf61cea6
add types for built-in singletons
2023-08-26 08:57:34 -04:00
Adam Reichold
12183ad3ed
Merge pull request #3379 from iliya-malecki/main
...
BigInt speedup
2023-08-19 12:09:28 +00: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
Adam Reichold
94f15679ab
Merge pull request #3402 from Tpt/io-err-unwrap
...
Unwrap the underlying PyErr when converting an io::Error back to a PyErr
2023-08-18 16:56:53 +00:00
David Hewitt
15388fd53b
Merge pull request #3401 from messense/fix-issue-3400
...
Fix memory leak in `PyTypeBuilder::build`
2023-08-18 14:28:36 +00:00
Alex Gaynor
df5aa77800
fixes #3325 -- mark `AsPyPointer` as `unsafe trait`
2023-08-18 10:16:34 -04:00
Tpt
6d8e8b302f
Unwrap the underlying PyErr when converting an io::Error back to a PyErr
...
Exposes it directly instead of loosing all information outside the message
2023-08-18 15:56:25 +02:00
messense
2dc1e9a2b7
Fix memory leak in `PyTypeBuilder::build`
2023-08-18 21:13:13 +08:00
David Hewitt
c03c787a91
Merge pull request #3393 from alex/drop-other-trait
...
Remove usage of `AsPyPointer` in `IntoPy<PyObject>` trait implementation
2023-08-18 12:58:07 +00:00
David Hewitt
7f32ed96db
Merge pull request #3396 from Tpt/IntoInnerError
...
Uses io::Error code when converting io::IntoInnerError to PyErr
2023-08-18 08:27:35 +00:00
Tpt
1062f244ea
Pick a relevant ErrorKind when building an io::Error from a OSError subclass
2023-08-17 18:33:51 +02:00
Tpt
7c366cb930
Uses io::Error code when converting io::IntoInnerError to PyErr
2023-08-17 18:25:36 +02:00
Alex Gaynor
9f1b56b659
Remove usage of `AsPyPointer` in `IntoPy<PyObject>` trait implementation
2023-08-17 07:05:52 -04:00
Iliya Malecki
d1f0561036
added speedy BigInt extraction
2023-08-17 08:15:50 +01:00
Adam Reichold
9363491d54
Merge pull request #3384 from DataTriny/pyclass_rename_variants
...
Add `rename_all` attribute to `#[pyclass]`
2023-08-16 19:06:37 +00:00
David Hewitt
0375d57989
Merge pull request #3391 from alex/drop-trait
...
Remove usage of `AsPyPointer` in traits for convergint to PyObject
2023-08-16 16:39:46 +00:00
Alex Gaynor
c259e77ca2
Remove usage of `AsPyPointer` in traits for convergint to PyObject
...
Refs #3358
2023-08-16 07:03:57 -04:00
David Hewitt
eba2c59778
tidy up some file locations after dual licensing
2023-08-16 08:22:51 +01:00
David Hewitt
82b1e55e2b
Merge pull request #3389 from alex/less-as-py-pointer
...
Migrate `PyIterator::from_object` and `PyByteArray::from` from `AsPyPointer` to `&PyAny`
2023-08-15 23:12:28 +00:00
Alex Gaynor
1a904a7429
Migrate `PyIterator::from_object` and `PyByteArray::from` from `AsPyPointer` to `&PyAny`
2023-08-15 18:03:56 -04:00
DataTriny
b222dbbbcc
Add a release note entry
2023-08-15 23:39:45 +02:00
DataTriny
f02fe9478d
Make rename_all accept a renaming rule, allow applying it to classes as well
2023-08-15 10:15:48 +02:00
David Hewitt
43b37109de
Revert "Fix the pydebug with trace refs and count_allocs for python > 3.7"
...
This reverts commit c780aa931d
.
2023-08-15 08:41:22 +01:00
Alex Gaynor
5061b501a9
Remove IntoPyPointer
...
it wasn't used in any public APIs following #3359
2023-08-14 16:28:20 -04:00
DataTriny
a9e9ec628d
Add attribute to
2023-08-13 18:25:07 +02:00
David Hewitt
a541925f00
Merge pull request #3359 from davidhewitt/py-pointer-methods
...
add as_ptr and into_ptr inherent methods
2023-08-11 19:50:22 +00:00
David Hewitt
8031794f2a
Merge pull request #3378 from GoldsteinE/implicit-builtins
...
add `__builtins__` to globals in `py.run()` if they're missing
2023-08-11 14:11:31 +00:00
Goldstein
0be94a5442
add `__builtins__` to globals in `py.run()` if they're missing
...
Python code doesn't like to run without `__builtins__`, so adding them
if missing seems to be a good idea. Also that's what CPython >3.10 does.
See https://github.com/python/cpython/pull/24564
Resolves #3370
2023-08-11 15:48:05 +03:00
David Hewitt
5d7dfe2e95
update pydebug.rs for Python 3.12
2023-08-11 11:54:16 +01:00
David Hewitt
64adab1a76
add as_ptr and into_ptr inherent methods
2023-08-11 10:49:42 +01:00
Tpt
dd04d2c4cc
Fixes linking of `PyOS_FSPath` on PyPy.
2023-08-09 16:19:17 +02:00
Tpt
1e5a49557d
Makes PathBuf FromPyObject implementation work on all os.PathLike
...
PyOS_FSPath is in abi3-py36
2023-08-08 22:15:56 +02:00
Adam Reichold
a371fbe4f8
Implement DoubleEndedIterator for PyListIterator by caching the length while still validating it before access.
2023-08-07 21:37:50 +02:00
Adam Reichold
4ce3e9649f
Implement DoubleEndedIterator for PyTupleIterator
2023-08-07 21:37:50 +02: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
Juniper Tyree
ab783234c8
Added newsfragment
2023-07-29 07:43:17 +00:00
David Hewitt
e2c88d5a4e
optimize `float` -> `f64` conversions on non-abi3
2023-07-28 20:45:37 +01:00
David Hewitt
34881fc952
add PyAny::downcast_exact
2023-07-28 15:11:56 +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
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
ab078258d1
fix exception handling on Python 3.12
2023-07-19 22:33:25 +01:00
Zak Stucke
31b21a71b5
Combined changelog lines
2023-07-19 12:51:14 +03:00
Zak Stucke
f2b7e86e2e
Prevent traceback loss on conversion to and from PyErr
2023-07-19 12:07:41 +03:00
David Hewitt
2e2dde910a
Preserve panic message after exception is normalized
2023-07-18 22:20:41 +01:00
David Hewitt
6f30215566
collect arrays of objects prior to filling tuple in fixed-size conversions
2023-07-16 20:17:02 +01:00
David Hewitt
92b724f64f
normalize exception in `PyErr::matches` and `PyErr::get_type`
2023-07-14 13:18:30 +01:00
Adam Reichold
ff78b92e77
Start adding a performance section to the guide.
2023-07-09 14:32:59 +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
Adam Reichold
54ab9090be
Merge pull request #3269 from grantslatton/timezone-conversion-bugfix
...
Fix fixed offset timezone conversion bug.
2023-07-04 18:22:13 +00: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
0e9c041e97
Merge pull request #3289 from davidhewitt/pypy-3.10
...
support PyPy 3.10
2023-07-03 12:53:16 +00:00
David Hewitt
9f2176c126
support PyPy 3.10
2023-07-03 11:26:45 +01:00
Alex Gaynor
0b78bb851e
Allow `#[new]` to return existing instances
...
fixes #2384
2023-07-02 19:57:53 -04:00
Adam Reichold
e006b34b5e
Apparently, PySet_Add does not steal a reference, hence we should not forget to clean up ours.
2023-07-02 20:43:43 +02:00
Adam Reichold
afc1d4cc42
Merge pull request #3281 from davidhewitt/set-discard
...
handle exceptions properly in `PySet::discard`
2023-06-28 17:09:01 +00:00
David Hewitt
c0b9502c0e
handle exceptions properly in `PySet::discard`
2023-06-28 08:54:06 +01:00
David Hewitt
4867ef8dd3
stop suppressing unrelated exceptions in `PyAny::hasattr`
2023-06-27 23:20:22 +01:00
Adam Reichold
b5a1ca058d
Extended range of supported versions of `indexmap` optional dependency to include version 2.
2023-06-26 23:23:12 +02:00
David Hewitt
db91642bae
add `PyDict::get_item_with_error` for PyPy
2023-06-25 19:26:08 +01:00
Grant Slatton
b1e7ed8a58
Fix fixed offset timezone conversion bug.
...
See https://github.com/PyO3/pyo3/issues/3267
2023-06-25 11:06:46 -07:00
Adam Reichold
d7e147509b
Add Python::with_pool as a safer alternative to Python::new_pool.
2023-06-21 08:05:19 +02:00
Adam Reichold
71ed4e17c7
Merge pull request #3256 from PyO3/dependabot/cargo/unindent-0.2.1
...
Update unindent requirement from 0.1.4 to 0.2.1
2023-06-20 20:05:17 +00:00
Adam Reichold
430716ff4d
Add changelog entry for bumping hashbrown dependency.
2023-06-20 19:41:45 +02:00
Adam Reichold
689033cd80
Extend changelog of indoc bump to include related unindent change as well.
2023-06-20 19:41:02 +02:00
David Hewitt
bdf51ab241
Merge pull request #3248 from ijl/py312-exc
...
Add PyErr_GetRaisedException(), PyErr_SetRaisedException() to FFI
2023-06-18 21:45:14 +00: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
David Hewitt
e55e1721a5
Merge pull request #3222 from krpatter-intc/getitem_example
...
simple getitem example
2023-06-16 06:58:49 +00:00
Patterson, Kevin R
4fab62545a
simple getitem example
2023-06-15 16:39:25 -05:00
David Hewitt
527f3c286b
Merge pull request #3239 from alex/syn-2
...
Upgrade to syn 2
2023-06-14 16:49:25 +00:00
Alex Gaynor
afbb1d435c
Upgrade to syn 2
2023-06-14 07:03:33 -04:00
Adam Reichold
4bfa5be616
Merge pull request #3238 from davidhewitt/version-bumps
...
add changelog for #3237
2023-06-14 06:08:22 +00:00
Adam Reichold
ba0c7e15b3
Merge pull request #3156 from adriangb/frozenset-ops
...
Add `PyFrozenSetBuilder`
2023-06-14 06:06:32 +00:00
David Hewitt
80c66ecc95
add changelog for #3237
2023-06-13 22:41:24 +01:00
David Hewitt
4f3fcdbf0f
remove all functionality deprecated in PyO3 0.18
2023-06-13 22:27:43 +01:00
Adrian Garcia Badaracco
a28641af68
Add `PyFrozenSetBuilder`
2023-06-13 15:59:35 -05:00
David Hewitt
199261f436
Merge pull request #3197 from mhils/ipaddr
...
Add `IpAddr` <-> `ipaddress.IPv(4/6)Address` conversion
2023-06-12 04:00:43 +00:00
Maximilian Hils
980f05a88e
Add `IpAddr` <-> `ipaddress.IPv(4/6)Address` conversion
2023-06-08 13:17:45 +02:00
bors[bot]
dbf7b233aa
Merge #3203
...
3203: support ordering magic methods for `#[pyclass]` r=adamreichold a=davidhewitt
Closes #2089
This adds `__lt__`, `__le__`, `__eq__`, `__ne__`, `__gt__`, and `__ge__` as per the Python implementations of what we call `__richcmp__`.
There's a UI test confirming that the user cannot implement split forms and `__richcmp__` simultaneously.
There's also a benchmark comparing implementing these split methods against using `__richcmp__`. I couldn't see a meaningful performance difference, so I'm tempted to deprecate `__richcmp__`, given that's not a magic method which exists in Python. Potentially we can provide options such as the opt-in `#[pyclass(eq, ord)]` to avoid boilerplate for people who don't want to implement six different methods.
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2023-06-05 07:13:23 +00:00
Adam Reichold
5738edfdd4
Bump MSRV to 1.56
2023-06-04 23:02:30 +01:00
David Hewitt
8850d5d384
support ordering magic methods for `#[pyclass]`
2023-06-04 13:58:18 +01:00
bors[bot]
fa949ff627
Merge #3198
...
3198: Add abi3 + num_bigint conversion r=davidhewitt a=youknowone
<!--
Please consider adding the following to your pull request:
- an entry for this PR in newsfragments - see [https://pyo3.rs/main/contributing.html#documenting-changes ]
- docs to all new functions and / or detail in the guide
- tests for all new or changed functions
PyO3's CI pipeline will check your pull request. To run its tests
locally, you can run ```cargo xtask ci```. See its documentation
[here](https://github.com/PyO3/pyo3/tree/main/xtask#readme ).
-->
Fix #3196
Co-authored-by: Jeong YunWon <jeong@youknowone.org>
2023-06-02 19:06:50 +00:00
Jake Lishman
8d98b4248e
Fix `abi3` conversion of `__complex__` classes
...
Python classes that were not `complex` but implemented the `__complex__`
magic would have that method called via `PyComplex_AsCComplex` when
running against the full API, but the limited-API version
`PyComplex_RealAsDouble` does not attempt this conversion. If the input
object is not already complex, we can call the magic before proceeding.
2023-06-02 10:09:45 +01:00
Jeong YunWon
6d830e05cd
Add abi3 + num_bigint conversion
2023-06-02 16:17:49 +09:00