-
Notifications
You must be signed in to change notification settings - Fork 47
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
jdatetime and jdate objects cannot be pickled anymore in 3.8.0 #108
Comments
Thanks @sinarezaei for reporting. we will investigate the problem. |
I've created a PR to fix the issue #109 |
It got fixed in 3.8.1 |
Checked, it's fixed in PR, Thanks a lot! |
I think it still has some bug with unpickled jdatetime object. Apparently, the object (retrieved from the previous pickled file) does not work properly with f-string formatting like f'{some_jdatetime:%Y/%m/%d %H:%M:%S}' like the fresh jdatetime object: AttributeError: 'datetime' object has no attribute '_strftime_mapping' OK! I found what is the wrong! The object pickled (dump) by the previous version of jdatetime cannot be treated as a true jdatetime object when retrieved (load) by the new version! The object has been totally restructured. |
The experiment using bash version 4.4.20 and python version 3.9.7: bash :
pthon:
bash:
pthon:
|
I don't think that the object pickled in an old version should be unpickled in the new version. |
Why not?! Even as a subjective opinion, it is strongly arguable. Two basic questions:
Pickling is an essential feature of python for task management and persistency. I have been using hundreds of modules (including jdatetime) with a few dozen of my programs. with exception of a few nasty cases, the requirements have always typically been jdatetime>=3.7.0 and that is the right objective statement. With your statement, my program will be restricted to a specific version of some modules; especially if the user of my programs have already be using it with a large set of preserved data. Of course, we can convert the underlying timestamp of the jdatetime object each time before pickling, and after unpickling; that is, something like:
But, then why we have used jdatetime for in the first place? What about its seamless integration with python ecosystem? Wasn't it supposed to be seamlessly equivalent to the standard datetime module? Good luck |
Thank you @hramezani for attention. OK! I'll check it. Well done. |
Sorry for delay dear @hramezani ; I was expecting the patch appear as a new version of jdatetime (3.8.2)! I am new to GitHub ... as an active user (I have downloaded from it for ages). Any way, I manually modified the file [1] |
@jetX11 Thanks for your feedback. |
In the latest update (3.8.0), jdatetime objects could't be pickled
Results in the following error:
In version 3.6.2 of jdatetime, it was working with no errors
The text was updated successfully, but these errors were encountered: