Moritz Langenstein
a877300f72
Added Rust initialisation of Python-allocated bytes ( #1074 )
...
* Added Rust initialisation of Python-allocated bytes
* Added unsafe PyBytes::new_with_unit constructor
* Added examples to PyBytes::new_with and PyBytes::new_with_uninit (now with MaybeUninit<u8>)
* Fixed doc test imports for PyBytes::new_with and PyBytes::new_with_uninit
* Fixed clippy error in PyBytes::new_with_uninit test
* Added PyByteArray::new_with and Removed PyBytes::new_with_uninit
* Small doc fixes + FnOnce init closure for PyBytes::new_with and PyByteArray::new_with
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
* Fixed where clause formatting in PyBytes::new_with and PyByteArray::new_with
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2020-08-03 09:04:06 +01:00
David Hewitt
80224207cc
Merge pull request #1075 from davidhewitt/update-pr-template
...
Update PR template
2020-08-02 13:41:21 +01:00
Yuji Kanagawa
aaeb5eab54
Merge pull request #1067 from davidhewitt/pyerr-send
...
Make `PyErr: Send + Sync`
2020-08-02 17:49:11 +09:00
David Hewitt
7b36f3a44b
Apply suggestions from kngwyu
...
Co-authored-by: Yuji Kanagawa <yuji.kngw.80s.revive@gmail.com>
2020-08-02 02:08:47 +01:00
David Hewitt
52f7429748
Update PR template
2020-08-02 01:09:52 +01:00
Yuji Kanagawa
51171f7475
Merge pull request #1071 from kngwyu/ref-self-regression
...
Enable &Self in #[pymethods] again
2020-07-29 00:30:38 +09:00
kngwyu
f5f2e84f4b
Enable &Self in #[pymethods] again
2020-07-28 20:55:38 +09:00
David Hewitt
09aef5d299
Make PyErr: Send + Sync
2020-07-25 11:59:44 +01:00
Yuji Kanagawa
b05eb4814b
Merge pull request #1060 from sebpuetz/memoffset
...
Calculate offsets for weakreflist and dict in PyCell.
2020-07-21 18:53:29 +09:00
Yuji Kanagawa
4563e00a67
Add testcase for unsendable, dict, weakref pyclass.
2020-07-21 10:42:36 +02:00
Sebastian Puetz
43d1f43c72
Calculate offsets for weakreflist and dict in PyCell.
2020-07-21 10:38:20 +02:00
David Hewitt
4cf0db0476
Merge pull request #1058 from sebpuetz/dict-unsendable
...
Move the ThreadChecker field in front of dict and weakref.
2020-07-20 19:21:30 +01:00
Sebastian Puetz
e75f768ea8
Move the ThreadChecker field in front of dict and weakref.
...
Offsets for dict and weakref are calculated from the end of the
PyCell struct. When using the non-dummy ThreadChecker, the offsets
were invalid since the `ThreadCheckerImpl` is not zero-sized.
2020-07-20 19:37:38 +02:00
Yuji Kanagawa
be67a152ce
Merge pull request #1054 from davidhewitt/cleanup-pyerr-hidden-apis
...
Remove hidden PyErr::restore_and_minus1 and PyErr::restore_and_null
2020-07-20 12:29:27 +09:00
David Hewitt
a97e641622
Merge pull request #1052 from vorner/pyo3-docs
...
docs: Link to pyo3-log in README and the guide
2020-07-19 23:24:54 +01:00
David Hewitt
0764362d17
Remove hidden PyErr::restore_and_minus1 and PyErr::restore_and_null
2020-07-19 22:39:41 +01:00
Michal 'vorner' Vaner
e6dd2d980f
docs: Link to pyo3-log in README and the guide
...
Show how one can log from Rust through the Python's logging facilities.
Related to #1016 .
2020-07-19 22:01:22 +02:00
David Hewitt
25053599b7
Merge pull request #1053 from sebpuetz/conversion-matches
...
Remove explicit matches in conversions.
2020-07-19 13:25:21 +01:00
Sebastian Puetz
77d03d01f3
Remove explicit matches in conversions.
...
Don't explicitly match Options and Results if only one of the
variants is changed.
2020-07-19 13:26:59 +02:00
David Hewitt
53a248c617
Merge pull request #1050 from sebpuetz/conversion-errors
...
Add type info to conversion errors.
2020-07-19 12:01:31 +01:00
David Hewitt
a058eb5201
Remove redundant lifetimes
2020-07-19 11:23:07 +01:00
Sebastian Puetz
63d6d4c0e2
Add type info to conversion errors.
2020-07-19 12:08:14 +02:00
David Hewitt
a1dc970e22
Merge pull request #1051 from davidhewitt/pyiterator-from-object
...
Change PyIterator::from_object` to return underlying TypeError
2020-07-19 08:43:37 +01:00
David Hewitt
41b35b84ca
Merge pull request #1024 from davidhewitt/py-exception
...
Rework exceptions to be native types
2020-07-18 22:16:33 +01:00
David Hewitt
264e8854c6
Merge pull request #1048 from davidhewitt/fix-from-type-ptr-doc
...
Fix doc for PyType::from_type_ptr
2020-07-18 12:01:05 +01:00
Yuji Kanagawa
8bbdbc4937
Merge pull request #1047 from davidhewitt/cast-to-ptr-is-safe
...
Functions which cast reference to pointer are not unsafe.
2020-07-18 19:52:06 +09:00
David Hewitt
2a36863ebc
Merge pull request #1046 from davidhewitt/py-type
...
Replace internal uses of (*o).ob_type with Py_TYPE(o)
2020-07-18 10:28:42 +01:00
David Hewitt
602080d397
Change PyIterator::from_object` to return underlying TypeError
2020-07-18 09:39:49 +01:00
Yuji Kanagawa
d9d095cd27
Merge pull request #1049 from davidhewitt/fix-clippy-useless-conversion
...
Fix clippy warning of useless conversion
2020-07-18 16:50:38 +09:00
David Hewitt
4ed9748b45
Rename exceptions to PyException etc; reintroduce deprecated ones
2020-07-18 06:02:57 +01:00
David Hewitt
a7e0c6bfa7
Make exceptions proper native types.
2020-07-18 01:57:39 +01:00
Simonas Kazlauskas
496c626835
Proto #1 : Exception instances as Py<BaseException>
...
This prototype implements use of Py<BaseException> as the instance to
use for exception instances. These instances integrate reasonably well
with the Rust’s standard error mechanisms by implementing the `Display`
and `Error` traits. These error types can also be stored into e.g.
`failure::Fail`s or other error types as a cause of some greater error.
2020-07-18 01:57:39 +01:00
David Hewitt
9f3e13ef4d
Fix doc for PyType::from_type_ptr
2020-07-17 19:53:20 +01:00
David Hewitt
3341d10e7f
Functions which cast reference to pointer are not unsafe.
2020-07-17 19:52:32 +01:00
David Hewitt
45533d6f96
Replace internal uses of (*o).ob_type with Py_TYPE(o)
2020-07-17 19:51:56 +01:00
David Hewitt
c6aa7a8a47
Fix clippy warning of useless conversion
2020-07-17 19:06:56 +01:00
David Hewitt
525f523e55
Merge pull request #1043 from cathay4t/master
...
Remove executable bit of rust source file
2020-07-16 07:17:37 +01:00
Gris Ge
b65ae9140e
Remove executable bit of rust source file
...
When compiling as rpm in Fedora, the brp-mangle-shebangs[1] will
complain about src/lib.rs is executable without valid shebang.
Remove the executable bit could fix this.
[1]: https://src.fedoraproject.org/rpms/redhat-rpm-config/blob/master/f/brp-mangle-shebangs
Signed-off-by: Gris Ge <cnfourt@gmail.com>
2020-07-16 13:26:25 +08:00
David Hewitt
6c62fedf22
Merge pull request #1037 from davidhewitt/with-gil
...
Add `Python::with_gil`
2020-07-15 07:53:58 +01:00
David Hewitt
c15c1e6217
Merge pull request #1038 from PyO3/davidhewitt-patch-5
...
Fix typo in comment
2020-07-13 22:52:16 +01:00
David Hewitt
4020e4d0c8
Add Python::with_gil
2020-07-13 22:37:40 +01:00
David Hewitt
65d2eec402
Fix typo in comment
2020-07-13 22:00:31 +01:00
David Hewitt
cfa5b2e013
Merge pull request #1029 from davidhewitt/asbytearray-mut
...
Fix definition of _PyLong_AsByteArray
2020-07-09 23:12:50 +01:00
David Hewitt
b1a37afa8c
Fix definition of _PyLong_AsByteArray
2020-07-09 16:38:01 +01:00
Yuji Kanagawa
70ad10c62e
Merge pull request #1030 from davidhewitt/changelog-corrections
...
Correct CHANGELOG entries
2020-07-09 18:58:36 +09:00
David Hewitt
5d07bbb50f
Correct CHANGELOG entries
2020-07-09 09:32:58 +01:00
David Hewitt
bd97b258ed
Merge pull request #1027 from noam93k/bugfix/convert-bigint-index
...
Use the result of __index__ when converting to Rust BigInts.
2020-07-09 09:13:51 +01:00
David Hewitt
e5959f268e
Add CHANGELOG entry
2020-07-09 08:43:56 +01:00
Noam Shalom Kleinburd
8502759bd3
Test conversion of objects implementing __index__ to Rust BigInts.
2020-07-09 08:42:34 +01:00
Noam Shalom Kleinburd
33c328b201
Use the result of __index__ when converting Python objects to Rust BigInts.
2020-07-09 08:42:34 +01:00