Skip to content

CLN: Exception in core.dtypes #28387

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 7 commits into from
Sep 13, 2019
Merged

Conversation

jbrockmendel
Copy link
Member

No description provided.

@jbrockmendel
Copy link
Member Author

I can't duplicate the black complaints on Mac or Linux, both with 19.3b0

@jreback jreback added the Clean label Sep 11, 2019
@jreback jreback added this to the 1.0 milestone Sep 11, 2019
@jreback
Copy link
Contributor

jreback commented Sep 11, 2019

lgtm. merge pending CI updates.

@WillAyd
Copy link
Member

WillAyd commented Sep 11, 2019

Just a guess but is it the double quote escaping that black doesn't like? Seems like 4 files failed and that's done in 4 files. Maybe single quotes for the outer string

I think black mostly tries to avoid backslash escaping:

https://github.com/psf/black#strings

@jbrockmendel
Copy link
Member Author

That seems to fix it, thanks @WillAyd

@@ -67,7 +67,7 @@ def test_astype_cannot_cast(self, index, dtype):
index.astype(dtype)

def test_astype_invalid_dtype(self, index):
msg = "data type 'fake_dtype' not understood"
msg = 'data type "fake_dtype" not understood'
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to change the quoting here? I'm actually surprised this doesn't cause failures since the exception message shown in diff uses single quotes around the bad dtype

Copy link
Member Author

Choose a reason for hiding this comment

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

this is now passing through an exception raised by numpy

if not isinstance(dtype, str):
raise TypeError("data type not understood")
except SyntaxError:
# np.dtype uses `eval` which can raise SyntaxError
Copy link
Member

Choose a reason for hiding this comment

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

You can easily end up here with something that does not raise a syntaxError

But I assume the idea is that in that case the TypeError generated by numpy is fine to raise directly?

If so, can you add a comment for that?

Copy link
Member

Choose a reason for hiding this comment

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

(based on your comment below, I suppose that is indeed the case)

Copy link
Contributor

Choose a reason for hiding this comment

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

@jorisvandenbossche I am not sure it matters; this will raise a TypeError if its invalid anyhow (catching the SyntaxError is just for hygiene of the error message)

@jreback
Copy link
Contributor

jreback commented Sep 13, 2019

lgtm. @WillAyd if you had comments.

@WillAyd WillAyd merged commit 330bede into pandas-dev:master Sep 13, 2019
@WillAyd
Copy link
Member

WillAyd commented Sep 13, 2019

Thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the faster11 branch September 13, 2019 22:28
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants