-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: hashing datetime64 objects #50960
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
Changes from 1 commit
7761ecd
610b0c6
0e140ae
919383c
ae8c0bb
92a39eb
2f67805
0635f86
229ab72
6e96805
24fda82
058b666
7398991
3fdf564
6e4836e
f55337a
a97dfc9
1338ca2
9fb1987
818682c
74ab540
037ba05
7a4b1ab
47e5247
dcd09dd
32d479b
d47cfd8
c091317
1ce791e
704fb69
6d962b0
f838953
0d8500a
58a29b6
95069e0
7362f3e
dd08670
998a4cc
b75730b
5c57a5e
6b4460f
c94609b
afe9493
4fecc97
b4cc41e
c620339
3633653
c55f182
6e2bbf0
23c2826
143b3a3
ffb8365
1fdfd64
5513721
875d6af
a29a56a
40e6e17
15a701c
af25f40
9d5cb46
d5a031d
bd7d432
394d86e
1766bc3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,7 @@ typedef struct { | |
int (*make_iso_8601_timedelta)(pandas_timedeltastruct *, char *, size_t *); | ||
Py_hash_t (*hash_datetime_from_struct)(npy_datetimestruct* dts); | ||
Py_hash_t (*np_datetime64_object_hash)(PyDatetimeScalarObject* key); | ||
Py_uhash_t tuple_update_uhash(Py_uhash_t acc, Py_uhash_t lane); | ||
} PandasDateTime_CAPI; | ||
|
||
// The capsule name appears limited to module.attributename; see bpo-32414 | ||
|
@@ -114,6 +115,8 @@ static PandasDateTime_CAPI *PandasDateTimeAPI = NULL; | |
PandasDateTimeAPI->hash_datetime_from_struct((dts)) | ||
#define np_datetime64_object_hash(dts) \ | ||
PandasDateTimeAPI->np_datetime64_object_hash((key)) | ||
#define tuple_update_uhash(acc, lane) \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK need to be a bit careful here. Remember that C has no concept of namespaces - if you define With the capsule, the function that you ultimately include as part of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tuple_update_hash is accessed in khash_python.h, is only defined in np_datetime.c AFAICT There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Header files are loosely just copied into whatever they are included into. So you are doing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do they have a different notion of what tuple_update_uhash is? It's only defined in one place. Opened #51951 to revert the capsuling. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You have a declaration for I understand it is frustrating but the implementation here is not correct. Have you checked out any books on C programming? K&R is a nice book for a quick intro - might be worth reading through that or another book before coming back to this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah sorry not khash_python looks like np_datetime There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, so if i remove it from np_datetime.h i get build failure locally There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's right. The way the includes happen and the way you have things structured now there you are either providing conflicting declarations for I really think you'd be better off getting an intro to C book and learning a bit more about what headers/modules do with respect to the different compilation phases. Of course always good to get hands-on experience, but doing some of the basics first before trying to dive in would probably make the process easier There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will I appreciate your encouragement but I have a long reading list and dayjob responsibilities. Can you just tell me how to fix the [expletive deleted] thing that was working a week ago? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Move your hashing functions to the capsule as static functions |
||
PandasDateTimeAPI->tuple_update_uhash((acc), (lane)) | ||
#endif /* !defined(_PANDAS_DATETIME_IMPL) */ | ||
|
||
#ifdef __cplusplus | ||
|
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.
You also need to define a macro for this later in the file
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.
didnt seem to do it