[pypy-dev] datetime module and classmethods with kwargs
David Fraser
davidf at sjsoft.com
Fri Feb 4 09:55:08 MET 2005
David Fraser wrote:
> David Fraser wrote:
>
>> Hi
>>
>> I have been testing out pypy for the first time...
>> I wanted to get the datetime module working and found that there was
>> a pure python implementation of it done before the C implementation,
>> in the nondist/sandbox/datetime module on Python CVS.
>> This implementation works fairly well on pypy:
>> - in order to test it, the attached patch to test_datetime is needed
>> to avoid problems with pickle and gc
>> - other than pickling, the only test failures are below
>> The datetime.py can be got directly here:
>> http://cvs.sourceforge.net/viewcvs.py/*checkout*/python/python/nondist/sandbox/datetime/datetime.py?content-type=text%2Fplain&rev=1.160
>>
>
>
> To speed up my testing I created a cutdown version of the non-pickle
> tests that failed :-)
> One of them fails in standard python as well so is a problem with the
> datetime.py code
> The others are all due to classmethod not accepting keyword arguments.
> I've attached a patch to __builtin__module.py that enables it to
> accept keyword arguments, which makes all those tests pass.
>
> Seems simple, could it be applied?
Of course attaching the patch as a patch would give too much away, so I
have to send it as text/plain :-)
David
-------------- next part --------------
Index: __builtin__module.py
===================================================================
--- __builtin__module.py (revision 8816)
+++ __builtin__module.py (working copy)
@@ -581,8 +581,8 @@
def __get__(self, obj, klass=None):
if klass is None:
klass = type(obj)
- def newfunc(*args):
- return self.f(klass, *args)
+ def newfunc(*args, **kwargs):
+ return self.f(klass, *args, **kwargs)
return newfunc
if not hasattr(dict, 'fromkeys'):
More information about the pypy-dev
mailing list