summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2023-09-14 15:19:15 +0900
committerNobuyoshi Nakada <[email protected]>2023-09-14 15:26:25 +0900
commit998ae7c3f36b65f04471cd680b4c7ac78b3d9f30 (patch)
tree57a8cac51c9dd5e99b3305c0f1dd8dcb4ff57401
parentb6de0a6c69a4857ca4347f65d7c9a5cb6e52c5bd (diff)
[Bug #19868] Deprecate `Process::Status#&` and `Process::Status#>>`
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/8392
-rw-r--r--NEWS.md5
-rw-r--r--process.c12
-rw-r--r--test/ruby/test_process.rb4
3 files changed, 15 insertions, 6 deletions
diff --git a/NEWS.md b/NEWS.md
index cb44183265..e350946fee 100644
--- a/NEWS.md
+++ b/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
diff --git a/process.c b/process.c
index 97db867e82..d7e04830ee 100644
--- a/process.c
+++ b/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?");
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index d1fb8d366a..5787f2dbe2 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -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