-
-
Notifications
You must be signed in to change notification settings - Fork 3
Conversation
As part of this PR, could you please also expose |
Please also see comments on #30. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly LGTM now, just a few adjustments in tests and API needed.
I've just take a look at Travis build log and turns out it failed because
in any order you find suitable. There are bunch of tutorials for interactive git rebase online. |
There is this error I don't know why happens: ================================================================================= ERRORS =================================================================================
__________________________________________________________________ ERROR at teardown of test_gain_auto ___________________________________________________________________
@fixture(scope='session')
def device():
"""Provide the default device."""
> with Device() as dev: yield dev
tests/conftest.py:32:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/palace.pyx:175: in palace.Device.__exit__
self.close()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self.impl.close()
E RuntimeError: Trying to close device with contexts
src/palace.pyx:329: RuntimeError I suspect this has something to do with my edit of Also I don't understand why these 11 non-context tests failed even after I pulling from master. (Edit: nvm it failed on master too, this merge failed due to the error mentioned above). |
I think it's pretty clear why: RuntimeError: Trying to close device with contexts It's likely that there're contexts left undestroyed (I'm looking at the
pytest with fixtures is very fragile when the fixtures get fucked, and since all tests uses the device fixture, it's normal that they failed.
I hope you meant after checking out master, then try to delete the compiled bytecodes in |
Just looked through the builds above and it started failing here. |
I don't think it's relevant, since we've changed the approach. Please try the suggested changes. |
Yay it passes the test. Is there any other change request before rebasing? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally this looks good to me, aside a few tiny details.
Note on documentation, the explanation of context manager needs update after the change (that's why current_context
is required in the first place, there's no way to describe what the with
thing does without the function).
Just in case the comment requesting rebase get lost, split the patch into two commits: one for the change and one for the test, in any order. Cheers.
Hmm... I wish I always made different commits for separate files. Is that okay if I leave some commit changing Aight, I think I need some practice first. |
if alure.Context.get_current() == <alure.Context> nullptr: | ||
return None | ||
cdef Context current = Context.__new__(Context) | ||
current.impl = alure.Context.get_current() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no point of calling alure.Context.get_current()
twice. As defined in alure2.h
, bool
of alure::Context
is the nonnullity, thus all you have to do is just if not current: return None
. Also in the line below use __new__
to create the empty device, just for consistency (ugh why isn't @9a24f0 done with #38?). Remember to fixup
the changes (git rebase -i HEAD~2
).
After this, use the Rebase and merge button on Github to merge the changes. Then on branch master pump the version (in setup.cfg
, to 0.0.10 I think, you can do it as part of the fixup
) draft a new pre-release with sdist
(./setup.py sdist
) attached, wait for the wheels to get pushed to PyPI by Travis, then install it using pip. Switch to gh-pages
branch, update the version (in src/conf.py
), generate the new documentation and push. That's all the work for a new release lmao.
And don't forget to document how the context returned by current_context
have the wrong message handler in a new issue (pseudo test: with context: assert current_context().message_handler is context.message_handler
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test passed, feel free to Rebase and merge when you're ready.
55242c0
to
469a201
Compare
I try to resolve #30 by saving context into a static stack-list
current_context
(maybe I should rename it tocurrent_contexts
) in which the top (last) item is the current context. When a context is destroyed (__exit__
), it's popped and the latest previous context will be loaded intouse_context
.