Skip to content

Commit

Permalink
Fix deprecated read and write (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
devmotion committed Sep 29, 2020
1 parent bb487bc commit 0208256
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Expand Up @@ -3,7 +3,7 @@ uuid = "c7f686f2-ff18-58e9-bc7b-31028e88f75d"
keywords = ["markov chain monte carlo", "probablistic programming"]
license = "MIT"
desc = "Chain types and utility functions for MCMC simulations."
version = "4.2.1"
version = "4.2.2"

[deps]
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
Expand Down
12 changes: 8 additions & 4 deletions src/MCMCChains.jl
Expand Up @@ -79,23 +79,27 @@ include("rstar.jl")

# deprecations
# TODO: Remove dependency on Serialization if this deprecation is removed
# somehow `@deprecate` doesn't work with qualified function names,
# so we use the following hack
const _read = Base.read
const _write = Base.write
@static if VERSION < v"1.1"
Base.@deprecate read(
Base.@deprecate _read(
f::AbstractString,
::Type{T}
) where {T<:Chains} open(Serialization.deserialize, f, "r") false
Base.@deprecate write(
Base.@deprecate _write(
f::AbstractString,
c::Chains
) open(f, "w") do io
Serialization.serialize(io, c)
end false
else
Base.@deprecate read(
Base.@deprecate _read(
f::AbstractString,
::Type{T}
) where {T<:Chains} Serialization.deserialize(f) false
Base.@deprecate write(
Base.@deprecate _write(
f::AbstractString,
c::Chains
) Serialization.serialize(f, c) false
Expand Down

2 comments on commit 0208256

@devmotion
Copy link
Member Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/22164

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v4.2.2 -m "<description of version>" 0208256c78bc5d8b0cfc1badc157c50869963b42
git push origin v4.2.2

Please sign in to comment.