Skip to content

Commit

Permalink
make object deallocation more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
ariebovenberg committed Sep 5, 2024
1 parent 97c7e89 commit c1249cd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -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)
------------------

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
2 changes: 1 addition & 1 deletion pysrc/whenever/_pywhenever.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# - It saves some overhead
from __future__ import annotations

__version__ = "0.6.7"
__version__ = "0.6.8rc1"

import enum
import re
Expand Down
5 changes: 3 additions & 2 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit c1249cd

Please sign in to comment.