Commit Graph

5693 Commits

Author SHA1 Message Date
Daniel Grunwald d7a94ba4b1 Add cargo categories. 2017-01-27 22:42:07 +01:00
Daniel Grunwald a6e1133ac4 Update CHANGELOG.md 2017-01-27 22:38:33 +01:00
Daniel Grunwald 32e0d35603 Update documentation 2017-01-27 21:52:04 +01:00
Daniel Grunwald f5130e51eb Merge pull request #81 from Luthaf/optional
Implement optional values in argparse
2017-01-27 21:49:53 +01:00
Matteo Bertini 654f86cf51 Ignore binaries and makefile stamps 2017-01-27 11:33:09 +01:00
Matteo Bertini e7abe40cd1 build.rs: use PYTHON_SYS_EXECUTABLE as `python` executable
Add and env variable to force an exact python executable.
2017-01-27 11:33:03 +01:00
Matteo Bertini 1cf4f275e1 py27/build.rs: generated from py3/build.rs
Add Makefile `cog `task and `cog` annotation to keep the build.rs files in sync.
2017-01-27 11:22:02 +01:00
Matteo Bertini 278ce85913 Merge python*-sys/build.rs
- use `py_version_short` in 2.7 where `LDVERSION` is missing
 - manage PEP_384 only if Python version.major is 3
2017-01-27 11:06:16 +01:00
Luthaf d615c319f6 Implement optional parameters for reference types 2017-01-26 21:35:16 +01:00
Guillaume Fraux 9707c5ab72 Implement optional values in argparse 2017-01-26 21:19:38 +01:00
Daniel Grunwald 3b0ec638b0 Create CHANGELOG.md 2017-01-21 17:39:58 +01:00
Daniel Grunwald ca4203e4db Add PyBuffer::to_vec(). Avoids unnecessary zero-initialization when creating a Vec from a buffer. 2017-01-21 00:40:32 +01:00
Daniel Grunwald e3d6ac2ca8 Test extracting Vec<u8> using bytearray instead of bytes: On Python 2.7, the sequence protocol on bytes returns characters, not integers. 2017-01-20 23:22:45 +01:00
Daniel Grunwald 3152ef22f0 Expand on the buffer protocol.
When compiling with --feature nightly, we now use specialization to optimize extract::<Vec<PrimititeType>>() from an object implementing the buffer protocol.
2017-01-20 23:14:29 +01:00
Daniel Grunwald af8131f858 Initial attempt at the buffer protocol.
Does not yet provide a safe way of accessing the buffer contents.
2017-01-20 01:08:51 +01:00
Daniel Grunwald a48d74c62c Fix #19: allow extracting a Vec from anything implementing the sequence protocol, not just from `list`. 2017-01-20 01:08:12 +01:00
Daniel Grunwald fbe1a07d10 Mention `pub class` in the documentation. 2017-01-19 21:56:06 +01:00
Daniel Grunwald 06cab0a925 Fix #77: Add support for `py_class!(pub class ...)` 2017-01-19 21:50:49 +01:00
Daniel Grunwald cb4ee822e0 Add Python 3.6 to test matrix. 2017-01-18 21:28:04 +01:00
Daniel Grunwald 97727b2b21 Merge pull request #75 from naufraghi/patch-1
Fix typo: Mac OS `dynlib` -> `dylib`
2017-01-18 01:09:54 +01:00
Matteo Bertini acd36360dc Fix typo: Mac OS `dynlib` -> `dylib`
Closes #73
2016-12-31 11:06:16 +01:00
Daniel Grunwald 623056d3ca Merge pull request #70 from naufraghi/fix-docs-traverse
Fix __traverse__ list formatting (add missing newline)
2016-12-25 16:53:39 +01:00
Matteo Bertini 3af2e3a9fa Fix __traverse__ list formatting (add missing newline) 2016-12-24 08:05:47 +01:00
Daniel Grunwald b7090799b6 Version 0.1.0 2016-12-17 21:41:14 +01:00
Daniel Grunwald b83a5d9bad Bump crate version numbers. 2016-12-17 21:29:02 +01:00
Daniel Grunwald e2d7781433 Add "extension-module" feature to suppress linking pythonX.Y.so.
The symbols are instead kept unresolved, so that they can be used with
any compatible python interpreter, even if the target system uses a
statically linked python and lacks pythonX.Y.so altogether.
2016-12-17 21:17:11 +01:00
Daniel Grunwald 62a083e38f PyTuple: Add back iter() method (fixes build); require py: Python for as_slice().
This is a compromise solution: we require the GIL to be held when acquiring
the slice, but not later when using the slice.

We could bind the lifetime of the returned slice to the Python-token lifetime
to prevent accessing the slice when the GIL is not held, but that causes
problems with the FromPyObject impl.

