Skip to content
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

NetSpec: type-check Function inputs (they must be Top instances) #3153

Merged
merged 1 commit into from
Apr 14, 2017

Conversation

jeffdonahue
Copy link
Contributor

This adds simple type-checking for a common (at least for me) class of NetSpec use errors: the use of non-Top instances as inputs to Functions. The exception is raised when the Function is __init__ed rather than lazily when to_proto is called, making it easier to debug (IMO).

@jeffdonahue
Copy link
Contributor Author

(Fails Python3 Travis checks due to apparently different behavior of either regexps or unittest.assertRaisesRegexp; will look into debugging that pending @longjon's general approval of this. fixed, and I was of course wrong about the cause -- in Python 3 print ('%s' % type(())) prints <class 'tuple'> rather than <type 'tuple'>, so the regex needed to be generalized to handle that.)

@jeffdonahue jeffdonahue force-pushed the netspec-type-check branch 5 times, most recently from 774bc4b to 1072539 Compare October 6, 2015 09:45
@shelhamer shelhamer merged commit 1df3a25 into BVLC:master Apr 14, 2017
@shelhamer
Copy link
Member

Thanks for the net spec check Jeff!

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

Successfully merging this pull request may close these issues.

3 participants