-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
BUG: Fix test_from_object_array_unicode (test_defchararray.TestBasic)… #7562
Conversation
This isn't actually a |
/* defined(_WIN32) below is because MSVC "isspace" crashes with an assert on | ||
debug when the character is not ASCII | ||
*/ | ||
#if defined(isspace) || defined(_WIN32) | ||
#undef isspace | ||
#define isspace(c) ((c==' ')||(c=='\t')||(c=='\n')||(c=='\r')||(c=='\v')||(c=='\f')) |
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.
Lines < 80 characters.
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.
Lines < 80 characters.
The largest line in the patch have 76 chars.
Or do you mean this line
#define isspace(c) ((c==' ')||(c=='\t')||(c=='\n')||(c=='\r')||(c=='\v')||(c=='\f'))
which was already there?
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.
Yep, might as well fix it.
Sorry, I've seem some TST commits with fixes for broken tests and assumed this would be too. What would be the correct prefix here? |
That would be a simple |
07cb18c
to
2783fc6
Compare
Ok, I've updated it. |
Hmm, there is a EDIT: Seems tne standard isspace is locale dependent, but we override is here to be standard C locale. EDIT2: But isspace is also used for |
I'm wondering if we should make the macro definition unconditional? The other option is to use |
Ok, so what do you suggest? Something like this? NPY_NO_EXPORT int
-NumPyOS_ascii_isspace(char c)
+NumPyOS_ascii_isspace(int c)
{
return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t'
|| c == '\v';
} -#define isspace(c) ((c==' ')||(c=='\t')||(c=='\n')||(c=='\r')||(c=='\v')||(c=='\f'))
+#define isspace(c) NumPyOS_ascii_isspace(c) Edit: now that I saw your edit. Yes, if it must support |
I think the change to |
Maybe want to use a cast to int for the (unsigned) ucs4. My machine has 64 bit ints, so no problem, but might be needed for machines with 32 bit ints. |
Should I change the other |
2783fc6
to
8930da7
Compare
I've updated the commit |
8930da7
to
c0a41ad
Compare
… on Windows debug
c0a41ad
to
2f9a13a
Compare
What happened to this comment? |
Sorry, I deleted it, it was a mistake I made and quickly corrected (was |
OK, let's give this a shot. I think it should be harmless (knock, knock). I'm not sure where all the other problems with the debug version come from. There is a special Python2.7 msvc compiler, Microsoft Visual C++ Compiler for Python 2.7 , that should be compatible with Python 2.7. I don't know if that makes a difference. Note also that all python extensions need to be compiled with the same compiler. MSVC 2010 is much later than the official 2.7 compiler, vs2008. |
Thanks @tadeu . |
Thanks @charris ! |
… on Windows debug
"isspace" crashes with an assert on debug when the character is not ASCII, in Windows