Alex Gaynor
140790b15f
Merge branch 'master' into abi3-merge-master
2020-10-10 10:11:49 -04:00
kngwyu
2e22066feb
Do not test PyPy on Windows
2020-10-08 16:29:50 +09:00
Alex Gaynor
5bfb4674b1
Merge branch 'master' into abi3-merge-master
2020-09-10 17:01:13 -04:00
kngwyu
7a4c5e2960
Merge branch 'master' into abi3
2020-09-10 00:48:20 +09:00
Sebastian Pütz
22881a3c2f
Change add_function, ensure static docstrings.
...
Change add_function to take `&PyCFunction` instead of a wrapper
fn and ensure that dostrings of functions are `&'static str`.
2020-09-09 12:37:37 +02:00
Sebastian Pütz
3214249010
Make python function wrapper creation fallible.
...
Wrapping a function can fail if we can't get the module name.
Based on suggestion by @kngwyu
2020-09-03 15:48:32 +02:00
Sebastian Pütz
5bbca1a052
Set the module of #[pyfunction]
s.
...
Previously neither the module nor the name of the module of
pyfunctions were registered. This commit passes the module and
its name when creating a new pyfunction.
PyModule::add_function and PyModule::add_module have been added and are
set to replace `add_wrapped` in a future release. `add_wrapped` is kept
for compatibility reasons during the transition.
Depending on whether a `PyModule` or `Python` is the argument for the
Python function-wrapper, the module will be registered with the function.
2020-09-03 14:49:28 +02:00
Alex Gaynor
400462063d
Proof of concept of using PEP384s PyType_Spec
2020-09-02 16:54:39 -04:00
David Hewitt
4ed9748b45
Rename exceptions to PyException etc; reintroduce deprecated ones
2020-07-18 06:02:57 +01:00
kngwyu
016800ba4d
Use travis's pypy binary instead of anaconda
2020-06-27 19:45:31 +09:00
David Hewitt
9f9137c6e4
Add ability to return from __next__
/ __anext__
2020-06-23 15:26:28 +01:00
kngwyu
f053bc3881
Fix dealloc implementation to collectly use subtype's tp_free
2020-06-22 10:58:00 +09:00
kngwyu
b70ee9a5ad
Use subclass correctly in tp_new
2020-06-22 01:38:13 +09:00
Alexander Niederbühl
d2c7645bad
Add benchmark for Python threaded word count
...
Add benchmark where the sequential Rust version of the word count is
executed twice to demonstrate parallelism with Python threads. Also
slightly simplify the benchmark functions.
2020-06-05 20:22:20 +02:00
Alexander Niederbühl
bafe269dde
Set debug to False
in word-count example
2020-06-05 16:40:29 +02:00
Alexander Niederbühl
de9aae1e82
Use string slices as function arguments
...
Also use the same names as parameters.
2020-06-05 16:40:29 +02:00
Alexander Niederbühl
4c55fa6b38
Remove unnecessary wrapping of test function
2020-06-05 16:40:29 +02:00
Alexander Niederbühl
eb73105625
Make benchmarks more comparable
2020-06-05 16:40:29 +02:00
Alexander Niederbühl
bcf48c0bd2
Fix clippy lints
2020-06-05 13:53:01 +02:00
Yuji Kanagawa
b3566bc7d9
Merge pull request #830 from oconnor663/maxsize
...
use struct.calcsize("P") rather than platform.machine()
2020-03-29 16:07:57 +09:00
Jack O'Connor
d2c07a87d2
xfail a couple of datetime tests on Python 3.5 + macOS
2020-03-29 15:38:42 +09:00
Jack O'Connor
9e23476221
avoid using platform.architecture() to detect 32-bit-ness in datetime tests
...
Same reasoning as the previous commit.
2020-03-26 14:01:18 -04:00
kngwyu
5280a281c9
Remove GILPool::new_no_pointer
2020-03-26 19:45:32 +09:00
Alexander Niederbühl
0a84c201f7
Revert "Disable segfaulty subclassing by default"
...
This reverts commit 5096f936dc
.
2020-01-12 01:22:32 +01:00
Alexander Niederbühl
3dc5b86f22
Add subclassing testcase which previously caused a segfault
...
Add a testcase from #407 . Both test cases don't segfault after the
change to the #[pyclass] system in #683 .
Closes #407
2020-01-11 18:24:50 +01:00
kngwyu
acb1120c55
Fix examples with the new #[new] API
2019-12-22 23:59:28 +09:00
kngwyu
dadeb17c3a
Fix Windows test
2019-11-17 16:34:55 +09:00
Alexander Niederbühl
defa43015a
Fix handling of invalid utf-8 sequences in PyString::to_string_lossy
2019-10-24 22:45:32 +02:00
Alexander Niederbühl
7aaef51ab0
Define limits for datetime tests as datetime literals
2019-10-21 16:50:43 +02:00
Alexander Niederbühl
ffe4e2f20a
Make datetime range for tests smaller
2019-10-19 18:28:53 +02:00
Alexander Niederbühl
8cdc0b42dd
Fix minimum and maximum for datetime tests
...
Depending on the local timezone one could get
ValueError: year 0 is out of range
2019-10-19 17:56:39 +02:00
Samuele Maci
25564e115a
Trigger garbage collection before and after calling the rust binding
2019-10-11 18:46:21 +02:00
Samuele Maci
9ff41fcd3b
Rename BytesExtractor method names to reflect their actions
2019-10-11 17:59:48 +02:00
Samuele Maci
681996da38
Add assertions around memory_diff in test_pybuffer_doesnot_leak_memory
2019-10-11 16:10:19 +02:00
kngwyu
f1bb043b70
Temporaly skip test_buf_and_str for PyPY
2019-09-23 19:25:27 +09:00
kngwyu
05a1a097a9
Remove mem::forget from PyBuffer::release
2019-09-14 16:56:11 +09:00
kngwyu
e911828b79
Add a test to detect memory leak of bytes->vec conversion
2019-09-07 17:59:19 +09:00
Yuji Kanagawa
5eb7656a5e
Merge branch 'master' into examples-debug
2019-09-07 11:53:00 +09:00
konstin
73947d84b4
Format examples with black ( #590 )
2019-09-06 01:16:09 +02:00
konstin
94f6248d87
Compile examples in debug mode
2019-09-05 13:13:06 +02:00
konstin
5096f936dc
Disable segfaulty subclassing by default
...
See https://github.com/PyO3/pyo3/issues/220 and https://github.com/PyO3/pyo3/issues/407 for details on those segfaults
2019-08-05 11:52:47 +02:00
Alexander Niederbühl
f22708f140
datetime tests: Remove Python 2 compatibility
2019-07-15 08:13:03 +02:00
Alexander Niederbühl
ad0a068a38
Add minimal datetime as testcase which should pass on all platforms
2019-07-15 08:08:51 +02:00
Alexander Niederbühl
f642f19167
Increase MIN_DATETIME_FROM_TIMESTAMP for windows
...
Otherwise test_datetime_from_timestamp will give an OSError. This seems
to be a similar problem as https://bugs.python.org/issue29097
2019-07-15 08:07:14 +02:00
Martin Larralde
99fdafbb88
Allow setting the module name for a pyclass ( #499 )
...
* Add `MODULE` const value to `PyTypeInfo` trait
* Allow setting module name in `pyclass` macro arguments
* Add `$module` argument to `pyobject_native_type` macro in `pyo3::types`
* Set the right module for builtin types in `pyo3::types`
* Add `module` argument to example `word_count.WordCounter` class
* Add `module` argument of `pyclass` macro to guide
* Reformat code using `rustfmt`
* Add tests and entry in CHANGELOG.md for `module` argument in `pyclass`
* Make `$module` parameter in `pyobject_native_type` optional
* Make `pyobject_native_type` declare module as `Some("builtins")` by default
2019-06-03 12:18:44 +09:00
kngwyu
e4287e4e47
Fix datetime example
2019-05-26 00:39:06 +09:00
Azat Ibrakov
134c129edc
Fix installing in 'venv' and datetime tests on Windows ( #472 )
...
* Add failing test
* Complete formatting
* Fix commands execution
* Fix commands execution for Linux
* Extract virtual environment creation/removing into separate functions
* Complete error messages
* Complete examples building
* Use 'venv' independent path
* Call script by dotted path instead of 'source' call
* Add Travis CI script
* Rename variable: 'exec_prefix' -> 'base_prefix'
* Add AppVeyor script
* Remove Rust test
* Complete shell script mode
* Complete path to powershell script
* Use 'pushd'/'popd' instead of 'cd'
* Complete powershell script
* Complete shell script
* Fix setup
* Use 'tox-venv' plugin for 'venv' stdlib module support
* Remove additional 'venv' testing
* Use global environment instead of calling 'set'
* Use 'tox' for AppVeyor, extract commands into 'setup' & 'test' scripts
* Add updating of 'pip' & 'setuptools'
* Add moving in/back from examples directories
* Complete 'pip'/'setuptools' updating
* Complete requirements
* Complete 'word-count' example configuration
* Simplify 'setup' script
* Complete 'rustapi_module' example tests
* Revert formatting
* Complete examples configuration
* Remove redundant annotations
* Add entry in changelog
2019-05-12 22:20:17 +09:00
Georg Brandl
cdabf9e1a5
Make more constructors return &PyX instead of Py<PyX>
...
fixes #405
2019-05-06 10:33:31 +02:00
Paul Ganssle
b9a2d2c89f
Update word-count to support PEP 517 sdists
2019-04-25 07:06:29 -04:00
Paul Ganssle
789c0b842b
Add build backend to pyproject.toml
...
Adding a build-backend key forces PEP 517 with pip >= 19.0, and so it
was left off while there was no PEP 517 support. Now that we have some
tentative PEP 517 support, we can explicitly add this key.
2019-04-25 07:06:29 -04:00