Commit Graph

47 Commits

Author SHA1 Message Date
mejrs 984fdf57c7 Use Python:;with_gil in tests 2022-07-19 19:34:23 +02:00
mejrs 2d3a5852ed Avoid UB in *_offset methods 2022-06-12 15:11:39 +02:00
Hood Chatham da5b9814cc
Set up CI for wasm32-emscripten target (#2436)
* ci: test on emscripten target

This adds CI to build libpython3.11 for wasm32-emscripten and
running tests against it. We need to patch instant to work
around the emscripten_get_now:
https://github.com/sebcrozet/instant/pull/47

We also have to patch emscripten to work aroung the "undefined
symbol gxx_personality_v0" error:
https://github.com/emscripten-core/emscripten/issues/17128

I set up a nox file to download and install emscripten,
download and build cpython, set appropriate environment variables
then run cargo test. The workflow just installs python, rust,
node, and nox and runs the nox session.

I xfailed all the test failures. There are problems with datetime.
iter_dict_nosegv and test_filenotfounderror should probably be
fixable. The tests that involve threads or asyncio probably can't
be fixed.

* Some cleanup

* Remove instant patch

* Add explanations for xfails
2022-06-08 05:59:18 +01:00
David Hewitt e33b3e6a5b opt: don't emit T::dict_offset and T::weakref_offset without attributes 2021-12-30 14:57:27 +00:00
David Hewitt 807e126178 pyclass: no need to try inherit base dict and weaklist 2021-12-30 14:17:58 +00:00
David Hewitt 6433d884fc dev: remove self dev dependency 2021-12-08 07:48:58 +00:00
David Hewitt d011467e63 pyclass: allow `#[pyo3(get, set, name = "foo")]` 2021-06-04 11:30:40 +01:00
Georg Brandl 4539e3524b Fix new-in-nightly clippy warning
Example:

error: used `assert_eq!` with a literal bool
   --> src/types/sequence.rs:675:9
    |
675 |         assert_eq!(empty_seq.is_empty().unwrap(), true);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison
2021-05-17 09:59:40 +02:00
David Hewitt 4d46abde73 macros: support `#[pyo3(name = "...")]` 2021-05-07 22:35:52 +01:00
Yuji Kanagawa f0763f069e
Merge pull request #1507 from scalexm/getter-name
Allow `#[name]` with `#[getter]` and `#[setter]`
2021-03-20 16:23:07 +09:00
messense 1c57294214 Use Python::with_gil and py_assert
Co-authored-by: Yuji Kanagawa <yuji.kngw.80s.revive@gmail.com>
2021-03-19 10:17:06 +08:00
messense 773a371ba5 Add tuple and unit struct support for pyclass macro 2021-03-19 10:17:06 +08:00
scalexm b27ee3fd64 Allow `#[name]` with `#[getter]` and `#[setter]` 2021-03-18 19:35:17 +01:00
David Hewitt e19c083a81 ci: fix nightly warnings 2021-03-06 09:42:50 +00:00
Daniil Konovalenko 554cffd60d
add #[pyo3(from_py_with="...")] attribute (#1411)
* allow from_py_with inside #[derive(FromPyObject)]
* split up FnSpec::parse
2021-02-21 00:15:20 +09:00
David Hewitt 5133f81e6d deprecate pyclass name without quotes 2020-12-12 11:11:11 +00:00
scalexm 7dadf59fde Do not include the double quotes in `#[pyclass(name = "literal")]` 2020-11-30 22:04:07 +01:00
Alex Gaynor 400462063d Proof of concept of using PEP384s PyType_Spec 2020-09-02 16:54:39 -04:00
David Hewitt ad76a8a5ce Change unsendable test to use Rust thread 2020-08-08 17:45:41 +01:00
kngwyu 3ae1caa55a Skip panic_unsendable test if -Cpanic=abort is given 2020-06-30 17:58:31 +09:00
kngwyu d76fe7835a Introduce #[pyclass(unsendable)] 2020-06-30 12:30:17 +09:00
David Hewitt 29c93c87c7 Remove GetPropertyValue 2020-05-21 18:06:24 +01:00
David Hewitt f8c8b8effd Fix for PyObject with `#[pyo3(get)]` 2020-02-07 19:31:13 +00:00
Yuji Kanagawa 14980d742d
Merge pull request #755 from davidhewitt/property-doc
Fix docstrings generated by `[pyo3(get, set)]`
2020-02-03 18:14:54 +09:00
David Hewitt dfb7d7c58d Fix docstrings generated by `[pyo3(get, set)]` 2020-02-03 08:01:30 +00:00
David Hewitt 7531b9fb07 Remove even more uses of `static mut` 2020-01-30 13:24:55 +00:00
David Hewitt a8ec946fc3 Fix usage of raw idents with #[pyo3(set)] 2020-01-27 10:29:14 +00:00
kngwyu 8175d6f36a Merge branch 'master' into pyclass-new-layout 2019-12-19 16:12:45 +09:00
David Hewitt 0032508c3c Format code 2019-12-17 22:58:34 +00:00
David Hewitt 4b18830f1e Add `#[name]` attribute support for `#[pyfunction]` 2019-12-17 22:14:28 +00:00
David Hewitt 7702395b3d Add #[name = "foo"] attribute to #[pymethods] 2019-12-17 17:45:53 +00:00
kngwyu a6639076b9 Introduce PyInternalCaster 2019-12-14 23:16:39 +09:00
kngwyu 0f9a3b1194 Expose py_run macro 2019-06-13 18:18:06 +09:00
Alexander Niederbühl 299d325375 Enable setting the module name of a class
This is relevant for pickling objects.
2019-05-08 23:39:22 +02:00
ijl 2bb0d05a30 Drop support for python2 2019-03-29 12:37:26 +00:00
konstin ad590bd158 Some api improvements 2019-02-23 18:01:22 +01:00
konstin 9e53418aad Less feature(specialization) 2019-02-01 18:09:51 +01:00
konstin 328d61ca3b Fix test for python2 2019-02-01 17:15:33 +01:00
konstin c71c116f29 Better trait bounds with PyMethodsProtocol 2019-02-01 16:23:34 +01:00
konstin 936f0153e8 Migrate to rust 2018 2019-02-01 14:23:29 +01:00
konstin 7c0379b13a Remove many specialization uses
From over a hundret "default fn" uses down to 17
2018-08-25 20:48:17 +02:00
konstin 991a8b94d2 More nightly fixes 2018-08-19 20:42:17 +02:00
konstin d59bebcc38 Upgrade from proc_macro to use_extern_macros 2018-07-18 13:08:05 +02:00
konstin 4013d40897 Add `py` prefix to the proc macros and move them into the root module
This is important because `proc_macro_path_invoc` isn't going to be stabilized soon.
2018-07-08 23:33:48 +02:00
konstin 6645708e4f Get rid of #[py*] methods 2018-07-03 20:42:02 +02:00
konstin 80096ae143 rudtfmt the tests
With some careful refactoring alongside
2018-06-15 21:21:12 +02:00
konstin 3e8a36b297 Split up test_class into multiple files 2018-05-02 20:56:11 +02:00