@@ -212,44 +212,15 @@ defmodule Kernel do
212
212
:erlang . binary_to_float ( some_binary )
213
213
end
214
214
215
- @ doc """
216
- Returns an Erlang term which is the result of decoding the binary
217
- object `binary`, which must be encoded according to the Erlang external
218
- term format.
219
-
220
- ## Examples
221
-
222
- iex> binary_to_term(term_to_binary("foo"))
223
- "foo"
224
-
225
- """
226
- @ spec binary_to_term ( binary ) :: term
215
+ @ doc false
227
216
def binary_to_term ( binary ) do
217
+ IO . write "binary_to_term/1 is deprecated, please use :erlang.binary_to_term/1 instead\n #{ Exception . format_stacktrace } "
228
218
:erlang . binary_to_term ( binary )
229
219
end
230
220
231
- @ doc """
232
- As `binary_to_term/1`, but accepts a safe option useful when receiving
233
- binaries from an untrusted source.
234
-
235
- When enabled, it prevents decoding data that may be used to attack the
236
- Erlang system. In the event of receiving unsafe data, decoding fails
237
- with a badarg error.
238
-
239
- Currently, this prevents creation of new atoms directly, creation of
240
- new atoms indirectly (as they are embedded in certain structures like pids,
241
- refs, funs, etc), and creation of new external function references. None
242
- of those resources are currently garbage collected, so unchecked creation
243
- of them can exhaust available memory.
244
-
245
- ## Examples
246
-
247
- iex> binary_to_term(term_to_binary("foo"), [:safe])
248
- "foo"
249
-
250
- """
251
- @ spec binary_to_term ( binary , [ ] | [ :safe ] ) :: term
221
+ @ doc false
252
222
def binary_to_term ( binary , options ) do
223
+ IO . write "binary_to_term/2 is deprecated, please use :erlang.binary_to_term/2 instead\n #{ Exception . format_stacktrace } "
253
224
:erlang . binary_to_term ( binary , options )
254
225
end
255
226
@@ -971,30 +942,15 @@ defmodule Kernel do
971
942
:erlang . spawn_link ( module , fun , args )
972
943
end
973
944
974
- @ doc """
975
- Returns a binary which is the result of encoding the given `term`
976
- according to the Erlang external term format.
977
-
978
- This can be used for a variety of purposes, for example, writing a term
979
- to a file in an efficient way, or sending an Erlang term to some type
980
- of communications channel not supported by distributed.
981
- """
982
- @ spec term_to_binary ( term ) :: binary
945
+ @ doc false
983
946
def term_to_binary ( term ) do
947
+ IO . write "term_to_binary/1 is deprecated, please use :erlang.term_to_binary/1 instead\n #{ Exception . format_stacktrace } "
984
948
:erlang . term_to_binary ( term )
985
949
end
986
950
987
- @ doc """
988
- The same as `term_to_binary/1` but also supports two options:
989
-
990
- * `compressed`: the level of compression to be used from 0 to 9;
991
- * `minor_version`: used to control the details of encoding. Can be 0 or 1,
992
- please read http://www.erlang.org/doc/man/erlang.html#term_to_binary-2
993
- for more details
994
-
995
- """
996
- @ spec term_to_binary ( term , list ( { :compressed , 0 .. 9 } | { :minor_version , 0 } | { :minor_version , 1 } ) ) :: binary
951
+ @ doc false
997
952
def term_to_binary ( term , opts ) do
953
+ IO . write "term_to_binary/2 is deprecated, please use :erlang.term_to_binary/2 instead\n #{ Exception . format_stacktrace } "
998
954
:erlang . term_to_binary ( term , opts )
999
955
end
1000
956
0 commit comments