[pypy-commit] pypy py3.5: Brute-force tp_basicsize to the correct value on the datetime types
rlamy
pypy.commits at gmail.com
Fri Apr 20 18:34:16 EDT 2018
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3.5
Changeset: r94398:7ac5e33a8260
Date: 2018-04-20 23:33 +0100
http://bitbucket.org/pypy/pypy/changeset/7ac5e33a8260/
Log: Brute-force tp_basicsize to the correct value on the datetime types
diff --git a/pypy/module/__pypy__/interp_pypydatetime.py b/pypy/module/__pypy__/interp_pypydatetime.py
--- a/pypy/module/__pypy__/interp_pypydatetime.py
+++ b/pypy/module/__pypy__/interp_pypydatetime.py
@@ -5,7 +5,7 @@
def create_class(name):
class W_Class(W_Root):
- 'builtin base clasee for datetime.%s to allow interop with cpyext' % name
+ 'builtin base class for datetime.%s to allow interop with cpyext' % name
def descr_new__(space, w_type):
return space.allocate_instance(W_Class, w_type)
diff --git a/pypy/module/cpyext/cdatetime.py b/pypy/module/cpyext/cdatetime.py
--- a/pypy/module/cpyext/cdatetime.py
+++ b/pypy/module/cpyext/cdatetime.py
@@ -40,18 +40,26 @@
w_type = space.getattr(w_datetime, space.newtext("datetime"))
datetimeAPI.c_DateTimeType = rffi.cast(
PyTypeObjectPtr, make_ref(space, w_type))
+ datetimeAPI.c_DateTimeType.c_tp_basicsize = rffi.sizeof(
+ cts.gettype('PyDateTime_DateTime'))
w_type = space.getattr(w_datetime, space.newtext("time"))
datetimeAPI.c_TimeType = rffi.cast(
PyTypeObjectPtr, make_ref(space, w_type))
+ datetimeAPI.c_TimeType.c_tp_basicsize = rffi.sizeof(
+ cts.gettype('PyDateTime_Time'))
w_type = space.getattr(w_datetime, space.newtext("timedelta"))
datetimeAPI.c_DeltaType = rffi.cast(
PyTypeObjectPtr, make_ref(space, w_type))
+ datetimeAPI.c_DeltaType.c_tp_basicsize = rffi.sizeof(
+ cts.gettype('PyDateTime_Delta'))
w_type = space.getattr(w_datetime, space.newtext("tzinfo"))
datetimeAPI.c_TZInfoType = rffi.cast(
PyTypeObjectPtr, make_ref(space, w_type))
+ datetimeAPI.c_TZInfoType.c_tp_basicsize = rffi.sizeof(
+ cts.gettype('PyDateTime_TZInfo'))
datetimeAPI.c_Date_FromDate = llhelper(
_PyDate_FromDate.api_func.functype,
@@ -124,7 +132,7 @@
# app level datetime.date. If a c-extension class uses datetime.date for its
# base class and defines a tp_dealloc, we will get this:
# c_class->tp_dealloc == tp_dealloc_func
- # c_class->tp_base == datetime.date,
+ # c_class->tp_base == datetime.date,
# datetime.date->tp_dealloc = _PyPy_subtype_dealloc
# datetime.date->tp_base = W_DateTime_Date
# W_DateTime_Date->tp_dealloc = _PyPy_subtype_dealloc
More information about the pypy-commit
mailing list