[Bug #19868] Deprecate Process::Status#&
and Process::Status#>>
This commit is contained in:
parent
b6de0a6c69
commit
998ae7c3f3
Notes:
git
2023-09-14 07:41:30 +00:00
5
NEWS.md
5
NEWS.md
@ -38,6 +38,10 @@ Note: We're only listing outstanding class updates.
|
||||
* MatchData#named_captures now accepts optional `symbolize_names`
|
||||
keyword. [[Feature #19591]]
|
||||
|
||||
* Process::Status
|
||||
|
||||
* Process::Status#& and Process::Status#>> are deprecated. [[Bug #19868]]
|
||||
|
||||
* String
|
||||
|
||||
* String#unpack now raises ArgumentError for unknown directives. [[Bug #19150]]
|
||||
@ -182,3 +186,4 @@ changelog for details of the default gems or bundled gems.
|
||||
[Feature #19776]: https://bugs.ruby-lang.org/issues/19776
|
||||
[Feature #19785]: https://bugs.ruby-lang.org/issues/19785
|
||||
[Feature #19843]: https://bugs.ruby-lang.org/issues/19843
|
||||
[Bug #19868]: https://bugs.ruby-lang.org/issues/19868
|
||||
|
12
process.c
12
process.c
@ -870,7 +870,7 @@ pst_equal(VALUE st1, VALUE st2)
|
||||
* call-seq:
|
||||
* stat & mask -> integer
|
||||
*
|
||||
* The use of this method is discouraged; use other attribute methods.
|
||||
* This method is deprecated; use other attribute methods.
|
||||
*
|
||||
* Returns the logical AND of the value of #to_i with +mask+:
|
||||
*
|
||||
@ -891,7 +891,9 @@ pst_bitand(VALUE st1, VALUE st2)
|
||||
if (mask < 0) {
|
||||
rb_raise(rb_eArgError, "negative mask value: %d", mask);
|
||||
}
|
||||
#define WARN_SUGGEST(suggest) rb_warn("Use " suggest " instead of Process::Status#&")
|
||||
#define WARN_SUGGEST(suggest) \
|
||||
rb_warn_deprecated_to_remove_at(3.4, "Process::Status#&", suggest)
|
||||
|
||||
switch (mask) {
|
||||
case 0x80:
|
||||
WARN_SUGGEST("Process::Status#coredump?");
|
||||
@ -920,7 +922,7 @@ pst_bitand(VALUE st1, VALUE st2)
|
||||
* call-seq:
|
||||
* stat >> places -> integer
|
||||
*
|
||||
* The use of this method is discouraged; use other predicate methods.
|
||||
* This method is deprecated; use other predicate methods.
|
||||
*
|
||||
* Returns the value of #to_i, shifted +places+ to the right:
|
||||
*
|
||||
@ -942,7 +944,9 @@ pst_rshift(VALUE st1, VALUE st2)
|
||||
if (places < 0) {
|
||||
rb_raise(rb_eArgError, "negative shift value: %d", places);
|
||||
}
|
||||
#define WARN_SUGGEST(suggest) rb_warn("Use " suggest " instead of Process::Status#>>")
|
||||
#define WARN_SUGGEST(suggest) \
|
||||
rb_warn_deprecated_to_remove_at(3.4, "Process::Status#>>", suggest)
|
||||
|
||||
switch (places) {
|
||||
case 7:
|
||||
WARN_SUGGEST("Process::Status#coredump?");
|
||||
|
@ -1451,10 +1451,10 @@ class TestProcess < Test::Unit::TestCase
|
||||
assert_equal(s, s)
|
||||
assert_equal(s, s.to_i)
|
||||
|
||||
assert_warn(/\bUse .*Process::Status/) do
|
||||
assert_deprecated_warn(/\buse .*Process::Status/) do
|
||||
assert_equal(s.to_i & 0x55555555, s & 0x55555555)
|
||||
end
|
||||
assert_warn(/\bUse .*Process::Status/) do
|
||||
assert_deprecated_warn(/\buse .*Process::Status/) do
|
||||
assert_equal(s.to_i >> 1, s >> 1)
|
||||
end
|
||||
assert_raise(ArgumentError) do
|
||||
|
Loading…
x
Reference in New Issue
Block a user