I ran into an issue recently when using rprotobuf to serialize then deserialize a POSIXlt object:
library(RProtoBuf)
obj <- as.POSIXlt(Sys.time())
unserialize_pb(serialize_pb(obj, connection=NULL))
yields the following error:
Error in attributes(xobj) <- attrib[names(attrib) != "class"] :
'names' attribute [11] must be the same length as the vector [1]
what's happening is that the POSIXlt object is represented as a list of attributes in R e.g. (hours, min, sec...) but when iterated over using lapply it appears only to be a list of length 1. Only by unclassing the object do we see its true representation:
> obj
[1] "2018-08-23 16:48:29 AEST"
> unclass(obj)
$`sec`
[1] 29.09264
$min
[1] 48
$hour
[1] 16
$mday
[1] 23
...
this somewhat related to #37 which had a similar issue where the list access had special handling for a particular class of object.
I propose that prior to serializing lists in the package we unclass the object beforehand
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4