-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Fix 25648 improve read csv stacktrace on bad argument #33023
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
Fix 25648 improve read csv stacktrace on bad argument #33023
Conversation
It works, but it may not be pretty because it uses |
Yea this is pretty hacky :-X is this really the only option? |
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.
-1 on this change unfortunately. exec
is extremely hacky for something that is arguably minor.
While I don't have an immediate alternative off the top of my head, I think it's better to let this one percolate a little than to force a fix.
Co-Authored-By: gfyoung <gfyoung17+GitHub@gmail.com>
The options to fix this are limited by the fact that the exception raising mechanism uses a read-only variable of the code attribute of a function: I see 4 options in total:
May I have your suggestions/votes please |
Middle ground option: Rename Another middle ground option: Create a wrapper around The disadvantage is we lose the signature when we do |
agree with comments here - we cannot use string execution like this you an try setting parser_f.name = ... |
Unfortunately, the stacktrace uses a read-only attribute to provide the function name in that error. |
@roberthdevries can you rebase |
Before rebasing, I think it's only fair that we get some consensus on how to address the underlying problem, given that we largely agree that the proposed fix is not something we would like to merge. |
I am currently ill, and not able to work on this |
@roberthdevries : Oh no! Very sorry to hear that. Hope you get better soon. We can take over this PR once we get some consensus. |
is it possible compat.set_function_name may work where just setting |
@jbrockmendel : Unfortunately not. As mentioned in the OP, the function name in the error message is populated from a read-only attribute. |
OK, then im inclined towards the emerging consensus of "learn to live with it" |
Learn to live with it? We've been living with this stacktrace issue for years 😄 |
@roberthdevries Thanks for looking into this. closing for now as stale. ping if you want to continue. |
Can you mark #25648 as wontfix? |
added a needs discussion label and removed the contributions welcome for now. |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff