Repository navigation
Revert deprecation of make_function_with_signature - #8624
Merged
Merged
Conversation
Member
|
Thank you @larrybradley for the very quick fix. I agree that we should revert rather than ship a broken solution. If someone has strong feelings that the deprecation has to go into 3.2 to be able to remove it in 4.0 then please open a PR asap. |
bsipocz
approved these changes
Apr 24, 2019
Member
|
This is all green except the docs build that I'm dealing with separately. |
Member
|
Thanks for this fix @larrybradley! |
Member
|
@perrygreenfield , if this function is not used in your refactored code, then we might be able to revisit the deprecation once your refactored |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
make_function_with_signaturefunction was deprecated in #7554 (11bca39). However, it is still used inmodeling/core.pyto dynamically add keyword arguments to the__call__method of some models.As a result, cryptic
AstropyDeprecationWarningsare currently being issued whenever modeling is imported:Further, it's causing CI tests to fail in
photutils(this is how I discovered the issue) becauseastropydeprecations are treated as exceptions by default inastropy.tests.helper.enable_deprecations_as_exceptions.My initial PR attempt (larrybradley@293b7a1) to replace those remaining
make_function_with_signaturecalls withinspect.Signaturefailed. I don't see an easy way to replicate themake_function_with_signatureusage in modeling withinspect.Signature(if it's possible at all). For example,make_function_with_signaturetakes avarkwargsargument (e.g.**kwargs; see example use inmodeling/core.pyhere: https://github.com/astropy/astropy/blob/master/astropy/modeling/core.py#L419) that is not allowed as ainspect.Parametername. Also, modeling uses aupdate_wrappermethod to make it look like the dynamically-created__call__method was defined in the class (by defining__module__,__doc__, etc. on the new function). That machinery depends onmake_function_with_signaturereturning an actual function.This PR simply reverts the deprecation of
make_function_with_signaturesince it's still being used inastropy.modeling(we shouldn't be issuing deprecation warnings from our own code). I think it's the most sensible thing to do for the v3.2 release, unless someone can quickly figure out how to refactor modeling to remove the remainingmake_function_with_signaturecalls.