Alternatively we could not require the GIL at all when accessing the PyTuple
(and thus keep the ops::Index and IntoIterator implementations), but that
relies on too many CPython implementation details for my taste.
2016-12-17 16:40:17 +01:00
Daniel Grunwald 4cb29c14fa Remove hacks for compatibility with old rust versions. The new minimum required version is Rust 1.13.0.
This significantly reduces our #[cfg(feature="nightly")] usage.
2016-12-17 16:05:21 +01:00
Daniel Grunwald f6ed2bbae9 Fix #10: Windows support.
We keep the #[link] attributes in #[cfg_attr(windows)] so that we don't require a nightly Rust build on non-Windows platforms.
This can be simplified once RFC 1717 is available in a stable rust version.

This commit also increases the minimum Rust version to 1.13.
2016-12-17 15:46:52 +01:00
Daniel Grunwald 278c1aece8 Fix #56: PyModuleDef changed "m_slots" to "m_reload" in Python 3.5. 2016-12-10 13:03:51 +01:00
Daniel Grunwald 2c89f62646 Fix non_upper_case_globals warning in py_class!() macro. 2016-12-10 12:41:08 +01:00
Daniel Grunwald 2b012968ec Add missing #[cfg(Py_3_6)] 2016-12-10 12:37:33 +01:00
Daniel Grunwald 52c05c6bac Adjust python3-sys to Python 3.6 RC headers. 2016-12-10 12:07:42 +01:00
Daniel Grunwald e644f24a2b Merge pull request #66 from Idolf/pub-string
Mark PyStringObject and PyBytesObject as pub
2016-11-13 16:26:11 +01:00
Mathias Svensson 35917e967b Make PyStringObject and PyBytesObject public 2016-11-13 11:51:23 +01:00
Daniel Grunwald 39e73b80dd Merge pull request #65 from sciyoshi/uppercase-static
Use uppercase names for static variables to fix warnings
2016-11-13 11:15:02 +01:00
Daniel Grunwald b34d815416 Mention to_py_object() and extract() in PyInt method documentation. 2016-11-13 11:14:13 +01:00
Samuel Cormier-Iijima d2b9533406 Use uppercase names for static variables to fix warnings 2016-11-11 21:50:18 -05:00
Daniel Grunwald b10523b48e Merge pull request #63 from cmyr/rust-lib-example
added example of implementing a basic python module
2016-10-26 23:37:38 +02:00
Colin Rofls be884bfe7f added example of implementing a basic python module 2016-10-26 15:55:50 -04:00
Daniel Grunwald 1129131501 Remove #[feature(unsafe_no_drop_flag)]: it's no longer necessary with the latest nightlies.
Warning: to use rust-cpython with --feature nightly, you now must use 'rustc 1.13.0-nightly (e9bc1bac8 2016-08-24)' or newer; or you'll get segfaults due to the drop flags.
Use of rust-cpython with stable rust is not affected.
2016-08-25 21:22:18 +02:00
Tibor Benke 227c0a6e41 Fix Markdown formatting in py_fn!'s documentation
Signed-off-by: Tibor Benke <tibor.benke@balabit.com>
2016-07-28 23:56:43 +02:00
Tibor Benke ca6bd439ae Correct documentation by replacing ExtractPyObject with FromPyObject
Signed-off-by: Tibor Benke <tibor.benke@balabit.com>
2016-07-28 23:56:35 +02:00
Tibor Benke d054115d85 Fix C FFI bug in PyErr
Use null-terminated strings to call PyErr_NewException()

Signed-off-by: Tibor Benke <ihrwein@gmail.com>
2016-07-28 15:43:06 +02:00
Daniel Grunwald 2db59a0835 Merge pull request #50 from sciyoshi/inplace-ops
Add support for in-place numeric operators in py_class!
2016-06-20 19:29:22 +02:00
Samuel Cormier-Iijima 2e8d343b0f Add support for in-place numeric operators in py_class! 2016-06-14 16:00:55 -04:00
Daniel Grunwald 72e1e05835 Merge pull request #49 from sciyoshi/rich-comparison
Add support for overloading comparison operators with __richcompare__
2016-06-12 00:04:11 +02:00
Samuel Cormier-Iijima 291e08e29a Remove CompareOp::Other, change to __richcmp__, and add tests 2016-06-06 20:43:16 -04:00
Samuel Cormier-Iijima 305bc4324d Add support for overloading comparison operators with __richcompare__ 2016-06-06 16:08:48 -04:00
Daniel Grunwald 7c59d554ec Merge pull request #48 from sciyoshi/exception-macro
Add py_exception! macro for defining custom exception types
2016-06-06 21:52:52 +02:00