Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-77188: Name-mangled private methods don't roundtrip when pickling#21480

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
ZackerySpytz wants to merge5 commits intopython:main
base:main
Choose a base branch
Loading
fromZackerySpytz:bpo-33007-pickle-mangle-roundtrip

Conversation

ZackerySpytz
Copy link
Contributor

@ZackerySpytzZackerySpytz commentedJul 15, 2020
edited by bedevere-appbot
Loading

Copy link
Contributor

@nanjekyejoannahnanjekyejoannah left a comment

Choose a reason for hiding this comment

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

Makes sense, please fix the conflict for merge

@furkanonder
Copy link
Contributor

@ZackerySpytz Are you gonna continue this task?@nanjekyejoannah You can see the editedPR for this issue.

@ZackerySpytz
Copy link
ContributorAuthor

Yes, I will update this PR.

nanjekyejoannah reacted with thumbs up emoji

@kumaraditya303kumaraditya303 added type-bugAn unexpected behavior, bug, or error needs backport to 3.10only security fixes needs backport to 3.11only security fixes labelsDec 17, 2022
@pythonpython deleted a comment fromnetlifybotDec 17, 2022
@serhiy-storchaka
Copy link
Member

In general, LGTM.

But how much it affects the performance? Could you please run some microbenchmarks to measure the changes in the pickling time for non-private methods? If the difference is insignificant, it is good, but if it is large, it could be worth to optimize the code for non-private methods.

@hugovkhugovk removed the needs backport to 3.10only security fixes labelApr 7, 2023
@erlend-aaslanderlend-aasland changed the titlebpo-33007: Name-mangled private methods don't roundtrip when picklinggh-77188: Name-mangled private methods don't roundtrip when picklingJan 5, 2024
@serhiy-storchakaserhiy-storchaka added needs backport to 3.12only security fixes needs backport to 3.13bugs and security fixes and removed needs backport to 3.11only security fixes labelsMay 9, 2024
vyrjana added a commit to vyrjana/lmfit-py that referenced this pull requestNov 23, 2024
…kling- Attempting to make use of multiprocessing.Pool while providing, e.g., Minimizer.least_squares a function for calculating the Jacobian did not work prior to the renaming of the method due to an issue related to pickling and unpickling of private methods. See the (currently) open issue (python/cpython#77188) and pull request (python/cpython#21480) for more information.
newville pushed a commit to lmfit/lmfit-py that referenced this pull requestDec 5, 2024
* Updated the Minimizer.least_squares method to wrap the Jacobian function- The Jacobian function provided by the user is now handled similarly to how it is handled in, e.g., Minimizer.leastsq.- If the Jacobian function is called 'Dfun' in the keyword arguments, then it is also accepted (Minimizer.scalar_minimize already does this).* Updated the Minimizer.__jacobian method signature to fix exception- The signature now matches the signature of Minimizer.__residual. This was changed because the following exception was being raised whenever the user provided a function for calculating the Jacobian: "TypeError: Minimizer.__jacobian() got an unexpected keyword argument 'apply_bounds_transformation'".* Updated the Minimizer.__jacobian method to use the new parameter- The updating of the parameter values is now similar to how it is done in Minimizer.__residual.* Updated test_least_squares_jacobian_types to handle the wrapped Jacobian function- The params argument of the jac_array function is now an actual Parameters object like it is in the f function, which means that the parameters can be accessed via string keys.* Updated the coerce_float64 function- Added explicit support for sparse matrices (e.g., Block Sparse Row) and LinearOperator objects. This change is needed because the updated test_least_squares_jacobian_types would otherwise fail. Similar to how these types are handled when calculating the Hessian matrix in Minimizer.least_squares.* Renamed the Minimizer.__jacobian method to avoid a bug related to pickling- Attempting to make use of multiprocessing.Pool while providing, e.g., Minimizer.least_squares a function for calculating the Jacobian did not work prior to the renaming of the method due to an issue related to pickling and unpickling of private methods. See the (currently) open issue (python/cpython#77188) and pull request (python/cpython#21480) for more information.* Added a test for when the "least_squares" method is provided a function for the Jacobian- Verifies that a) the fitted parameters have the expected values, b) the jac function is actually called, and c) that there are indeed fewer function evaluations as a result.* Updated the docstring of Minimizer._jacobian- The docstring is updated to include the parameters and return values.* Added tests for (un)pickling Minimizer when a Jacobian function is provided* Updated timeout value in test_jacobian_with_forkingpickler- Increased the timeout value so that slow runners can actually succeed instead of timing out. If no timeout was specified, then a failing test could end up hanging instead.* Added an example that demonstrates the benefits of providing a Jacobian function* Updated the list of contributors
@hugovkhugovk removed the needs backport to 3.12only security fixes labelApr 25, 2025
@serhiy-storchakaserhiy-storchaka added the needs backport to 3.14bugs and security fixes labelMay 8, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@nanjekyejoannahnanjekyejoannahnanjekyejoannah left review comments

@MojoVampireMojoVampireMojoVampire approved these changes

@serhiy-storchakaserhiy-storchakaAwaiting requested review from serhiy-storchaka

Assignees
No one assigned
Labels
awaiting core reviewneeds backport to 3.13bugs and security fixesneeds backport to 3.14bugs and security fixestype-bugAn unexpected behavior, bug, or error
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

11 participants
@ZackerySpytz@furkanonder@serhiy-storchaka@MojoVampire@nanjekyejoannah@hugovk@the-knights-who-say-ni@ezio-melotti@bedevere-bot@kumaraditya303@erlend-aasland

[8]ページ先頭

©2009-2025 Movatter.jp