Skip to content

Commit 83d0ac4

Browse files
authored
Merge pull request #523 from ijl/fix-deprecation
Fix deprecation warnings on sync and mem
2 parents 9669edb + 9f827f0 commit 83d0ac4

File tree

5 files changed

+13
-12
lines changed

5 files changed

+13
-12
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ matrix:
2121
- name: Minimum nightly
2222
python: "3.7"
2323
# Keep this synced up with build.rs
24-
env: TRAVIS_RUST_VERSION=nightly-2019-02-07
24+
env: TRAVIS_RUST_VERSION=nightly-2019-06-22
2525
# Tested via anaconda PyPy (since travis's PyPy version is too old)
2626
- name: PyPy3.5 7.0
2727
python: "3.7"
@@ -49,7 +49,7 @@ before_install:
4949
- source ./ci/travis/setup.sh
5050

5151
install:
52-
- pip install setuptools-rust pytest pytest-benchmark tox tox-venv
52+
- pip install setuptools-rust pytest pytest-benchmark tox
5353

5454
script:
5555
- ./ci/travis/test.sh

build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use version_check::{is_min_date, is_min_version, supports_features};
1616
/// Specifies the minimum nightly version needed to compile pyo3.
1717
/// Keep this synced up with the travis ci config,
1818
/// But note that this is the rustc version which can be lower than the nightly version
19-
const MIN_DATE: &'static str = "2019-02-06";
20-
const MIN_VERSION: &'static str = "1.34.0-nightly";
19+
const MIN_DATE: &'static str = "2019-06-21";
20+
const MIN_VERSION: &'static str = "1.37.0-nightly";
2121

2222
/// Information returned from python interpreter
2323
#[derive(Deserialize, Debug)]

src/gil.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use spin;
99
use std::ptr::NonNull;
1010
use std::{any, marker, rc, sync};
1111

12-
static START: sync::Once = sync::ONCE_INIT;
13-
static START_PYO3: sync::Once = sync::ONCE_INIT;
12+
static START: sync::Once = sync::Once::new();
13+
static START_PYO3: sync::Once = sync::Once::new();
1414

1515
/// Prepares the use of Python in a free-threaded context.
1616
///
@@ -301,7 +301,8 @@ mod array_list {
301301
pub fn push_back(&mut self, item: T) -> &T {
302302
let next_idx = self.next_idx();
303303
if next_idx == 0 {
304-
self.inner.push_back(unsafe { mem::uninitialized() });
304+
self.inner
305+
.push_back(unsafe { mem::MaybeUninit::uninit().assume_init() });
305306
}
306307
self.inner.back_mut().unwrap()[next_idx] = item;
307308
self.length += 1;

src/types/dict.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::AsPyPointer;
1010
use crate::IntoPyPointer;
1111
use crate::Python;
1212
use crate::{IntoPyObject, ToBorrowedObject, ToPyObject};
13-
use std::{cmp, collections, hash, mem};
13+
use std::{cmp, collections, hash};
1414

1515
/// Represents a Python `dict`.
1616
#[repr(transparent)]
@@ -172,8 +172,8 @@ impl<'py> Iterator for PyDictIterator<'py> {
172172
#[inline]
173173
fn next(&mut self) -> Option<Self::Item> {
174174
unsafe {
175-
let mut key: *mut ffi::PyObject = mem::uninitialized();
176-
let mut value: *mut ffi::PyObject = mem::uninitialized();
175+
let mut key: *mut ffi::PyObject = std::ptr::null_mut();
176+
let mut value: *mut ffi::PyObject = std::ptr::null_mut();
177177
if ffi::PyDict_Next(self.dict.as_ptr(), &mut self.pos, &mut key, &mut value) != 0 {
178178
let py = self.py;
179179
Some((py.from_borrowed_ptr(key), py.from_borrowed_ptr(value)))

src/types/string.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::AsPyPointer;
1212
use crate::Python;
1313
use std::borrow::Cow;
1414
use std::os::raw::c_char;
15-
use std::{mem, str};
15+
use std::str;
1616

1717
/// Represents a Python `string`.
1818
#[repr(transparent)]
@@ -56,7 +56,7 @@ impl PyString {
5656
#[inline]
5757
pub fn as_bytes(&self) -> &[u8] {
5858
unsafe {
59-
let mut size: ffi::Py_ssize_t = mem::uninitialized();
59+
let mut size: ffi::Py_ssize_t = 0;
6060
let data = ffi::PyUnicode_AsUTF8AndSize(self.0.as_ptr(), &mut size) as *const u8;
6161
// PyUnicode_AsUTF8AndSize would return null if the pointer did not reference a valid
6262
// unicode object, but because we have a valid PyString, assume success

0 commit comments

Comments
 (0)