cfbolz changed the topic of #pypy to: #pypy PyPy, the flexible snake https://pypy.org | IRC logs: https://quodlibet.duckdns.org/irc/pypy/latest.log.html#irc-end and https://libera.irclog.whitequark.org/pypy | the pypy angle is to shrug and copy the implementation of CPython as closely as possible, and staying out of design decisions
Atque has joined #pypy
pbsds has quit [Quit: The Lounge - https://thelounge.chat]
pbsds has joined #pypy
pbsds has quit [Quit: The Lounge - https://thelounge.chat]
pbsds has joined #pypy
Atque has quit [Ping timeout: 255 seconds]
Atque has joined #pypy
jcea has quit [Ping timeout: 256 seconds]
jinsun has quit [Read error: Connection reset by peer]
jinsun has joined #pypy
otisolsen70 has joined #pypy
otisolsen70 has quit [Remote host closed the connection]
otisolsen70 has joined #pypy
<mgorny> bad news
<mgorny> looks like lxml is suffering infinite recursion somewhere with pypy3.9 7.3.10
<mgorny> i've already confirmed 7.3.9 is fine, checking .10 rc3 now
<mgorny> rc3 is fine too, wtf
<cfbolz> mgorny: ouch, wat?
<mgorny> __getattr__
<mgorny> if hasattr(func, "func") and isinstance(func, partial):
<mgorny> return partial(self, tag)
<mgorny> File "/usr/lib/pypy3.9/functools.py", line 286, in __new__
<mgorny> File "/tmp/portage/dev-python/lxml-4.9.1/work/lxml-lxml-4.9.1-pypy3/test/usr/lib/pypy3.9/site-packages/lxml/builder.py", line 229, in
<mgorny> RecursionError: maximum recursion depth exceeded
<mgorny> i see Matti touched something around that, so i guess this is a "corner case" he hasn't been able to fix
<mgorny> i'm still trying to bisect it
<mgorny> (sorry, wasn't able to focus 100% on it)
lritter has joined #pypy
<mgorny> well, as i somewhat suspected, it's:
<mgorny> remove redundnat lib_pypy/_functools.py and re-sync test_functools.py (issue 3861)
<mgorny> i guess Matti wasn't able to find all the corner cases
<cfbolz> mgorny: this would mean it's a bug in the standard library
<cfbolz> mgorny: what Matti did was remove our own only half compatible implementation of functools.partial. now we always use the implementation in the stdlib
<mgorny> i guess relying on cpython implementation details
<cfbolz> mgorny: thanks
<mgorny> i'm going to see if i can revert that commit in gentoo for now
<cfbolz> mgorny: it fails already on import, right? no tests is run?
<mgorny> looks like it
<mgorny> lemme try on installed lxml
<mgorny> yep, 'import lxml.html.builder' fails
<cfbolz> ok, I can take a look later
<mgorny> thans
<mgorny> thanks*
<mgorny> maybe it'd be sufficient to reverse the check order there
<mgorny> lemme try tha
<mgorny> that *
<mgorny> sry, cold fingers
<cfbolz> mgorny: we should try to see whether it fails on cpython, if you disable the _functools module
<mgorny> cfbolz: is there such a thing in cpython?
<mgorny> i don't see _functools there, .py or .so
<cfbolz> mgorny: yes, functools.py is a pure python implementation, and _functools is a C-implemented "accelerator" module
<mgorny> unless it's, well, frozen
<cfbolz> of course it is :-/
<cfbolz> annoying
<mgorny> damn
<mgorny> hmm, maybe a cheap hack will work
<cfbolz> but still, it's likely a bug in the pure python version
<mgorny> yep, i can reproduce with pure cpython
<mgorny> lemme try moving isinstance() in Matti's fix first
<cfbolz> mgorny: "yay"
<mgorny> i wonder if i should add an option to use pure python versions in Gentoo
<mgorny> people would love random bug reports from that ;-)
<cfbolz> mgorny: I'm happy to dig into this in a bit. we should also file a cpy bug (and ideally also fix it there)
* mgorny goes afk for 10-15 minutes, then i'll let you know if it worked
<cfbolz> thanks
<cfbolz> mgorny: yeah, if I switch the isinstance first it works
<cfbolz> and the stdlib test_functools also passes
<mgorny> thanks
<mgorny> yeah, works here too
<cfbolz> mgorny: so the C code does this: if (Py_TYPE(func)->tp_call == (ternaryfunc)partial_call) {
<mgorny> cfbolz: honestly, i've already lost all hope in cpython
<mgorny> i mean, it's absurd how bad it is
<cfbolz> 🤷‍♀️
<cfbolz> I'll file a bug
<cfbolz> and maybe do a PR
<mgorny> they partially broke gdbm support in 3.12.0a1
<mgorny> i filed a bug, i made a pr
<mgorny> they've released a3, still zero reply
<mgorny> pings don't help
<cfbolz> ouch :-(
<mgorny> and the best part, it's broken for all distros out there, just i guess they don't see it
<mgorny> on top of that, after removing setup.py install targets in makefile are totally unreliable
<mgorny> if /usr/lib/python3.12 exists, it doesn't create dirs in $(DESTDIR)...
<mgorny> and then make install fails to install .so files, except it doesn't fail because the rules are so hacky that failures get ignored
<cfbolz> mgorny: I'm also still waiting for my 1MB size reduction PR for cpy :-(
epony has quit [Read error: Connection reset by peer]
epony has joined #pypy
<arigato> "yeah, if I switch the isinstance first it works" -> python is such a sane language where nothing unexpected can occur (/me runs away)
<LarstiQ> arigato: is this an instance of that rule?
<cfbolz> basically the functools.partial constructor does this: 'if hasattr(callable, "func")'
<cfbolz> it isn't safe to read random attributes on random objects
<cfbolz> and in this particular case, callable has a __getattr__ constructing *another* partial object, leading to an infinite recursion
<cfbolz> matti added an "hasattr(...) and isinstance(callable, partial)"
<cfbolz> to try to fix the CPy bug
<cfbolz> but the two conditions need to be switched
<cfbolz> in CPython, non of this ever occurs, because they also have an optional C implementation with entirely different logic
<arigato> be careful, hasattr(...) will eat the recursion error if it occurs, which will cause a huge performance hit
<mgorny> cfbolz: plz cc me if you file thatbug; or let me know if you don't want to do it and i should file it instead ;-)
<mgorny> (i'm "mgorny" on github)
<cfbolz> oh no, the code owner :-/
<cfbolz> mgorny: opened a bug and a pr
<cfbolz> mgorny: I pushed the fix to pypy's py3.9 branch
<mgorny> thanks
lritter has quit [Ping timeout: 252 seconds]
otisolsen70 has quit [Quit: Leaving]