Skip to content

getiter: use tp_iter for non python types #794

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 3, 2015
Merged

Conversation

undingen
Copy link
Contributor

@undingen undingen commented Aug 3, 2015

                           ea3daebf08d007db3e:  7075b3803b12f58f8f:
      django_template3.py             3.3s (4)             3.3s (4)  -0.3%
            pyxl_bench.py             2.8s (4)             2.8s (4)  -1.3%
sqlalchemy_imperative2.py             3.2s (4)             3.2s (4)  -2.3%
                  geomean                 3.1s                 3.1s  -1.3%

@@ -1478,6 +1478,7 @@ void setupBuiltins() {
enumerate_cls->giveAttr("__hasnext__",
new BoxedFunction(boxRTFunction((void*)BoxedEnumerate::hasnext, BOXED_BOOL, 1)));
enumerate_cls->freeze();
enumerate_cls->tp_iter = BoxedEnumerate::iter;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think sharing the code between the capi (tp_iter) and c++ (__iter__ attribute) versions is fine since none of these functions should throw any exceptions, but maybe we could add noexcept to these functions?

@undingen
Copy link
Contributor Author

undingen commented Aug 3, 2015

I added the noexcept specifiers.

kmod added a commit that referenced this pull request Aug 3, 2015
getiter: use tp_iter for non python types
@kmod kmod merged commit 8ffb67a into pyston:master Aug 3, 2015
@kmod
Copy link
Collaborator

kmod commented Aug 3, 2015

thanks :) I'm trying to think of a way to have callers also specify the exception-style they expect their callee to have, and then hopefully get the type system to enforce a lot of this so we don't have to think about it any more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants