Add entry to `CHANGELOG.md`

This commit is contained in:
Martin Larralde 2019-04-04 09:47:21 +02:00
parent ad9e676512
commit 72003ec37a
2 changed files with 10 additions and 3 deletions

View File

@ -7,7 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]
## Fixed
### Added
* Have `PyModule` generate an index of its members (`__all__` list).
### Fixed
* `type_object::PyTypeObject` has been marked unsafe because breaking the contract `type_object::PyTypeObject::init_type` can lead to UB.
* Fixed automatic derive of `PySequenceProtocol` implementation in [#423](https://github.com/PyO3/pyo3/pull/423).

View File

@ -83,7 +83,7 @@ impl PyModule {
pub fn index(&self) -> PyResult<&PyList> {
match self.getattr("__all__") {
Ok(idx) => idx.downcast_ref().map_err(PyErr::from),
Err(err) =>
Err(err) => {
if err.is_instance::<exceptions::AttributeError>(self.py()) {
let l = PyList::empty(self.py());
self.setattr("__all__", l).map_err(PyErr::from)?;
@ -93,6 +93,7 @@ impl PyModule {
}
}
}
}
unsafe fn str_from_ptr(&self, ptr: *const c_char) -> PyResult<&str> {
if ptr.is_null() {
@ -158,7 +159,9 @@ impl PyModule {
where
V: ToPyObject,
{
self.index()?.append(name).expect("could not append __name__ to __all__");
self.index()?
.append(name)
.expect("could not append __name__ to __all__");
self.setattr(name, value)
}