From c1249cdbd1b77a4d3fbcf4ed7da34232efaa9f1e Mon Sep 17 00:00:00 2001 From: Arie Bovenberg Date: Thu, 5 Sep 2024 10:11:17 +0200 Subject: [PATCH] make object deallocation more robust --- CHANGELOG.rst | 5 +++++ pyproject.toml | 2 +- pysrc/whenever/_pywhenever.py | 2 +- src/common.rs | 5 +++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8a5e4525..05660130 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,11 @@ 🚀 Changelog ============ +0.6.8 (2024-09-05) +------------------ + +- Fix issue with object deallocation in particular Windows builds (#167) + 0.6.7 (2024-08-06) ------------------ diff --git a/pyproject.toml b/pyproject.toml index 9b0de5a8..85a76d8b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ authors = [ {name = "Arie Bovenberg", email = "a.c.bovenberg@gmail.com"}, ] readme = "README.md" -version = "0.6.7" +version = "0.6.8rc1" description = "Modern datetime library for Python, written in Rust" requires-python = ">=3.9" classifiers = [ diff --git a/pysrc/whenever/_pywhenever.py b/pysrc/whenever/_pywhenever.py index 124257dc..773f03fb 100644 --- a/pysrc/whenever/_pywhenever.py +++ b/pysrc/whenever/_pywhenever.py @@ -32,7 +32,7 @@ # - It saves some overhead from __future__ import annotations -__version__ = "0.6.7" +__version__ = "0.6.8rc1" import enum import re diff --git a/src/common.rs b/src/common.rs index da2f0137..11958631 100644 --- a/src/common.rs +++ b/src/common.rs @@ -900,11 +900,12 @@ pub(crate) enum Ambiguity { } pub(crate) unsafe extern "C" fn generic_dealloc(slf: *mut PyObject) { - let tp_free = PyType_GetSlot(Py_TYPE(slf), Py_tp_free); + let cls = Py_TYPE(slf); + let tp_free = PyType_GetSlot(cls, Py_tp_free); debug_assert_ne!(tp_free, core::ptr::null_mut()); let f: freefunc = std::mem::transmute(tp_free); f(slf.cast()); - Py_DECREF(Py_TYPE(slf).cast()); + Py_DECREF(cls.cast()); } #[inline]