Skip to content

Commit

Permalink
Use #[cfg(not(Py_LIMITED_API))] for datetime API
Browse files Browse the repository at this point in the history
  • Loading branch information
kngwyu committed Dec 15, 2020
1 parent 5e6bce6 commit 17d0868
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/ffi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub use self::codecs::*;
pub use self::compile::*;
pub use self::complexobject::*;
pub use self::context::*;
#[cfg(not(Py_LIMITED_API))]
pub use self::datetime::*;
pub use self::descrobject::*;
pub use self::dictobject::*;
Expand Down Expand Up @@ -178,6 +179,7 @@ pub mod frameobject {
opaque_struct!(PyFrameObject);
}

#[cfg(not(Py_LIMITED_API))]
pub(crate) mod datetime;
pub(crate) mod marshal;

Expand Down
5 changes: 3 additions & 2 deletions src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ pub use self::boolobject::PyBool;
pub use self::bytearray::PyByteArray;
pub use self::bytes::PyBytes;
pub use self::complex::PyComplex;
pub use self::datetime::PyDeltaAccess;
#[cfg(not(Py_LIMITED_API))]
pub use self::datetime::{
PyDate, PyDateAccess, PyDateTime, PyDelta, PyTime, PyTimeAccess, PyTzInfo,
PyDate, PyDateAccess, PyDateTime, PyDelta, PyDeltaAccess, PyTime, PyTimeAccess, PyTzInfo,
};
pub use self::dict::{IntoPyDict, PyDict};
pub use self::floatob::PyFloat;
Expand Down Expand Up @@ -229,6 +229,7 @@ mod boolobject;
mod bytearray;
mod bytes;
mod complex;
#[cfg(not(Py_LIMITED_API))]
mod datetime;
mod dict;
mod floatob;
Expand Down
2 changes: 2 additions & 0 deletions tests/test_datetime.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg(not(Py_LIMITED_API))]

use pyo3::prelude::*;
use pyo3::types::IntoPyDict;

Expand Down

0 comments on commit 17d0868

Please sign in to comment.