Commit graph

949 commits

Author SHA1 Message Date
kngwyu 02d93346c2 Use Pin<Box> for PyBuffer 2019-06-16 21:53:02 +09:00
Yuji Kanagawa 3e69389e68
Merge pull request #512 from kngwyu/expose-py-run
Expose py_run! macro
2019-06-15 23:50:14 +09:00
kngwyu 503ec1a061 Use unindent crate instead of _indoc_runtime 2019-06-15 01:10:18 +09:00
kngwyu f642dbccb2 Refactor py_run! 2019-06-14 18:58:00 +09:00
kngwyu 8dbb388372 Change add_wrapped to take &impl Fn 2019-06-14 12:42:32 +09:00
kngwyu 0f9a3b1194 Expose py_run macro 2019-06-13 18:18:06 +09:00
konstin dfd5a2abb8 Print error before on class init panic
Inspired by https://github.com/rust-numpy/rust-numpy/issues/97, also fixes some warnings from the latest nightly
2019-06-05 12:01:09 +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
konstin 0279b3d69f Release 0.7.0 2019-05-26 17:27:14 +09:00
kngwyu 4bf448ecaa Complete the PR 2019-05-25 23:19:07 +09:00
Georg Brandl 39d3ceb551 Make PyTuple constructors return &PyTuple 2019-05-25 22:40:32 +09:00
Alexander Niederbühl 6a7090c0b0 Fix some clippy lints 2019-05-16 00:16:23 +02:00
konstin eeeee236fd
Merge pull request #478 from kngwyu/run_returns_empty
Change Python::run to return PyResult<()>
2019-05-12 15:16:17 +02: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
kngwyu 803f18e61d Change Python::run to return PyResult<()> 2019-05-08 15:49:24 +09:00
Georg Brandl cdabf9e1a5 Make more constructors return &PyX instead of Py<PyX>
fixes #405
2019-05-06 10:33:31 +02:00
Alexander Niederbühl c68333c5c2 Fix clippy::len_without_is_empty
Also remove obsolete Python 2 comment and add some punctuation for
consistency.
2019-05-04 15:36:10 +02:00
Alexander Niederbühl d174c6ed23 Fix clippy::type_complexity
Don't use PyResult since no error is returned.
2019-05-04 14:03:24 +02:00
konstin c6a5c054e1
Merge pull request #469 from PyO3/remove_doc_comment
Remove doc-comment
2019-04-28 18:26:51 +02:00
konstin cd15719765 Remove doc-comment 2019-04-28 10:36:32 +02:00
Maarten de Vries 651e28ccbb marshal: Remove unwrapped ffi functions. 2019-04-26 10:10:50 +02:00
Maarten de Vries caa5c7f88a marshal: Add example to documentation of dumps. 2019-04-26 10:10:50 +02:00
Maarten de Vries 739efb1b54 marshal: Use PyAny and PyBytes in safe interface. 2019-04-26 10:10:50 +02:00
Maarten de Vries 35168883b2 Add safe marshal module wrapping unsafe ffi::PyMarhshal_*. 2019-04-26 10:10:50 +02:00
Maarten de Vries 1ebdb9f364 Move marshal module from ffi3 to ffi. 2019-04-26 10:10:50 +02:00
Maarten de Vries 0a5edcb74e Add PyMarshal_* functions to ffi modules. 2019-04-26 10:10:50 +02:00
Alexander Niederbühl 1d92c24db8 Add pypy.md to doctests
At the moment there are no code snippets, but all files in the guide
should be included.
2019-04-24 22:44:47 +02:00
Alexander Niederbühl e912900926 Add mistakenly ignored test again 2019-04-24 22:41:59 +02:00
Yuji Kanagawa 60cd0d09c4
Merge pull request #419 from kngwyu/pyclass-regression
Allow slf: PyRef<Self>/PyRefMut<Self> in pymethods
2019-04-24 14:10:28 +09:00
Yuji Kanagawa 5cc6b55c71
Merge pull request #455 from Alexander-N/clippy
Fix some clippy lints
2019-04-24 12:39:21 +09:00
Alexander Niederbühl faa3feda3f Merge branch 'master' into doctest 2019-04-23 21:58:09 +02:00
Alexander Niederbühl 6d87934ce0 Fix some clippy lints 2019-04-23 21:44:40 +02:00
konstin 7149a1fecb
Bump to 0.7.0-alpha.1 (#457) 2019-04-23 18:55:35 +02:00
kngwyu 09bf9bbf4a Allow slf: PyRef<Self> by replacing Self 2019-04-23 23:16:09 +09:00
kngwyu 5a2b021fda Remove FromPyObject from PyRef
It's invalid
2019-04-23 23:16:09 +09:00
kngwyu b2e01066f0 Introduce FromPyPointer for slf: PyRef/PyRefMut 2019-04-23 23:16:09 +09:00
kngwyu 515c7beac0 Allow slf: Py<Self>/PyRef<Self>/PyRefMut<Self> in pymethods 2019-04-23 23:16:08 +09:00
Omer BenAmram f8bf258602 Support rust extensions for PyPy via cpyext (#393)
* wip

* removed stuff

* removed another change

* implemented minimum amouth of ifdefs to make pypy3 hello world to compile

* implemented minimum amount of ifdefs to make pypy3 hello world to compile

* hacking on build.rs

* compiler is happy!

* few todos remain

* extracted build logic to seperate module

* added pypy test

* finally fixed pypy structs

* removed some todos

* test should now be machine independent

* fixed all pypy3 symbols

* added pypy feature

* removed `is_pypy`

* added pypy2 declerations also

* fix for cpython2

* improved libpypy detection

* added all pypy2 macros

* fixed errneous type

* more fixes

* fix python2 string macros

* modsupport symbol

* fix

* fixed and added many symbols

* fixes

* remove dup

* remove mac-specific config

* fix all name mangling macros

* unite imports

* missing symbol

* fix pybool

* implemented another missing symbol

* it works

* fix merge conflict

* uncomment non default features

* cargo.toml

* Cargo fmt

* small merge fixes

* use newer build version

* whoops

* fix build script

* more build hacks

* some random hiccups

* small fixes

* it builds!

* it builds and runs

* revert everything in FFI2

* revert changes to ffi2

* check python3 for pypy

* tiny fix

* revert ffi2 for real

* revert weird formatting changes

* bring back missing feature

* tiny error

* fix py3.7 issue

* add pypy3.5 6.0 to travis

* remove dbg!

* another tiny fix

* removed some useless annotations, and fixed inlines annotations

* removed `pretty_assertions`

* removed pypy feature from cargo.toml

* fix for Py_CompileStringFlags

* tox runs word_count!

* __dict__ changes are not supported for PyPy

* fix 3.7 and copy comment

* fix test script 😳

* transfer ownership of strings to cpython when possible

* remove cstr! macro

* added missing nuls

* as_bytes() -> b’’ string

* symbol removed by mistake

* properly shim pypy date time API, some tests are passing!

* extension_module tests now not crashing! (some still skipped)

* maybe travis has new pypy version?

* small error on windows (build script)

* fix conditional compilation

* try to make tests run on travis..

* invert condition

* added pytest-faulthandler to facilitate debugging

* correctly name dir

* use full paths

* say —yes to conda

* fix

* syntax error

* change PATH

* fixed a terrible bug with PyTypeObjects in PyPy

* fix PyTypeObject defs

* re-enabled tests!

* all tests are passing!

* make the fix ad-hoc for now

* removed build module

* revert changes that cause an additional GC bug

* prevented buggy test from failing pypy

* removed unused comment

* don’t run coverage on pypy

* removed some erroneous symbols from function calls which are actually macros

* restore py37 pyunicode missing def

* use only `link_name` in PyPy specific declarations

* only setup PyPy when testing against PyPy

* annotation that was eaten during merge

* remove change to  comment by mistake + unnecessary changes to cargo.toml

* xfail dates test only on pypy

* changed comment to be a little more helpful

* cleaned up some warnings

* Update src/ffi3/ceval.rs

Co-Authored-By: omerbenamram <omerbenamram@gmail.com>

* @konstin PR notes

* rustfmt

* some documentation

* if configured via env var only, default to cpython

* remove extra unsafe

* refer users to guide for pypy

* Update guide/src/pypy.md

Co-Authored-By: omerbenamram <omerbenamram@gmail.com>

* Update guide/src/pypy.md

Co-Authored-By: omerbenamram <omerbenamram@gmail.com>

* @konstin applied patch

* check that pypy at least build

* search explicitly for libpypy

* added note about some known unsupported features

* use ld_version

* export PYTHON_SYS_EXECUTABLE to `cargo build` test

* inverted if

* always link pypy dynamically

* remove unused imports

* Apply @kngwyu’s suggestion

* fix tox configuration

* try conda virtualenv

* try to simply not install python at all inside pypy environment

* setup pypy before using “python"

* use system_site_packages

* revert change to .travis

* moved cpyext datetime documentation to module level, and revised it.

* Update src/ffi/datetime.rs

Co-Authored-By: omerbenamram <omerbenamram@gmail.com>

* rustfmt

* Update src/ffi/datetime.rs

Co-Authored-By: omerbenamram <omerbenamram@gmail.com>

* kept only notes that are relevant to users.

* invert if

* use bash and not sh
2019-04-23 13:18:42 +02:00
Alexander Niederbühl 5858823e83 Test readme and user guide with doc-comment
Also rename some files for consistency.
2019-04-19 22:38:11 +02:00
konstin f62f384ecd
Merge pull request #448 from PyO3/fix_442
Properly scope libc to fix #442
2019-04-18 18:46:47 +02:00
konstin 6d80ee0679 Properly scope libc to fix #442
Apparently we can't add a test for that because the test crates have libc
in scope
2019-04-17 19:08:55 +02:00
Georg Brandl 527da127f3 Make Py(Frozen)Set::new return PyResult<&Py(Frozen)Set>
fixes #437
2019-04-17 12:17:58 +02:00
ijl afb82ee875 PyFloat_AS_DOUBLE() 2019-04-16 12:53:03 +00:00
Martin Larralde 60efd5b9c2
Merge pull request #432 from althonos/master
Fix documentation-related bugs
2019-04-14 19:05:59 -07:00
Ivan Enderlin a78465f8b1
doc(types) Fix a typo in PySlice
Thanks for the awesome project!
2019-04-13 20:59:31 -07:00
Martin Larralde 3f4f068c7f Ensure #[getter] doc is exposed as the __doc__ of the descriptor 2019-04-14 00:23:59 +02:00
Martin Larralde 72003ec37a Add entry to CHANGELOG.md 2019-04-04 09:47:21 +02:00
Martin Larralde ad9e676512 Have PyModule generate a __all__ list from its members 2019-04-04 09:43:32 +02:00
Martin Larralde 08334fe582 Fix create_exception macro not using an unsafe impl 2019-03-31 05:40:06 +02:00
Martin Larralde 2c82a03170 Add entry to CHANGELOG.md and fix typo 2019-03-31 05:29:20 +02:00
Martin Larralde d482b715de Fix signatures of PySequenceProtocol methods 2019-03-31 05:28:52 +02:00
konstin 9a9b519bcb Mark PyTypeObject as unsafe 2019-03-30 20:25:47 +01:00
ijl 80179be2b0 Merge num3, num_common to num 2019-03-29 12:37:26 +00:00
ijl fdeef7d67e Merge string and stringutils 2019-03-29 12:37:26 +00:00
ijl 2bb0d05a30 Drop support for python2 2019-03-29 12:37:26 +00:00
konstin 20481e8324 Whitelist clippy error 2019-03-24 17:33:08 +01:00
konstin 97189a16b9 Try fixing cargo fmt on travis ci 2019-03-24 17:19:15 +01:00
konstin f75f742c58 Fix CStr usages 2019-03-20 21:48:41 +01:00
Miles Granger 711155d7ad Update tests & docs with IntoPyDict::into_py_dict(py) 2019-03-20 20:04:00 +01:00
konstin 3e475b052b
Merge pull request #388 from kngwyu/pyany
Rename PyObjectRef with PyAny
2019-03-18 11:04:29 +01:00
konstin 09883574e5 Remove cstr macro 2019-03-18 11:01:55 +01:00
konstin 59a9d4fd9f
Merge branch 'master' into pyany 2019-03-18 01:00:26 +01:00
Alexander Niederbühl 5a3466d1d7 Fix compilation for Python 2 2019-03-17 21:06:26 +01:00
Alexander Niederbühl f79f84a31b Complete __dict__ support
Add `__dict__` slot to tp_getset of type_object. See
https://bugs.python.org/issue16272 for why this is necessary.
2019-03-17 20:31:05 +01:00
Sebastian Köln 7564f76051 fix #398 2019-03-15 15:54:14 +01:00
Alexander Niederbühl 3a6e0a2724 Remove use of INCREF and cnt 2019-03-10 02:49:51 +01:00
Alexander Niederbühl f68ae0cfae Fix flaky tests
The tests were flaky because they took references to the empty tuple
which is a singleton. Use a unique object for each test to make them
independent.
2019-03-06 00:12:30 +01:00
kngwyu f3fe0dfdd5 Move From<PyRef> impl to any.rs 2019-03-04 21:49:43 +09:00
kngwyu c6a6634d8a Move PyAny to any.rs 2019-03-04 14:23:40 +09:00
kngwyu 874d8a0835 Rename PyObjectRef with PyAny 2019-03-04 13:50:43 +09:00
konstin dcce57f4f9
Merge pull request #369 from kngwyu/hide-nativetype
Make PyNativeType unsafe
2019-02-26 23:53:12 +01:00
kngwyu 498689423e Make PyNativeType unsafe 2019-02-25 23:15:13 +09:00
kngwyu 86d239e445 Rename ToPyPointer with AsPyPointer 2019-02-24 16:20:04 +09:00
konstin d3743fec64 Python 2 2019-02-23 18:42:40 +01:00
konstin 6cd07c369c Simpler new and clippy fixes 2019-02-23 18:38:00 +01:00
konstin ad590bd158 Some api improvements 2019-02-23 18:01:22 +01:00
konstin 0cd72ac213 Bump to 0.6.0-alpha.4 2019-02-20 11:30:09 +01:00
konstin 32a15bc4a9
Merge pull request #364 from PyO3/parser_refactoring
Big proc macro refactoring
2019-02-19 22:22:23 +01:00
konstin d02f7c3aa5 Big proc macro refactoring
* Removed a lot of clutter, unified some code
 * Started using syn::parse::Parse for pyfunction attributes 
 * No more newlines between imports
 * Renamed `#[prop(get, set)]` to `#[pyo3(get, set)]`
 * `#[pyfunction]` now supports the same arguments as `#[pyfn()]`
 * Some macros now emit proper spanned errors instead of panics.
2019-02-18 20:07:56 +01:00
kngwyu 8d9b4dd153 Introduce PyDictItem 2019-02-18 16:06:37 +09:00
Chris Jones 5a28a1c4f0 Add PyList.reverse(). 2019-02-17 22:22:46 +00:00
Yuji Kanagawa b01592e201
Merge pull request #359 from chr1sj0nes/pylist_from_iterator
Add support for creating `PyList` from any `IntoIterator` for known s…
2019-02-17 09:50:06 +09:00
Chris Jones e1ffd6c352 Add support for creating PyList from any IntoIterator for known size. 2019-02-16 23:28:03 +00:00
Chris Jones 275e6cb7c8 Add PyList.sort(). 2019-02-15 23:20:02 +00:00
konstin 6cb098ee12 Replace py.init_[ref|mut] with Py[Ref|Mut]::new 2019-02-13 21:52:21 +01:00
konstin 1a489d2829 Make the init methods use a value instead of a function 2019-02-13 13:59:47 +01:00
konstin ce659941e8 Cleanup PyTypeObject and PyTypeCreate 2019-02-13 12:32:59 +01:00
konstin c13f0708a4 Replace IntoPyTuple with IntoPy<Py<PyTuple>> 2019-02-12 22:58:23 +01:00
kngwyu 4a552a88cf Py::new_ref -> PyRef::new 2019-02-08 23:51:14 +09:00
kngwyu f95f4e8c14 Fix python2 test 2019-02-08 14:09:49 +09:00
kngwyu c80134fbcd Refactor PyRef/PyRefMut based on reviews 2019-02-08 13:58:44 +09:00
kngwyu 1d3dd2c343 Write documents of PyRef/PyRefMut 2019-02-07 15:17:27 +09:00
kngwyu 01fc1405b0 Modify AsPyRef::as_ref to return PyRef 2019-02-07 14:27:13 +09:00
kngwyu 22687c3712 Modify PyIterProtocol to take PyRefMut 2019-02-05 17:27:34 +09:00
kngwyu 76e30b5248 Remove ToPyPointer and so on from pyclass 2019-02-04 00:34:06 +09:00
konstin 56f2257e90 rust 2018 fixes 2019-02-01 16:23:34 +01:00
konstin c71c116f29 Better trait bounds with PyMethodsProtocol 2019-02-01 16:23:34 +01:00
konstin ae8a37cd0a Allow 0..n pymethod blocks without specialization 2019-02-01 16:23:34 +01:00
konstin 829f35af5b Migrate to rust 2018 2019-02-01 16:23:34 +01:00
konstin e1154120d1 ffi2 to rust 2018 2019-02-01 16:23:34 +01:00
konstin 0495ee52d3 ffi2 to rust 2018 2019-02-01 15:25:58 +01:00
konstin 936f0153e8 Migrate to rust 2018 2019-02-01 14:23:29 +01:00
konstin 423b5d1099
Merge pull request #327 from StarryInternet/fix-cross-compilation
Implement Basic Cross Compile Support
2019-02-01 13:50:39 +01:00
Matt Pelland 80a6318b43
avoid signedness issues when cross compiling 2019-01-30 18:08:03 -05:00
Alexander Niederbühl df36292523 Add $crate:: prefix in import_exception!
Also change doctest to use Rust 2018 macro includes.
2019-01-28 18:25:02 +01:00
Alexander Niederbühl fbd012601e Fix kwargs
kwargs was broken by a check for the number of given arguments. Only
apply this check if no arbitary number of keyword arguments are allowed
by a "**" parameter of `#[args(...)`.

Closes #318
2019-01-25 00:47:28 +01:00
Joel Höner 262b708de2
Add $crate:: prefix in create_exception! 2019-01-13 22:00:52 +01:00
konstin 5edd263371 rustfmt 2019-01-08 20:18:06 +01:00
konstin 146cb31c59
Merge pull request #317 from PyO3/issue_313
Fix #313
2019-01-08 19:39:25 +01:00
konstin 27520cb683 Fix #313
Thanks to @sumeet for the patch
2018-12-28 20:41:03 +01:00
konstin 322594128c
Merge pull request #316 from kngwyu/arraylist-fix
Fix memory leak in ArrayList
2018-12-28 20:31:26 +01:00
kngwyu bbfe79fa57 Fix memory leak in ArrayList 2018-12-26 20:18:02 +09:00
kngwyu 419884c6ba Use Box::into_raw instead of forget vec 2018-12-26 17:49:08 +09:00
ijl 984751a57f Macro Rust doc 2018-12-21 02:07:43 +00:00
ijl 3452d6544a ffi3 list macros, matching ffi2 2018-12-20 23:32:35 +00:00
Pavel Potoček cbe668a0f4 Add (probably) forgotten type parameters to the pyobject_native_type_convert macro.
This is needed for `rust-numpy` to compile.
2018-12-05 10:56:39 +01:00
ijl b8a6d67e31 PyTryFrom::try_from_mut_unchecked() 2018-12-01 10:27:48 -05:00
ijl d18ebea1c2 PyTryFrom::try_from_unchecked()
This allows casting a PyObjectRef to a specific type of PyObject
with no overhead.
2018-12-01 10:12:27 -05:00
konstin 790a103753
Merge pull request #291 from PyO3/exception_macros
Refactor the exception macros
2018-12-01 13:04:06 +01:00
kngwyu 7a83c1dc0f Revert removing default from impl FromPyObject for &T and &mut T 2018-11-29 22:45:36 +09:00
konstin 9102f2e364 Refactor the exception macros
* Renamed `py_exception` to `create_exception`
  * The split up of the macros makes it possible to create exception structs with bodies to mimic python exceptions' members
  * Used `Once` to fix a (theoretical) race condition with the is_null check
2018-11-27 23:07:15 +01:00
kngwyu b8f1373bec Remove default for impl PyTryFrom for &T and &mut T 2018-11-27 14:42:09 +09:00
kngwyu 2539acc1e8 Remove default from ReturnTypeIntoPyResult 2018-11-27 14:31:00 +09:00
kngwyu 119e0abde2 Fix ArrayList::truncate 2018-11-21 16:28:26 +09:00
kngwyu 949097874f Fix bug in ArrayList::pop_back 2018-11-21 16:00:26 +09:00
kngwyu 63ec65d5ac Refactor ReleasePool 2018-11-21 16:00:26 +09:00
kngwyu acbab2b3f0 Use ArrayList::truncate for borrowed pointers 2018-11-21 16:00:26 +09:00
kngwyu 4c38b21e49 Fix ArrayList::push_back 2018-11-21 16:00:26 +09:00
kngwyu be77846979 Use LinkedList<[T; 256]> in ReleasePool 2018-11-21 16:00:26 +09:00
kngwyu 25a5b74ba6 Use linked list in ReleasePool 2018-11-21 16:00:26 +09:00
konstin 13d4d66fdb cargo fmt 2018-11-15 21:58:22 +01:00
konstin d618ca401a
Merge pull request #274 from kngwyu/releasepool-nonnull
Use NonNull in ReleasePool and add bench_dict
2018-11-15 20:27:06 +01:00
konstin f645720fe5
Merge pull request #270 from PyO3/module
Treat modules as normal objects
2018-11-15 20:26:46 +01:00
konstin 9c8c5a6063 Rename #[pymodinit] to #[pymodule] 2018-11-15 19:43:29 +01:00
konstin 863ffb161f Add wrap_module macro 2018-11-15 19:43:29 +01:00
konstin 42f84ff881 Add clippy to travis 2018-11-15 15:23:45 +01:00
konstin 3de622cdfd Better explaination for the cast 2018-11-15 12:10:16 +01:00
konstin 287a168b18 Fix test failure 2018-11-15 12:08:22 +01:00
kngwyu a73bd06c1f Replace NonNull::new_unchecked with new().unwrap() in test 2018-11-15 13:40:35 +09:00
konstin 5f175a41cf Make clippy happy 2018-11-14 16:49:48 +01:00
kngwyu 6d442e5969 Use NonNull in release pool 2018-11-14 15:39:07 +09:00
Yuji Kanagawa 42dbaeb913
Merge pull request #268 from kngwyu/fix-dict-iter
Fix PyDictIterator's segfault(for #159)
2018-11-13 14:29:42 +09:00
kngwyu 1081ba9447 Fix import module name in test_dict_iter 2018-11-13 11:50:13 +09:00
konstin 3614f38154 Remove some transmute 2018-11-12 21:38:20 +01:00
kngwyu faa5efc5a1 Remove unnecessary Drop for PyDictIterator 2018-11-13 01:00:15 +09:00
kngwyu 3b01b8f6ba Review fixes 2018-11-13 00:53:06 +09:00
konstin d1de3338d1 Refactor PyObjectAlloc 2018-11-12 16:45:57 +01:00
kngwyu 34099b33f8 Fix PyDictIterator's segfault(for #159) 2018-11-13 00:25:54 +09:00
konstin 6cec1c39cc Update changelog 2018-11-12 15:11:03 +01:00
konstin aed0466915 s/PyObjectWithToken/PyObjectWithGIL/g 2018-11-12 15:10:53 +01:00
konstin 57afb51604 Remove PyToken completely; Fixes #94 2018-11-12 14:42:21 +01:00
konstin fb2349b6ec Remove PyToken usages from tests 2018-11-12 14:41:29 +01:00
konstin d2ba436d6d Remove the unnecessary type parameter PyObjectAlloc 2018-11-12 14:37:06 +01:00
konstin 9f45efebaf Format 2018-11-11 12:25:53 +01:00
konstin 4c0ddbe61e
Merge pull request #263 from kngwyu/fix-240
Fix #240
2018-11-11 11:49:31 +01:00
kngwyu bd6f923f43 Fix #240 2018-11-09 13:11:47 +09:00
ijl 50c6129607 NonNull pointer for Py, PyObject 2018-11-08 15:09:52 +00:00
konstin 52dfc0013c Add doc example to PyIterator 2018-11-02 22:59:30 +01:00
konstin 9ffb2c617d Run rustfmt 2018-11-02 22:59:30 +01:00
konstin 569db5fb02 Add test with generator to PyIterator 2018-11-02 22:59:30 +01:00
konstin 264f642f19 Better doc comment for PyObject 2018-10-31 11:58:19 +01:00
konstin 8b27f1e412 Get ready for rust 2018 2018-10-31 11:43:21 +01:00
konstin dbaa2de061 Small improvements around function calling 2018-10-31 11:38:45 +01:00
kngwyu 625a3f6738 Added a test that call call_method with kwargs 2018-10-31 15:23:18 +09:00
kngwyu 607c23d287 kwargs: Option<PyDict> -> Option<&PyDict> 2018-10-31 15:07:28 +09:00
kngwyu 56b82c2f7d Temporary hack to compile with latest nightly 2018-10-28 18:16:44 +09:00
konstin 38651a1827 Add tox config for pyo3 itself 2018-10-09 18:49:54 +02:00
konstin 4da9110489 Add tox config for word-count 2018-10-09 18:21:52 +02:00
kngwyu 9ab63f2289 Fix build with --features="num-complex" 2018-10-04 15:47:28 +09:00
konstin 5100676497 Splitted PyTypeCreate of PyTypeObject to remove specialization 2018-10-03 22:12:22 +02:00
konstin 71c584a110 De-specialize ToBorrowedObject 2018-10-03 21:04:49 +02:00
ijl d0f79fb9fd PyObjectProtocol::get_type_ptr() 2018-10-03 13:10:41 +00:00
ijl 38c6d942b7 Document UTF-8 FFI assumptions 2018-09-28 22:01:04 +00:00
ijl 851d2207c0 Simplify PyString, PyBytes, PyUnicode
PyStringData comments mention wanting to receive interpreter-
specific unicode types. I tried implementing this, but it's
more complex and slower to call libpython to fill a buffer
of u32 or such and convert that in Rust using widestring.

This implementation receives UTF-8 from PyUnicode_AsUTF8AndSize()
in python3 and PyUnicode_AsUTF8String() in python2. PyStringData
is removed as unnecessary.

The data() method on PyString, PyBytes, and PyUnicode is
replaced with as_bytes().

The python2 API changes improve the performance of
extracting unicode strings.
2018-09-28 21:47:44 +00:00
konstin 3a95d163ca New rustfmt version
You might need to upgrade to the latest nightly to get the same results
2018-09-28 23:34:57 +02:00
konstin 8930bd00e0 Fix PyUnicode alias 2018-09-28 23:03:24 +02:00
konstin 0b1906b626
Merge branch 'master' into datetime-fix 2018-09-28 22:47:04 +02:00
kngwyu f12e299f1c Remove PyDateTime_*Types 2018-09-28 23:56:57 +09:00
Paul Ganssle b869f09808
Add documentation to types/datetime.rs
This adds some light doc comments to the safe rust bindings.
2018-09-27 09:22:31 -04:00
Paul Ganssle a528c1e877
Add documentation to the datetime ffi bindings 2018-09-27 09:20:11 -04:00
konstin ed2739829f Fix the other part from #231 2018-09-27 01:44:17 +02:00
konstin 78a5053b22 Fix #231 2018-09-27 01:11:31 +02:00
konstin 05874d3f1a Fix tests 2018-09-27 01:11:31 +02:00
ijl 28bc3cf1e6 PyDict::from_sequence() 2018-09-25 14:19:23 +00:00
ijl 868e28d5ad Fix segfault on calling unknown method 2018-09-24 02:49:52 +00:00
ijl 6a961298af PyUnicode_AsUTF8AndSize, PyUnicode_AsUTF8 *const c_char API change
Noted in https://docs.python.org/3/c-api/unicode.html
2018-09-21 21:54:51 +00:00
konstin 302c099a76 Big refactoring to shrink the prelude 2018-09-21 23:34:28 +02:00
kngwyu 247da8d341 Implement pow, abs, neg for PyComplex 2018-09-21 14:48:43 +09:00
kngwyu 6b362a4654 Implement convsersion between num_complex::Complex and PyComplex 2018-09-21 14:23:01 +09:00
kngwyu 7ea875fc49 Implement Add/Sub/Mul/Div for &PyComplex 2018-09-21 12:48:42 +09:00
kngwyu c6d588877b Intoroduce PyComplex with minimum APIs 2018-09-20 11:52:57 +09:00
konstin 2904291b9e Better code generation 2018-09-17 19:48:22 +02:00
konstin 10ef6cd111 Fix cfg on PyEval_InitThread to fix #219 2018-09-11 22:38:31 +02:00
konstin d92e522243 Syn 0.15 2018-09-09 00:20:04 +02:00
konstin ddc6313e74 #[pyclass] objects can now be returned from rust functions 2018-09-06 18:04:13 +02:00
konstin e6569ae61e Remove ::pyo3::argparse::get_kwargs for from_borrowed_ptr_or_opt 2018-09-03 20:50:02 +02:00
konstin 29c882577c Get rid of another default fn 2018-09-03 01:02:39 +02:00
konstin f58549f1d8 Get rid of a bunch of PyTokens 2018-09-02 23:33:45 +02:00
konstin 0101dc8136 Two default fn less 2018-08-31 21:11:08 +02:00
konstin aa8be251d3 Fix python 2 2018-08-29 22:47:02 +02:00