These are chat archives for dropbox/pyston

22nd
Sep 2015
Kevin Modzelewski
@kmod
Sep 22 2015 02:48
I'm curious about the tp_del thing
if we still have that assert in there, I guess we haven't really tested at all if we support custom tp_del's
do they set up a custom tp_dealloc that's supposed to call tp_del?
Rudi Chen
@rudi-c
Sep 22 2015 04:49
We don't support having both a custom tp_del and a custom tp_dealloc on the same object.
Because both could cause ressurections which would mean 3 GC passes to free an object
There were a lot of cans of worms involved with C extensions and finalizers. Are you running into a case where you need it?
Sun
@Daetalus
Sep 22 2015 05:22
I add two test for int() in #928 , but the second test seems not work on CI. I checked on my local machine, but didn't find the reason yet.
Kevin Modzelewski
@kmod
Sep 22 2015 05:31
it looks like cpython's behavior changed
some time between 2.7.3 and 2.7.6
the CI I think has 2.7.3
we used to try to detect the cpython version and then target that
but I think we should move away from that
also, here's the cpython commit: https://hg.python.org/cpython/rev/c0266b
Sun
@Daetalus
Sep 22 2015 05:37
Reading it. Another question.
Kevin Modzelewski
@kmod
Sep 22 2015 05:37
I think we should just guard it with something like
if sys.version_info >= (2, 7, 6):
   .. do the normal test ..
else:
  print "TypeError: missing string argument" # ie print the expected output on platforms that don't support this check
Sun
@Daetalus
Sep 22 2015 05:41
Got it, thanks!
After some investigation, some new added test need more complete long support. So I did some work to test_long. For long(float(A_BIG_LONG)
Because we use mpz_t internally. And mpz_get_d use "round to zero". But CPython need round to nearest. I found a solution which convert mpz_t to mpfr_t first. Then use "round to nearest" flag to get the double. But it bring new dependency. Does there has a better way?
Kevin Modzelewski
@kmod
Sep 22 2015 05:59
this is for the conversion from float to long?
or long to float
Sun
@Daetalus
Sep 22 2015 06:03
Sorry, long to float. float(A_BIG_LONG), it will call PyLong_FromDouble.
Sun
@Daetalus
Sep 22 2015 06:14
+eventually.
Kevin Modzelewski
@kmod
Sep 22 2015 06:41
man that seems pretty overkill, but I can't think of another way
Sun
@Daetalus
Sep 22 2015 06:55
Maybe just leave it out there, copy some tests from CPython long test to tests/long.py ?
Vinzenz Feenstra
@vinzenz
Sep 22 2015 07:38
@kmod Sorry for the delay, I haven't noticed earlier. Still catching up with everything at the moment - All open PR on pypa are merged now
Kevin Modzelewski
@kmod
Sep 22 2015 09:01
awesome, thanks :)
@daetalus yeah that sounds reasonable too :) whatever you prefer
Marius Wachtler
@undingen
Sep 22 2015 10:16
@rudi-c looks like cythons generator implementation sets tp_del and tp_dealloc to custom functions
:-(
Marius Wachtler
@undingen
Sep 22 2015 11:13
Concerning func_code assignments and the new flag, I'm wondering if I should just only allow setting f when the source and dest CLFunction->source is available (+add assert that internal_callable == NULL)?
I think this should be the same as a new flag?
Rudi Chen
@rudi-c
Sep 22 2015 13:20
Urg. Well in theory it should be fine
To just disable the assert
And hope the tp_dealloc doesn't do anything too crazy
Marius Wachtler
@undingen
Sep 22 2015 16:58
man somehow I'm having huge trouble implementing PyGILState_Ensure and PyGILState_Release :-(.
An Long
@aisk
Sep 22 2015 17:17
Hi which version of python2.7.x should I copy from, maybe 2.7.10 ?
Sun
@Daetalus
Sep 22 2015 17:34
2.7.6
Marius Wachtler
@undingen
Sep 22 2015 17:42
CPython revision 90928:f8921f6059edf (2.7.7 release)
thats the version we use
Sun
@Daetalus
Sep 22 2015 17:49
Ah, sorry for the wrong answer!
Marius Wachtler
@undingen
Sep 22 2015 18:26
np, as long as we don't end up with code from 3 different cpython versions I'm fine :-D
Kevin Modzelewski
@kmod
Sep 22 2015 20:33
@undingen more restrictions sound good :P
I think gating on source is a good idea
I guess that roughly corresponds to the times that cpython would let you change func_code?
Marius Wachtler
@undingen
Sep 22 2015 20:40
I found it really hard to find cases where it's allowed because it looks like most stuff doesn't have the func_code attribute (because the are builtin_function_or_method_cls and not function_cls etc) that's also why I yesterday wrongly assumed that one can't access the code_object of non python funcs at all.
Sun
@Daetalus
Sep 22 2015 22:02
Hi, how to expand all outdated diff? Use bookmarklet seems not work anymore.
Kevin Modzelewski
@kmod
Sep 22 2015 22:16
oh I've just been clicking each button individually
would be interested in how to do it automatically :)