Skip to content

Commit 6f3b708

Browse files
committed
Py_INCREF(None)
1 parent 628a77f commit 6f3b708

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/decode.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ impl<'de, 'a> Visitor<'de> for JsonValue {
8383
}
8484

8585
fn visit_unit<E>(self) -> Result<Self::Value, E> {
86+
unsafe { pyo3::ffi::Py_INCREF(typeref::NONE) };
8687
Ok(unsafe { typeref::NONE })
8788
}
8889

@@ -179,9 +180,7 @@ impl<'de, 'a> Visitor<'de> for JsonValue {
179180
// counter Py_INCREF in insertdict
180181
unsafe {
181182
pyo3::ffi::Py_DECREF(pykey);
182-
if std::intrinsics::likely(value != typeref::NONE) {
183-
pyo3::ffi::Py_DECREF(value)
184-
}
183+
pyo3::ffi::Py_DECREF(value);
185184
};
186185
}
187186
Ok(dict_ptr)

0 commit comments

Comments
 (0)