Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| aca05cc55c | |||
| f937ea6c82 | |||
| f3d960b0ec | |||
| f5d54903fa | |||
| 9caa86f61f | |||
| a06034dd0d | |||
| db06d78831 | |||
| ed469bdf1b | |||
| f1304ea183 | |||
| e838d908d2 |
@@ -1,55 +0,0 @@
|
|||||||
From 275e88f44beba579174e07980cc3a887bfd1ef3d Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
|
|
||||||
Date: Fri, 24 Nov 2023 13:47:03 +0100
|
|
||||||
Subject: [PATCH] time.clock_gettime and clock_gettime_ns are METH_O in Python
|
|
||||||
3.13.0a2+
|
|
||||||
|
|
||||||
See https://github.com/python/cpython/commit/4fe22c73770
|
|
||||||
|
|
||||||
Fixes https://github.com/adamchainz/time-machine/issues/408
|
|
||||||
---
|
|
||||||
src/_time_machine.c | 13 +++++++++++++
|
|
||||||
1 file changed, 13 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/src/_time_machine.c b/src/_time_machine.c
|
|
||||||
index d55ac54..5646a6c 100644
|
|
||||||
--- a/src/_time_machine.c
|
|
||||||
+++ b/src/_time_machine.c
|
|
||||||
@@ -108,7 +108,11 @@ _time_machine_clock_gettime(PyObject *self, PyObject *args)
|
|
||||||
PyObject *time_machine_module = PyImport_ImportModule("time_machine");
|
|
||||||
PyObject *time_machine_clock_gettime = PyObject_GetAttrString(time_machine_module, "clock_gettime");
|
|
||||||
|
|
||||||
+#if PY_VERSION_HEX >= 0x030d00a2
|
|
||||||
+ PyObject* result = PyObject_CallOneArg(time_machine_clock_gettime, args);
|
|
||||||
+#else
|
|
||||||
PyObject* result = PyObject_CallObject(time_machine_clock_gettime, args);
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
Py_DECREF(time_machine_clock_gettime);
|
|
||||||
Py_DECREF(time_machine_module);
|
|
||||||
@@ -142,7 +146,11 @@ _time_machine_clock_gettime_ns(PyObject *self, PyObject *args)
|
|
||||||
PyObject *time_machine_module = PyImport_ImportModule("time_machine");
|
|
||||||
PyObject *time_machine_clock_gettime_ns = PyObject_GetAttrString(time_machine_module, "clock_gettime_ns");
|
|
||||||
|
|
||||||
+#if PY_VERSION_HEX >= 0x030d00a2
|
|
||||||
+ PyObject* result = PyObject_CallOneArg(time_machine_clock_gettime_ns, args);
|
|
||||||
+#else
|
|
||||||
PyObject* result = PyObject_CallObject(time_machine_clock_gettime_ns, args);
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
Py_DECREF(time_machine_clock_gettime_ns);
|
|
||||||
Py_DECREF(time_machine_module);
|
|
||||||
@@ -478,8 +486,13 @@ PyDoc_STRVAR(module_doc, "_time_machine module");
|
|
||||||
static PyMethodDef module_functions[] = {
|
|
||||||
{"original_now", (PyCFunction)_time_machine_original_now, METH_FASTCALL|METH_KEYWORDS, original_now_doc},
|
|
||||||
{"original_utcnow", (PyCFunction)_time_machine_original_utcnow, METH_NOARGS, original_utcnow_doc},
|
|
||||||
+#if PY_VERSION_HEX >= 0x030d00a2
|
|
||||||
+ {"original_clock_gettime", (PyCFunction)_time_machine_original_clock_gettime, METH_O, original_clock_gettime_doc},
|
|
||||||
+ {"original_clock_gettime_ns", (PyCFunction)_time_machine_original_clock_gettime_ns, METH_O, original_clock_gettime_ns_doc},
|
|
||||||
+#else
|
|
||||||
{"original_clock_gettime", (PyCFunction)_time_machine_original_clock_gettime, METH_VARARGS, original_clock_gettime_doc},
|
|
||||||
{"original_clock_gettime_ns", (PyCFunction)_time_machine_original_clock_gettime_ns, METH_VARARGS, original_clock_gettime_ns_doc},
|
|
||||||
+#endif
|
|
||||||
{"original_gmtime", (PyCFunction)_time_machine_original_gmtime, METH_VARARGS, original_gmtime_doc},
|
|
||||||
{"original_localtime", (PyCFunction)_time_machine_original_localtime, METH_VARARGS, original_localtime_doc},
|
|
||||||
{"original_monotonic", (PyCFunction)_time_machine_original_monotonic, METH_NOARGS, original_monotonic_doc},
|
|
||||||
@@ -1,15 +1,11 @@
|
|||||||
Name: python-time-machine
|
Name: python-time-machine
|
||||||
Version: 2.13.0
|
Version: 2.16.0
|
||||||
Release: %autorelease
|
Release: %autorelease
|
||||||
Summary: Travel through time in your Python tests
|
Summary: Travel through time in your Python tests
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: https://github.com/adamchainz/time-machine
|
URL: https://github.com/adamchainz/time-machine
|
||||||
Source: %{url}/archive/%{version}/time-machine-%{version}.tar.gz
|
Source: %{url}/archive/%{version}/time-machine-%{version}.tar.gz
|
||||||
|
|
||||||
# time.clock_gettime and clock_gettime_ns are METH_O in Python 3.13.0a2+
|
|
||||||
# From https://github.com/adamchainz/time-machine/pull/409
|
|
||||||
Patch: %{url}/commit/275e88f44b.patch
|
|
||||||
|
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
BuildRequires: python3-devel
|
BuildRequires: python3-devel
|
||||||
|
|
||||||
@@ -27,14 +23,14 @@ Summary: %{summary}
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -p1 -n time-machine-%{version}
|
%autosetup -p1 -n time-machine-%{version}
|
||||||
sed -i '/coverage/d' requirements/requirements.in
|
sed -i '/coverage/d' tests/requirements/requirements.in
|
||||||
|
|
||||||
|
|
||||||
%generate_buildrequires
|
%generate_buildrequires
|
||||||
# tox uses a pinned version of requirements/requirements.in and also uses coverage
|
# tox uses a pinned version of requirements/requirements.in and also uses coverage
|
||||||
# so we bypass it.
|
# so we bypass it.
|
||||||
# This also saves us one dependency cycle as tox uses time-machine for tests.
|
# This also saves us one dependency cycle as tox uses time-machine for tests.
|
||||||
%pyproject_buildrequires requirements/requirements.in
|
%pyproject_buildrequires tests/requirements/requirements.in
|
||||||
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
SHA512 (time-machine-2.13.0.tar.gz) = 26a852d93633e037585ec8fcd563c86af8d977a87633dbeb66cf23c9ca49ca0ae536bdcdcdf809ee2ab423c197610c630d506bc3bf4f13c373d806cee2d8c598
|
SHA512 (time-machine-2.16.0.tar.gz) = 19b764cccdff07056a7d42841da576d90037661a9f124e3fbab408bfa61dccf4b51b88a7e0741c87b03e7a8cc3306bb0ed32bd66588e45c9ab7e9d9cb5ba44ae
|
||||||
|
|||||||
Reference in New Issue
Block a user