cfbolz changed the topic of #pypy to: PyPy, the flexible snake (IRC logs: https://quodlibet.duckdns.org/irc/pypy/latest.log.html#irc-end ) | use cffi for calling C | if a pep adds a mere 25-30 [C-API] functions or so, it's a drop in the ocean (cough) - Armin
marky1991 has joined #pypy
CrazyPython has quit [Remote host closed the connection]
dddddd has quit [Remote host closed the connection]
mattip has quit [Remote host closed the connection]
ajlawrence has joined #pypy
<ajlawrence>
How do I trigger the module __init__ method from a test? I have an app level test where a module is imported but it does not seem to be initialized.
ajlawrence has quit [Remote host closed the connection]
<arigato>
cfbolz: re having at look at c0b2526268ab: seems fine to me. You managed to make the special-casing quite small
<cfbolz>
arigato: cool
<cfbolz>
arigato: do you have a clue what we do about the recent issues about other threads that access frames?
<arigato>
yes
<arigato>
accessing frames from a different thread is a known problem with our jit, I think
<arigato>
it's also why sys._current_frames() returns sometimes "fake" frames
<cfbolz>
arigato: hm, ok
<cfbolz>
arigato: but other threads enabling trace hooks not working is really a bit annoying
<arigato>
hum, maybe I'm wrong somewhere
<arigato>
...no, at least issue #3068 Error setting frame tracing from a different thread
<arigato>
is about sys._current_frames()
<arigato>
see docstring of sys._current_frames
<cfbolz>
arigato: ah, I see
<cfbolz>
Right, it's an undocumented API
<arigato>
seems we should at least write-protect the fake_frame instances
<cfbolz>
arigato: to not give the wrong impression? Yes
<arigato>
I'm unsure how we can help fix the issue described in #3068, though
<cfbolz>
arigato: you mean how to debug other threads?
<arigato>
maybe add a boolean argument to _current_frames, and issue a warning when called without argument?
<arigato>
yes
<arigato>
is it really possible to force all frames from a different thread?
<arigato>
probably... then maybe add a new function like __pypy__.force_frame(thread_id) => real forced top-level frame?
<arigato>
to let the user force the frames of only one thread at a time
<cfbolz>
arigato: yes, an API like that sounds like a good idea
<arigato>
I'm not even sure that our sys._current_frames fills in f_code in all cases
<arigato>
...no, it doesn't, that's why there is class fake_code
<cfbolz>
Right
<arigato>
unclear how we should warn the users of sys._current_frames()
<arigato>
maybe issue a warning for *any* call to it?
<arigato>
and if you read the warning you know you can instead call __pypy__.current_frames(force=flag)
<arigato>
or sys._current_frames(force=flag)
BPL has joined #pypy
xorAxAx has joined #pypy
<cfbolz>
arigato: or 'just' a blog post and an updated docstring
agronholm has quit [Ping timeout: 250 seconds]
<arigato>
well the docstring already explains the issue, it wasn't read
mattip has joined #pypy
agronholm has joined #pypy
<cfbolz>
arigato: right :-(
<arigato>
ah, found a nicer solution
<arigato>
rename "fake frames" -> "wrapper frames", and they have property getters/setters and they really force the underlying frame on demand
<arigato>
in a way it's how we should have designed the whole frames, as interp-only objects and with some wrappers for app-level
<arigato>
in this case, I *think* the wrappers can hold on the virtual frame refs
<mattip>
ajlawrence: (for the logs) can you show the code that doesn't work?
<cfbolz>
arigato: ah, interesting
<ajlawrence>
in pypy\module\signal\__init__.py there is the method def __init__(self, space, *args): "NOT_RPYTHON" from pypy.module.signal import interp_signal MixedModule.__init__(self, space, *args) # add the signal-checking callback as an action on the space space.check_signal_action = interp_signal.CheckSignalAction(sp
<ajlawrence>
ace) space.actionflag.register_periodic_action(space.check_signal_action, use_bytecode_counter=False) if space.reverse_debugging: from pypy.interpreter.reverse_debugging import RDBSignalActionFlag space.actionflag.__class__ = RDBSignalActionFlag else:
<ajlawrence>
space.actionflag.__class__ = interp_signal.SignalActionFlag # xxx yes I know the previous line is a hack print "loading module" if os.name == "nt": print "creating sigint event" interp_signal.create_sigint_event(
<ajlawrence>
I would like to check that the method create_sigint_event gets called during initialization of the module.
<ajlawrence>
It is at the bottom of that paste
<mattip>
this is from pypy/module/signal/moduledef.py, not pypy/module/signal/__init__.py, right?
antocuni has quit [Ping timeout: 245 seconds]
tsaka__ has joined #pypy
<mattip>
that code is run as part of the pre-test setup, when translating the module and setting up the space object
<mattip>
so it is not run in the actual test itself
<mattip>
you can replace your new code with a pdb.pdb.set_trace() to see where it is called
<mattip>
ajlawrence ^^^
<mattip>
ajlawrence: I am thinking of starting a release cycle, is winconsoleio getting close?
<ajlawrence>
No. I wouldn't put it in a release if you were planning on doing on soon. I am sure it could be done reasonably quickly but there is a steep learning curve on my part.
<mattip>
if there is anything we can do to help please reach out
<mattip>
s/we/I/
ekaologik has joined #pypy
<mattip>
I would also like to take a look at the packaging branch again ...
mattip has quit [Ping timeout: 244 seconds]
<ajlawrence>
There is no pypy/module/signal/moduledef.py only pypy/module/signal/__init__.py it could be that I am trying to make that call to create the module-scoped signal event from the wrong place.
<ajlawrence>
mattip: I intend to come to the next public sprint if there is one. We can try and get the msi packaging to work then.
speeder39_ has quit [Quit: Connection closed for inactivity]
<arigato>
ajlawrence: you are looking at an older repo or older branch
<arigato>
moduledef.py was added instead of __init__.py one month ago I think
<arigato>
(mostly just a rename, no rewrite of the content)
kenaan_ has joined #pypy
jcea has joined #pypy
<ajlawrence>
arigato: I need to merge those changes into my branch
<arigato>
cfbolz: trying to go with the plain implementation that just returns a dict of the frames---again. It was made more complicated in 2011, but at that point in time our JIT did not have JITFRAMEs at all and so we had to be quite careful. I think that the simple implementation should at least work fine now
<cfbolz>
arigato: ok, that would be really cool
<arigato>
I'll try to test, of course, if I manage
<cfbolz>
arigato: seems we repeatly forget what the current restrictions of virtualizables are
<arigato>
yes
<arigato>
I'm very unsure when I say I *think* it should work
<cfbolz>
arigato: right
<cfbolz>
But I have this memory too that since jitframes they became a lot more foolproof to use
<arigato>
sorry, I didn't realize it was already there
<arigato>
I wrote an answer to the guy who, for some reason, gave me a private mail about sourcehut, asking if he knows more about the points we discuss here
<arigato>
cfbolz: that looks like a bit of a waste of electricity, unless they have a good plan to make these multiple runs actually differ from each other