<ctismer>
doing that segfaults, but I did not debug any further because I can't make sense of the generated code (also obscure since I have an ARM now)
<ctismer>
I have confirmed that the crash is really in that last PyObject_GetAttr call.
<ctismer>
We can probably work around that, but it really is an astonishing bug :D
Dejan has joined #pypy
<ctismer>
Ahhh, the `_functools` module seems not to exist.
<ctismer>
Fixed :-)
<cfbolz>
ctismer: aaaaah, right. why did it work on an older version then?
<ctismer>
No idea, maybe an alias was there
derpydoo has quit [Quit: derpydoo]
mattip has joined #pypy
jcea has joined #pypy
<ctismer>
_functools is a builtin module which gets extended by functools. Maybe they did a clean-up
<ctismer>
yeah, but _functools is totally gone, now. Anyway, things work for us with functools
derpydoo has joined #pypy
<cfbolz>
ctismer: _functools in cpython is an 'accelerator module' that might or might not be there
<mattip>
maybe PyObject_GetAttr should check for a NULL obj
<mattip>
but CPython does not check for NULL, so why should we?
<mattip>
I guess since this is C, it should be on the caller to make sure after every call there was no error returned
joshszep has quit [Read error: Connection reset by peer]
<ctismer>
I used that function because I prefer a builtin since I don‘t have to check if it was tampered with. And I was away fron PyPy for about a year, so I was much surprized.
<ctismer>
Was the function existent by accident in PyPy 7.3.9 or why did I get no crash?
<ctismer>
s/function/module/
<ctismer>
Ah, I will handle the accelerator module as you said cfbolz, thank you!
<ctismer>
mattip: things are very different. CPython will probably stick with this internal acceleration, and I used this because it‘s a builtin. PyPy has no reason to accelerate itself. But being an immutable builtin is a welcome security measure for us. Admittedly an abuse :-)
derpydoo has quit [Quit: derpydoo]
derpydoo has joined #pypy
<tumbleweed>
ctismer: see the ticket I posted above for what happened there (the module was removed to fix that bug)
<mattip>
PyObject_GetAttr(obj, name) will segfault if obj is NULL. Someone needs to check that. The implementation of PyObject_GetAttr does not do any validity checks
<mattip>
neither in CPython nor in PyPy
lehmrob has quit [Quit: Konversation terminated!]
derpydoo has quit [Ping timeout: 268 seconds]
catern has quit [Ping timeout: 250 seconds]
otisolsen70 has joined #pypy
otisolsen70 has quit [Quit: Leaving]
<ctismer>
Yes, why should it. _functools is a builtin module. There is by definition no reason to check anything of a builtin. This is now lost by the removal of _functools, and I need to verify that I really get the function that I expect. A bad move in my eyes.
<jean-paul[m]>
del _functools.partial totally works.
<jean-paul[m]>
It might be builtin but it's still a hateful sack of mutable state
<jean-paul[m]>
I think you have to say "I don't mind if it segfaults sometimes" or "I'll check for NULL (and probably other things) everywhere".
<jean-paul[m]>
which you say is, of course, up to you :)
<jean-paul[m]>
(put another way, it was always possible for it to segfault, the _functools change that actually happened merely realized one of those ways)
catern has joined #pypy
<ctismer>
Hmm, you are right jean-paul[m] it was only obfuscation by the name but it is not safe since this is not read-only. And there is no way out because there is no API to access this reliably. Thanks for the correction, how sad. There should be a layer for extensions that gives a secure way to access internals without exposing their implementation.
<ctismer>
That was really a very wrong assumption that builtin modules were read-only. Sigh… I stand corrected
<ctismer>
tumbleweed: Now I understand the reference you gave :)